|
13 | 13 | use SAML2\SignedElementHelper; |
14 | 14 | use SAML2\XML\ds\X509Certificate; |
15 | 15 | use SAML2\XML\ds\X509Data; |
| 16 | +use SAML2\XML\idpdisc\DiscoveryResponse; |
16 | 17 | use SAML2\XML\md\AttributeAuthorityDescriptor; |
17 | 18 | use SAML2\XML\md\AttributeConsumingService; |
18 | 19 | use SAML2\XML\md\ContactPerson; |
@@ -507,6 +508,10 @@ private function addExtensions(array &$metadata, array $roleDescriptor): void |
507 | 508 | } |
508 | 509 | } |
509 | 510 |
|
| 511 | + if (!empty($roleDescriptor['DiscoveryResponse'])) { |
| 512 | + $metadata['DiscoveryResponse'] = $roleDescriptor['DiscoveryResponse']; |
| 513 | + } |
| 514 | + |
510 | 515 | if (!empty($roleDescriptor['UIInfo'])) { |
511 | 516 | $metadata['UIInfo'] = $roleDescriptor['UIInfo']; |
512 | 517 | } |
@@ -737,6 +742,7 @@ private static function parseRoleDescriptorType(RoleDescriptor $element, ?int $e |
737 | 742 | $ext = self::processExtensions($element); |
738 | 743 | $ret['scope'] = $ext['scope']; |
739 | 744 | $ret['EntityAttributes'] = $ext['EntityAttributes']; |
| 745 | + $ret['DiscoveryResponse'] = $ext['DiscoveryResponse']; |
740 | 746 | $ret['UIInfo'] = $ext['UIInfo']; |
741 | 747 | $ret['DiscoHints'] = $ext['DiscoHints']; |
742 | 748 |
|
@@ -770,7 +776,6 @@ private static function parseSSODescriptor(SSODescriptorType $element, ?int $exp |
770 | 776 | // find all ArtifactResolutionService elements |
771 | 777 | $sd['ArtifactResolutionService'] = self::extractEndpoints($element->getArtifactResolutionService()); |
772 | 778 |
|
773 | | - |
774 | 779 | // process NameIDFormat elements |
775 | 780 | $sd['nameIDFormats'] = $element->getNameIDFormat(); |
776 | 781 |
|
@@ -873,11 +878,12 @@ private function processAttributeAuthorityDescriptor( |
873 | 878 | private static function processExtensions(mixed $element, array $parentExtensions = []): array |
874 | 879 | { |
875 | 880 | $ret = [ |
876 | | - 'scope' => [], |
877 | | - 'EntityAttributes' => [], |
878 | | - 'RegistrationInfo' => [], |
879 | | - 'UIInfo' => [], |
880 | | - 'DiscoHints' => [], |
| 881 | + 'scope' => [], |
| 882 | + 'EntityAttributes' => [], |
| 883 | + 'RegistrationInfo' => [], |
| 884 | + 'DiscoveryResponse' => [], |
| 885 | + 'UIInfo' => [], |
| 886 | + 'DiscoHints' => [], |
881 | 887 | ]; |
882 | 888 |
|
883 | 889 | // Some extensions may get inherited from a parent element |
@@ -955,6 +961,13 @@ private static function processExtensions(mixed $element, array $parentExtension |
955 | 961 | } |
956 | 962 | } |
957 | 963 |
|
| 964 | + // DiscoveryResponse elements only make sense at SPSSODescriptor level extensions |
| 965 | + if ($element instanceof SPSSODescriptor) { |
| 966 | + if ($e instanceof DiscoveryResponse) { |
| 967 | + $ret['DiscoveryResponse'] = array_merge($ret['DiscoveryResponse'], self::extractEndpoints([$e])); |
| 968 | + } |
| 969 | + } |
| 970 | + |
958 | 971 | // UIInfo elements are only allowed at RoleDescriptor level extensions |
959 | 972 | if ($element instanceof RoleDescriptor) { |
960 | 973 | if ($e instanceof UIInfo) { |
|
0 commit comments