Skip to content
Snippets Groups Projects
Commit 75f5c85e authored by Brook Schofield's avatar Brook Schofield
Browse files

Improve the local generation of metadata for attributes.required

Useful in the leadup to entity category support to publish
registrationAuthority (which might be overridden by a federation) and
attributes.required.
parent f14d48a3
No related branches found
No related tags found
No related merge requests found
...@@ -478,6 +478,9 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -478,6 +478,9 @@ class SimpleSAML_Metadata_SAMLParser {
if (array_key_exists('attributes', $spd)) { if (array_key_exists('attributes', $spd)) {
$ret['attributes'] = $spd['attributes']; $ret['attributes'] = $spd['attributes'];
} }
if (array_key_exists('attributes.required', $spd)) {
$ret['attributes.required'] = $spd['attributes.required'];
}
if (array_key_exists('attributes.NameFormat', $spd)) { if (array_key_exists('attributes.NameFormat', $spd)) {
$ret['attributes.NameFormat'] = $spd['attributes.NameFormat']; $ret['attributes.NameFormat'] = $spd['attributes.NameFormat'];
} }
...@@ -1098,6 +1101,10 @@ class SimpleSAML_Metadata_SAMLParser { ...@@ -1098,6 +1101,10 @@ class SimpleSAML_Metadata_SAMLParser {
$sp['attributes.required'][] = $attrname; $sp['attributes.required'][] = $attrname;
} }
if ($child->isRequired !== NULL && $child->isRequired === TRUE) {
$sp['attributes.required'][] = $attrname;
}
if ($child->NameFormat !== NULL) { if ($child->NameFormat !== NULL) {
$attrformat = $child->NameFormat; $attrformat = $child->NameFormat;
} else { } else {
......
...@@ -133,6 +133,10 @@ if ($name !== NULL && !empty($attributes)) { ...@@ -133,6 +133,10 @@ if ($name !== NULL && !empty($attributes)) {
$metaArray20['name'] = $name; $metaArray20['name'] = $name;
$metaArray20['attributes'] = $attributes; $metaArray20['attributes'] = $attributes;
$metaArray20['attributes.required'] = $spconfig->getArray('attributes.required', array()); $metaArray20['attributes.required'] = $spconfig->getArray('attributes.required', array());
if (empty($metaArray20['attributes.required'])) {
unset($metaArray20['attributes.required']);
}
$description = $spconfig->getArray('description', NULL); $description = $spconfig->getArray('description', NULL);
if ($description !== NULL) { if ($description !== NULL) {
...@@ -184,6 +188,11 @@ if (count($keys) === 1) { ...@@ -184,6 +188,11 @@ if (count($keys) === 1) {
$metaArray20['keys'] = $keys; $metaArray20['keys'] = $keys;
} }
// add EntityAttributes extension
if ($spconfig->hasValue('EntityAttributes')) {
$metaArray20['EntityAttributes'] = $spconfig->getArray('EntityAttributes');
}
// add UIInfo extension // add UIInfo extension
if ($spconfig->hasValue('UIInfo')) { if ($spconfig->hasValue('UIInfo')) {
$metaArray20['UIInfo'] = $spconfig->getArray('UIInfo'); $metaArray20['UIInfo'] = $spconfig->getArray('UIInfo');
...@@ -215,7 +224,6 @@ $metaBuilder->addOrganizationInfo($metaArray20); ...@@ -215,7 +224,6 @@ $metaBuilder->addOrganizationInfo($metaArray20);
$xml = $metaBuilder->getEntityDescriptorText(); $xml = $metaBuilder->getEntityDescriptorText();
unset($metaArray20['attributes.required']);
unset($metaArray20['UIInfo']); unset($metaArray20['UIInfo']);
unset($metaArray20['metadata-set']); unset($metaArray20['metadata-set']);
unset($metaArray20['entityid']); unset($metaArray20['entityid']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment