1 | <?php |
||
14 | class EntityDescriptorHelper |
||
15 | { |
||
16 | const ENDPOINT_SERVICE_ARTIFACT_RESOLUTION = 'ArtifactResolution'; |
||
17 | const ENDPOINT_SERVICE_SINGLE_LOGOUT = 'SingleLogout'; |
||
18 | const ENDPOINT_SERVICE_MANAGE_NAME_ID = 'ManageNameID'; |
||
19 | |||
20 | const ENDPOINT_SERVICE_ASSERTION_CONSUMER = 'AssertionConsumer'; |
||
21 | const ENDPOINT_SERVICE_ATTRIBUTE_CONSUMING = 'AttributeConsuming'; |
||
22 | |||
23 | const ENDPOINT_SERVICE_SINGLE_SIGN_ON = 'SingleSignOn'; |
||
24 | const ENDPOINT_SERVICE_ASSERTION_ID_REQUEST = 'AssertionIDRequest'; |
||
25 | const ENDPOINT_SERVICE_NAME_ID_MAPPING = 'NameIDMapping'; |
||
26 | |||
27 | const ENDPOINT_SERVICE_OPTIONS = [ |
||
28 | // Common |
||
29 | self::ENDPOINT_SERVICE_ARTIFACT_RESOLUTION, |
||
30 | self::ENDPOINT_SERVICE_SINGLE_LOGOUT, |
||
31 | self::ENDPOINT_SERVICE_MANAGE_NAME_ID, |
||
32 | |||
33 | // SP |
||
34 | self::ENDPOINT_SERVICE_ASSERTION_CONSUMER, |
||
35 | self::ENDPOINT_SERVICE_ATTRIBUTE_CONSUMING, |
||
36 | |||
37 | // IDP |
||
38 | self::ENDPOINT_SERVICE_SINGLE_SIGN_ON, |
||
39 | self::ENDPOINT_SERVICE_ASSERTION_ID_REQUEST, |
||
40 | self::ENDPOINT_SERVICE_NAME_ID_MAPPING, |
||
41 | ]; |
||
42 | |||
43 | /** |
||
44 | * @param EntityDescriptor $entityDescriptor |
||
45 | * @return IDPSSODescriptor[] |
||
46 | */ |
||
47 | public static function getIdpDescriptors(EntityDescriptor $entityDescriptor) |
||
51 | |||
52 | /** |
||
53 | * @param EntityDescriptor $entityDescriptor |
||
54 | * @return SPSSODescriptor[] |
||
55 | */ |
||
56 | public static function getSpDescriptors(EntityDescriptor $entityDescriptor) |
||
60 | |||
61 | /** |
||
62 | * @param EntityDescriptor $entityDescriptor |
||
63 | * @param string $type |
||
64 | * @return SSODescriptorType[] |
||
65 | */ |
||
66 | protected static function getDescriptors(EntityDescriptor $entityDescriptor, string $type) |
||
77 | |||
78 | /** |
||
79 | * Common |
||
80 | */ |
||
81 | |||
82 | /** |
||
83 | * @param SSODescriptorType[] $roleDescriptors |
||
84 | * @param string $binding |
||
85 | * @return EndpointType|null |
||
86 | */ |
||
87 | public static function getFirstArtifactResolutionService(array $roleDescriptors, string $binding = null) |
||
91 | |||
92 | /** |
||
93 | * @param SSODescriptorType[] $roleDescriptors |
||
94 | * @param string $binding |
||
95 | * @return EndpointType|null |
||
96 | */ |
||
97 | public static function getFirstSLOService(array $roleDescriptors, string $binding = null) |
||
101 | |||
102 | /** |
||
103 | * @param SSODescriptorType[] $roleDescriptors |
||
104 | * @param string $binding |
||
105 | * @return EndpointType|null |
||
106 | */ |
||
107 | public static function getFirstManageNameIDService(array $roleDescriptors, string $binding = null) |
||
111 | |||
112 | /** |
||
113 | * Get First SP Services |
||
114 | */ |
||
115 | |||
116 | /** |
||
117 | * @param SPSSODescriptor[] $roleDescriptors |
||
118 | * @param string $binding |
||
119 | * @return EndpointType|null |
||
120 | */ |
||
121 | public static function getFirstSpAssertionConsumerService(array $roleDescriptors, string $binding = null) |
||
125 | |||
126 | /** |
||
127 | * @param SPSSODescriptor[] $roleDescriptors |
||
128 | * @param string $binding |
||
129 | * @return EndpointType|null |
||
130 | */ |
||
131 | public static function getFirstSpAttributeConsumingService(array $roleDescriptors, string $binding = null) |
||
135 | |||
136 | /** |
||
137 | * Get First IDP Services |
||
138 | */ |
||
139 | |||
140 | /** |
||
141 | * @param IDPSSODescriptor[] $roleDescriptors |
||
142 | * @param string $binding |
||
143 | * @return EndpointType|null |
||
144 | */ |
||
145 | public static function getFirstIdpSSOService(array $roleDescriptors, string $binding = null) |
||
149 | |||
150 | /** |
||
151 | * @param IDPSSODescriptor[] $roleDescriptors |
||
152 | * @param string $binding |
||
153 | * @return EndpointType|null |
||
154 | */ |
||
155 | public static function getFirstIdpAssertionIdRequestService(array $roleDescriptors, string $binding = null) |
||
159 | |||
160 | /** |
||
161 | * @param IDPSSODescriptor[] $roleDescriptors |
||
162 | * @param string $binding |
||
163 | * @return EndpointType|null |
||
164 | */ |
||
165 | public static function getFirstIdpNameIDMappingService(array $roleDescriptors, string $binding = null) |
||
169 | |||
170 | /** |
||
171 | * @param SSODescriptorType[] $roleDescriptors |
||
172 | * @param string $binding |
||
173 | * @param string $service |
||
174 | * @return EndpointType|null |
||
175 | */ |
||
176 | protected static function getFirstService(string $service, array $roleDescriptors, string $binding = null) |
||
211 | |||
212 | /** |
||
213 | * @param IndexedEndpointType[] $endpointTypes |
||
214 | * @param $binding |
||
215 | * @return EndpointType|null |
||
216 | */ |
||
217 | protected static function getFirstIndexedEndpointType(array $endpointTypes, string $binding = null) |
||
248 | } |
||
249 |