1 | <?php |
||
15 | class EntityDescriptorHelper |
||
16 | { |
||
17 | const ENDPOINT_SERVICE_ARTIFACT_RESOLUTION = 'ArtifactResolution'; |
||
18 | const ENDPOINT_SERVICE_SINGLE_LOGOUT = 'SingleLogout'; |
||
19 | const ENDPOINT_SERVICE_MANAGE_NAME_ID = 'ManageNameID'; |
||
20 | |||
21 | const ENDPOINT_SERVICE_ASSERTION_CONSUMER = 'AssertionConsumer'; |
||
22 | const ENDPOINT_SERVICE_ATTRIBUTE_CONSUMING = 'AttributeConsuming'; |
||
23 | |||
24 | const ENDPOINT_SERVICE_SINGLE_SIGN_ON = 'SingleSignOn'; |
||
25 | const ENDPOINT_SERVICE_ASSERTION_ID_REQUEST = 'AssertionIDRequest'; |
||
26 | const ENDPOINT_SERVICE_NAME_ID_MAPPING = 'NameIDMapping'; |
||
27 | |||
28 | const ENDPOINT_SERVICE_OPTIONS = [ |
||
29 | // Common |
||
30 | self::ENDPOINT_SERVICE_ARTIFACT_RESOLUTION, |
||
31 | self::ENDPOINT_SERVICE_SINGLE_LOGOUT, |
||
32 | self::ENDPOINT_SERVICE_MANAGE_NAME_ID, |
||
33 | |||
34 | // SP |
||
35 | self::ENDPOINT_SERVICE_ASSERTION_CONSUMER, |
||
36 | self::ENDPOINT_SERVICE_ATTRIBUTE_CONSUMING, |
||
37 | |||
38 | // IDP |
||
39 | self::ENDPOINT_SERVICE_SINGLE_SIGN_ON, |
||
40 | self::ENDPOINT_SERVICE_ASSERTION_ID_REQUEST, |
||
41 | self::ENDPOINT_SERVICE_NAME_ID_MAPPING, |
||
42 | ]; |
||
43 | |||
44 | /** |
||
45 | * @param EntityDescriptor $entityDescriptor |
||
46 | * @return IDPSSODescriptor[] |
||
47 | */ |
||
48 | public static function getIdpDescriptors(EntityDescriptor $entityDescriptor) |
||
52 | |||
53 | /** |
||
54 | * @param EntityDescriptor $entityDescriptor |
||
55 | * @return SPSSODescriptor[] |
||
56 | */ |
||
57 | public static function getSpDescriptors(EntityDescriptor $entityDescriptor) |
||
61 | |||
62 | /** |
||
63 | * @param EntityDescriptor $entityDescriptor |
||
64 | * @param string $type |
||
65 | * @return SSODescriptorType[] |
||
66 | */ |
||
67 | protected static function getDescriptors(EntityDescriptor $entityDescriptor, string $type) |
||
79 | |||
80 | /** |
||
81 | * Common |
||
82 | */ |
||
83 | |||
84 | /** |
||
85 | * @param SSODescriptorType[] $roleDescriptors |
||
86 | * @param string $binding |
||
87 | * @return EndpointType|null |
||
88 | */ |
||
89 | public static function getFirstArtifactResolutionService(array $roleDescriptors, string $binding = null) |
||
93 | |||
94 | /** |
||
95 | * @param SSODescriptorType[] $roleDescriptors |
||
96 | * @param string $binding |
||
97 | * @return EndpointType|null |
||
98 | */ |
||
99 | public static function getFirstSLOService(array $roleDescriptors, string $binding = null) |
||
103 | |||
104 | /** |
||
105 | * @param SSODescriptorType[] $roleDescriptors |
||
106 | * @param string $binding |
||
107 | * @return EndpointType|null |
||
108 | */ |
||
109 | public static function getFirstManageNameIDService(array $roleDescriptors, string $binding = null) |
||
113 | |||
114 | /** |
||
115 | * Get First SP Services |
||
116 | */ |
||
117 | |||
118 | /** |
||
119 | * @param SPSSODescriptor[] $roleDescriptors |
||
120 | * @param string $binding |
||
121 | * @return EndpointType|null |
||
122 | */ |
||
123 | public static function getFirstSpAssertionConsumerService(array $roleDescriptors, string $binding = null) |
||
127 | |||
128 | /** |
||
129 | * @param SPSSODescriptor[] $roleDescriptors |
||
130 | * @param string $binding |
||
131 | * @return EndpointType|null |
||
132 | */ |
||
133 | public static function getFirstSpAttributeConsumingService(array $roleDescriptors, string $binding = null) |
||
137 | |||
138 | /** |
||
139 | * Get First IDP Services |
||
140 | */ |
||
141 | |||
142 | /** |
||
143 | * @param IDPSSODescriptor[] $roleDescriptors |
||
144 | * @param string $binding |
||
145 | * @return EndpointType|null |
||
146 | */ |
||
147 | public static function getFirstIdpSSOService(array $roleDescriptors, string $binding = null) |
||
151 | |||
152 | /** |
||
153 | * @param IDPSSODescriptor[] $roleDescriptors |
||
154 | * @param string $binding |
||
155 | * @return EndpointType|null |
||
156 | */ |
||
157 | public static function getFirstIdpAssertionIdRequestService(array $roleDescriptors, string $binding = null) |
||
161 | |||
162 | /** |
||
163 | * @param IDPSSODescriptor[] $roleDescriptors |
||
164 | * @param string $binding |
||
165 | * @return EndpointType|null |
||
166 | */ |
||
167 | public static function getFirstIdpNameIDMappingService(array $roleDescriptors, string $binding = null) |
||
171 | |||
172 | /** |
||
173 | * @param SSODescriptorType[] $roleDescriptors |
||
174 | * @param string $binding |
||
175 | * @param string $service |
||
176 | * @return EndpointType|null |
||
177 | */ |
||
178 | protected static function getFirstService(string $service, array $roleDescriptors, string $binding = null) |
||
215 | |||
216 | /** |
||
217 | * @param IndexedEndpointType[] $endpointTypes |
||
218 | * @param $binding |
||
219 | * @return EndpointType|null |
||
220 | */ |
||
221 | protected static function getFirstIndexedEndpointType(array $endpointTypes, string $binding = null) |
||
252 | } |