1 | <?php |
||
28 | class Metadata extends Component |
||
29 | { |
||
30 | |||
31 | const SET_SIGNING = Key::USAGE_SIGNING; |
||
32 | const SET_ENCRYPTION = Key::USAGE_ENCRYPTION; |
||
33 | const PROTOCOL = Constants::NS_SAMLP; |
||
34 | |||
35 | const EVENT_AFTER_MESSAGE_CREATED = 'eventAfterMessageCreated'; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | protected $supportedBindings = [ |
||
41 | Constants::BINDING_HTTP_POST, |
||
42 | ]; |
||
43 | |||
44 | /** |
||
45 | * @return array |
||
46 | */ |
||
47 | public function getSupportedBindings() |
||
48 | { |
||
49 | return $this->supportedBindings; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return bool |
||
54 | */ |
||
55 | protected function supportsRedirect() |
||
56 | { |
||
57 | return in_array(Constants::BINDING_HTTP_REDIRECT, $this->getSupportedBindings()); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return bool |
||
62 | */ |
||
63 | protected function supportsPost() |
||
64 | { |
||
65 | return in_array(Constants::BINDING_HTTP_POST, $this->getSupportedBindings()); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param SettingsInterface $settings |
||
70 | * @param KeyChainRecord|null $withKeyPair |
||
71 | * @return EntityDescriptor |
||
72 | * @throws InvalidConfigException |
||
73 | */ |
||
74 | public function create( |
||
75 | SettingsInterface $settings, |
||
76 | KeyChainRecord $withKeyPair = null |
||
77 | ): EntityDescriptor { |
||
78 | |||
79 | $entityDescriptor = new EntityDescriptor(); |
||
80 | |||
81 | $entityId = $settings->getEntityId(); |
||
82 | |||
83 | $entityDescriptor->setEntityID($entityId); |
||
84 | |||
85 | foreach ($this->getSupportedBindings() as $binding) { |
||
86 | $entityDescriptor->addRoleDescriptor( |
||
87 | $descriptor = $this->createDescriptor($binding, $settings) |
||
88 | ); |
||
89 | |||
90 | /** |
||
91 | * Add security settings |
||
92 | */ |
||
93 | if ($withKeyPair) { |
||
94 | $this->setEncrypt($descriptor, $withKeyPair); |
||
95 | $this->setSign($descriptor, $withKeyPair); |
||
96 | } |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * Kick off event here so people can manipulate this object if needed |
||
101 | */ |
||
102 | $event = new Event(); |
||
103 | |||
104 | /** |
||
105 | * response |
||
106 | */ |
||
107 | $event->data = $entityDescriptor; |
||
108 | $this->trigger(static::EVENT_AFTER_MESSAGE_CREATED, $event); |
||
109 | |||
110 | return $entityDescriptor; |
||
111 | } |
||
112 | |||
113 | /** |
||
114 | * @param string $binding |
||
115 | * @return IdpSsoDescriptor|SpSsoDescriptor |
||
116 | * @throws InvalidConfigException |
||
117 | */ |
||
118 | protected function createDescriptor(string $binding, SettingsInterface $settings) |
||
135 | |||
136 | /** |
||
137 | * @param string $binding |
||
138 | * @return IDPSSODescriptor |
||
139 | */ |
||
140 | protected function createIdpDescriptor(string $binding, SettingsInterface $settings) |
||
178 | |||
179 | /** |
||
180 | * @param string $binding |
||
181 | * @return SPSSODescriptor |
||
182 | */ |
||
183 | protected function createSpDescriptor(string $binding, SettingsInterface $settings) |
||
226 | |||
227 | protected function addSloEndpoint(SSODescriptorType $descriptorType, SettingsInterface $settings) |
||
250 | |||
251 | /** |
||
252 | * @param SSODescriptorType $ssoDescriptor |
||
253 | * @param KeyChainRecord $keyChainRecord |
||
254 | */ |
||
255 | protected function setCertificate( |
||
290 | |||
291 | /** |
||
292 | * @param SSODescriptorType |
||
293 | * @param KeyChainRecord $keyChainRecord |
||
294 | */ |
||
295 | protected function setSign(SSODescriptorType $ssoDescriptor, KeyChainRecord $keyChainRecord) |
||
299 | |||
300 | /** |
||
301 | * @param SSODescriptorType |
||
302 | * @param KeyChainRecord $keyChainRecord |
||
303 | */ |
||
304 | protected function setEncrypt(SSODescriptorType $ssoDescriptor, KeyChainRecord $keyChainRecord) |
||
308 | } |
||
309 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: