Skip to content

Commit c18bfbc

Browse files
committed
Record values from RequestedAttributes
1 parent 4398438 commit c18bfbc

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/SimpleSAML/Metadata/SAMLParser.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1075,7 +1075,16 @@ private static function parseAttributeConsumerService(AttributeConsumingService
10751075
$sp['attributes.required'] = [];
10761076
foreach ($element->getRequestedAttribute() as $child) {
10771077
$attrname = $child->getName();
1078-
$sp['attributes'][] = $attrname;
1078+
$attrvalue = $child->getAttributeValue();
1079+
if (empty($attrvalue)) {
1080+
$sp['attributes'][] = $attrname;
1081+
} else {
1082+
$values = [];
1083+
foreach ($attrvalue as $attrval) {
1084+
$values[] = $attrval->getString();
1085+
}
1086+
$sp['attributes'][$attrname] = $values;
1087+
}
10791088

10801089
if ($child->getIsRequired() === true) {
10811090
$sp['attributes.required'][] = $attrname;

tests/src/SimpleSAML/Metadata/SAMLParserTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ public function testAttributeConsumingServiceParsing(): void
222222
<RequestedAttribute FriendlyName="eduPersonPrincipalName" Name="urn:mace:dir:attribute-def:eduPersonPrincipalName" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri" isRequired="true"/>
223223
<RequestedAttribute FriendlyName="mail" Name="urn:mace:dir:attribute-def:mail" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri"/>
224224
<RequestedAttribute FriendlyName="displayName" Name="urn:mace:dir:attribute-def:displayName" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri"/>
225+
<RequestedAttribute FriendlyName="eduPersonEntitlement" Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.7" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri">
226+
<saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">urn:mace:dir:entitlement:common-lib-terms</saml:AttributeValue>
227+
</RequestedAttribute>
225228
</AttributeConsumingService>
226229
</SPSSODescriptor>
227230
@@ -243,6 +246,9 @@ public function testAttributeConsumingServiceParsing(): void
243246
"urn:mace:dir:attribute-def:eduPersonPrincipalName",
244247
"urn:mace:dir:attribute-def:mail",
245248
"urn:mace:dir:attribute-def:displayName",
249+
"urn:oid:1.3.6.1.4.1.5923.1.1.1.7" => [
250+
"urn:mace:dir:entitlement:common-lib-terms",
251+
],
246252
];
247253
$expected_r = ["urn:mace:dir:attribute-def:eduPersonPrincipalName"];
248254

0 commit comments

Comments
 (0)