Skip to content
Snippets Groups Projects
Commit ea6c80b5 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Merge branch 'required-attributes' of...

Merge branch 'required-attributes' of https://github.com/gollmann/simplesamlphp into gollmann-required-attributes
parents 5a1aeabb d6f58c2a
No related branches found
No related tags found
No related merge requests found
......@@ -615,6 +615,9 @@ class SimpleSAML_Metadata_SAMLParser {
if (array_key_exists('attributes', $spd)) {
$ret['attributes'] = $spd['attributes'];
}
if (array_key_exists('attributes.required', $spd)) {
$ret['attributes.required'] = $spd['attributes.required'];
}
if (array_key_exists('attributes.NameFormat', $spd)) {
$ret['attributes.NameFormat'] = $spd['attributes.NameFormat'];
}
......@@ -1086,9 +1089,14 @@ class SimpleSAML_Metadata_SAMLParser {
$format = NULL;
$sp['attributes'] = array();
$sp['attributes.required'] = array();
foreach ($element->RequestedAttribute AS $child) {
$attrname = $child->Name;
$sp['attributes'][] = $attrname;
if ($child->isRequired) {
$sp['attributes.required'][] = $attrname;
}
if ($child->NameFormat !== NULL) {
$attrformat = $child->NameFormat;
......@@ -1110,6 +1118,9 @@ class SimpleSAML_Metadata_SAMLParser {
*/
unset($sp['attributes']);
}
if (empty($sp['attributes.required'])) {
unset($sp['attributes.required']);
}
if ($format !== SAML2_Const::NAMEFORMAT_UNSPECIFIED && $format !== NULL) {
$sp['attributes.NameFormat'] = $format;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment