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 | /** |
||
125 | * @return array |
||
126 | */ |
||
127 | public function getQueryParameters(): array |
||
131 | |||
132 | /** |
||
133 | * @return bool |
||
134 | */ |
||
135 | public function isUsed(): bool |
||
139 | |||
140 | /** |
||
141 | * @return AuthorizationCode |
||
142 | */ |
||
143 | public function markAsUsed(): self |
||
155 | |||
156 | /** |
||
157 | * @return AuthorizationCode |
||
158 | */ |
||
159 | public function markAsRevoked(): self |
||
168 | |||
169 | /** |
||
170 | * @return array |
||
171 | */ |
||
172 | public function getQueryParams(): array |
||
176 | |||
177 | /** |
||
178 | * @param string $key |
||
179 | * |
||
180 | * @return mixed |
||
181 | */ |
||
182 | public function getQueryParam(string $key) |
||
190 | |||
191 | /** |
||
192 | * @param string $key |
||
193 | * |
||
194 | * @return bool |
||
195 | */ |
||
196 | public function hasQueryParams(string $key): bool |
||
200 | |||
201 | /** |
||
202 | * @return string |
||
203 | */ |
||
204 | public function getRedirectUri(): string |
||
212 | |||
213 | /** |
||
214 | * @return array |
||
215 | */ |
||
216 | public function toArray(): array |
||
222 | |||
223 | /** |
||
224 | * {@inheritdoc} |
||
225 | */ |
||
226 | public static function createFromJson(\stdClass $json): DomainObject |
||
258 | |||
259 | /** |
||
260 | * {@inheritdoc} |
||
261 | */ |
||
262 | public function jsonSerialize() |
||
273 | |||
274 | /** |
||
275 | * @param Event $event |
||
276 | * |
||
277 | * @return AuthorizationCode |
||
278 | */ |
||
279 | public function apply(Event $event): self |
||
292 | |||
293 | /** |
||
294 | * @return array |
||
295 | */ |
||
296 | private function getEventMap(): array |
||
304 | |||
305 | /** |
||
306 | * @param AuthorizationCodeEvent\AuthorizationCodeCreatedEvent $event |
||
307 | * |
||
308 | * @return AuthorizationCode |
||
309 | */ |
||
310 | protected function applyAuthorizationCodeCreatedEvent(AuthorizationCodeEvent\AuthorizationCodeCreatedEvent $event): self |
||
326 | |||
327 | /** |
||
328 | * @param AuthorizationCodeEvent\AuthorizationCodeMarkedAsUsedEvent $event |
||
329 | * |
||
330 | * @return AuthorizationCode |
||
331 | */ |
||
332 | protected function applyAuthorizationCodeMarkedAsUsedEvent(AuthorizationCodeEvent\AuthorizationCodeMarkedAsUsedEvent $event): self |
||
339 | |||
340 | /** |
||
341 | * @param AuthorizationCodeEvent\AuthorizationCodeRevokedEvent $event |
||
342 | * |
||
343 | * @return AuthorizationCode |
||
344 | */ |
||
345 | protected function applyAuthorizationCodeRevokedEvent(AuthorizationCodeEvent\AuthorizationCodeRevokedEvent $event): self |
||
352 | } |
||
353 |