File tree Expand file tree Collapse file tree
tests/src/SimpleSAML/Metadata Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1028,22 +1028,30 @@ private static function parseAttributeConsumerService(AttributeConsumingService
10281028
10291029 $ format = null ;
10301030 foreach ($ element ->getRequestedAttribute () as $ child ) {
1031- $ attrname = $ child ->getName ();
1032- $ sp ['attributes ' ][] = $ attrname ;
1031+ $ attrName = $ child ->getName ();
1032+ $ attrNameFormat = $ child ->getNameFormat ();
1033+ $ attrValue = $ child ->getAttributeValues ();
1034+ if (empty ($ attrValue )) {
1035+ $ sp ['attributes ' ][] = $ attrName ;
1036+ } else {
1037+ $ values = [];
1038+ foreach ($ attrValue as $ attrval ) {
1039+ $ values [] = $ attrval ->getValue ();
1040+ }
1041+ $ sp ['attributes ' ][$ attrName ] = $ values ;
1042+ }
10331043
10341044 if ($ child ->getIsRequired () === true ) {
1035- $ sp ['attributes.required ' ][] = $ attrname ;
1045+ $ sp ['attributes.required ' ][] = $ attrName ;
10361046 }
10371047
1038- if ($ child ->getNameFormat () !== null ) {
1039- $ attrformat = $ child ->getNameFormat ();
1040- } else {
1041- $ attrformat = C::NAMEFORMAT_UNSPECIFIED ;
1048+ if ($ attrNameFormat === null ) {
1049+ $ attrNameFormat = C::NAMEFORMAT_UNSPECIFIED ;
10421050 }
10431051
10441052 if ($ format === null ) {
1045- $ format = $ attrformat ;
1046- } elseif ($ format !== $ attrformat ) {
1053+ $ format = $ attrNameFormat ;
1054+ } elseif ($ format !== $ attrNameFormat ) {
10471055 $ format = C::NAMEFORMAT_UNSPECIFIED ;
10481056 }
10491057 }
Original file line number Diff line number Diff line change @@ -228,6 +228,9 @@ public function testAttributeConsumingServiceParsing(): void
228228 <RequestedAttribute FriendlyName="eduPersonPrincipalName" Name="urn:mace:dir:attribute-def:eduPersonPrincipalName" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri" isRequired="true"/>
229229 <RequestedAttribute FriendlyName="mail" Name="urn:mace:dir:attribute-def:mail" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri"/>
230230 <RequestedAttribute FriendlyName="displayName" Name="urn:mace:dir:attribute-def:displayName" NameFormat="urn:mace:shibboleth:1.0:attributeNamespace:uri"/>
231+ <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">
232+ <saml:AttributeValue xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">urn:mace:dir:entitlement:common-lib-terms</saml:AttributeValue>
233+ </RequestedAttribute>
231234 </AttributeConsumingService>
232235 </SPSSODescriptor>
233236
@@ -248,6 +251,9 @@ public function testAttributeConsumingServiceParsing(): void
248251 "urn:mace:dir:attribute-def:eduPersonPrincipalName " ,
249252 "urn:mace:dir:attribute-def:mail " ,
250253 "urn:mace:dir:attribute-def:displayName " ,
254+ "urn:oid:1.3.6.1.4.1.5923.1.1.1.7 " => [
255+ "urn:mace:dir:entitlement:common-lib-terms " ,
256+ ],
251257 ];
252258 $ expected_r = ["urn:mace:dir:attribute-def:eduPersonPrincipalName " ];
253259
You can’t perform that action at this time.
0 commit comments