1 | <?php |
||
26 | class AuthorizationCode extends Token |
||
27 | { |
||
28 | /** |
||
29 | * @var AuthorizationCodeId |
||
30 | */ |
||
31 | private $authorizationCodeId = null; |
||
32 | |||
33 | /** |
||
34 | * @var array |
||
35 | */ |
||
36 | private $queryParameters = []; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $redirectUri = null; |
||
42 | |||
43 | /** |
||
44 | * @var bool |
||
45 | */ |
||
46 | private $used = false; |
||
47 | |||
48 | /** |
||
49 | * @return AuthorizationCode |
||
50 | */ |
||
51 | public static function createEmpty(): self |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public static function getSchema(): string |
||
63 | |||
64 | /** |
||
65 | * @param AuthorizationCodeId $authorizationCodeId |
||
66 | * @param ClientId $clientId |
||
67 | * @param UserAccountId $userAccountId |
||
68 | * @param array $queryParameters |
||
69 | * @param string $redirectUri |
||
70 | * @param \DateTimeImmutable $expiresAt |
||
71 | * @param DataBag $parameters |
||
72 | * @param DataBag $metadatas |
||
73 | * @param ResourceServerId $resourceServerId |
||
74 | * |
||
75 | * @return AuthorizationCode |
||
76 | */ |
||
77 | public function create(AuthorizationCodeId $authorizationCodeId, ClientId $clientId, UserAccountId $userAccountId, array $queryParameters, string $redirectUri, \DateTimeImmutable $expiresAt, DataBag $parameters, DataBag $metadatas, ? ResourceServerId $resourceServerId) |
||
97 | |||
98 | /** |
||
99 | * {@inheritdoc} |
||
100 | */ |
||
101 | public function getTokenId(): TokenId |
||
109 | |||
110 | /** |
||
111 | * @return AuthorizationCodeId |
||
112 | */ |
||
113 | public function getAuthorizationCodeId(): AuthorizationCodeId |
||
122 | |||
123 | /** |
||
124 | * @return array |
||
125 | */ |
||
126 | public function getQueryParameters(): array |
||
130 | |||
131 | /** |
||
132 | * @return bool |
||
133 | */ |
||
134 | public function isUsed(): bool |
||
138 | |||
139 | /** |
||
140 | * @return AuthorizationCode |
||
141 | */ |
||
142 | public function markAsUsed(): self |
||
154 | |||
155 | /** |
||
156 | * @return AuthorizationCode |
||
157 | */ |
||
158 | public function markAsRevoked(): self |
||
167 | |||
168 | /** |
||
169 | * @return array |
||
170 | */ |
||
171 | public function getQueryParams(): array |
||
175 | |||
176 | /** |
||
177 | * @param string $key |
||
178 | * |
||
179 | * @return mixed |
||
180 | */ |
||
181 | public function getQueryParam(string $key) |
||
189 | |||
190 | /** |
||
191 | * @param string $key |
||
192 | * |
||
193 | * @return bool |
||
194 | */ |
||
195 | public function hasQueryParam(string $key): bool |
||
196 | { |
||
197 | return array_key_exists($key, $this->getQueryParams()); |
||
198 | } |
||
199 | |||
200 | /** |
||
201 | * @return string |
||
202 | */ |
||
203 | public function getRedirectUri(): string |
||
211 | |||
212 | /** |
||
213 | * @return array |
||
214 | */ |
||
215 | public function toArray(): array |
||
221 | |||
222 | /** |
||
223 | * {@inheritdoc} |
||
224 | */ |
||
225 | public static function createFromJson(\stdClass $json): DomainObject |
||
257 | |||
258 | /** |
||
259 | * {@inheritdoc} |
||
260 | */ |
||
261 | public function jsonSerialize() |
||
272 | |||
273 | /** |
||
274 | * @param Event $event |
||
275 | * |
||
276 | * @return AuthorizationCode |
||
277 | */ |
||
278 | public function apply(Event $event): self |
||
291 | |||
292 | /** |
||
293 | * @return array |
||
294 | */ |
||
295 | private function getEventMap(): array |
||
303 | |||
304 | /** |
||
305 | * @param AuthorizationCodeEvent\AuthorizationCodeCreatedEvent $event |
||
306 | * |
||
307 | * @return AuthorizationCode |
||
308 | */ |
||
309 | protected function applyAuthorizationCodeCreatedEvent(AuthorizationCodeEvent\AuthorizationCodeCreatedEvent $event): self |
||
325 | |||
326 | /** |
||
327 | * @param AuthorizationCodeEvent\AuthorizationCodeMarkedAsUsedEvent $event |
||
328 | * |
||
329 | * @return AuthorizationCode |
||
330 | */ |
||
331 | protected function applyAuthorizationCodeMarkedAsUsedEvent(AuthorizationCodeEvent\AuthorizationCodeMarkedAsUsedEvent $event): self |
||
338 | |||
339 | /** |
||
340 | * @param AuthorizationCodeEvent\AuthorizationCodeRevokedEvent $event |
||
341 | * |
||
342 | * @return AuthorizationCode |
||
343 | */ |
||
344 | protected function applyAuthorizationCodeRevokedEvent(AuthorizationCodeEvent\AuthorizationCodeRevokedEvent $event): self |
||
351 | } |
||
352 |