Total Complexity | 7 |
Total Lines | 50 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
16 | class AuthorizationCodeFlow implements FlowInterface |
||
17 | { |
||
18 | /** |
||
19 | * @var AuthorizationCodeStorageInterface |
||
20 | */ |
||
21 | protected $authorizationCodeStorage; |
||
22 | |||
23 | public function __construct(AuthorizationCodeStorageInterface $authorizationCodeStorage) |
||
24 | { |
||
25 | $this->authorizationCodeStorage = $authorizationCodeStorage; |
||
26 | } |
||
27 | |||
28 | function getResponseTypes(): array |
||
|
|||
29 | { |
||
30 | return ['code']; |
||
31 | } |
||
32 | |||
33 | function handleAuthorizationRequest(AuthorizationEndpoint $authorizationEndpoint, array $requestData): array |
||
34 | { |
||
35 | $authorizationCode = $this->authorizationCodeStorage->create( |
||
36 | implode(' ', $authorizationEndpoint->getScopes()), |
||
37 | $authorizationEndpoint->getClient()->getIdentifier(), |
||
38 | $authorizationEndpoint->getResourceOwner()->getIdentifier(), |
||
39 | $requestData['scope'] ?? null, |
||
40 | $requestData['redirect_uri'] ?? null |
||
41 | ); |
||
42 | $this->authorizationCodeStorage->save($authorizationCode); |
||
43 | return ['code' => $authorizationCode->getCode()]; |
||
44 | } |
||
45 | |||
46 | function getDefaultResponseMode(): string |
||
47 | { |
||
48 | return 'query'; |
||
49 | } |
||
50 | |||
51 | function getUnsupportedResponseModes(): array |
||
54 | } |
||
55 | |||
56 | function getGrantTypes(): array |
||
60 | } |
||
61 | |||
62 | function handleAccessTokenRequest(TokenEndpoint $tokenEndpoint, array $requestData): array |
||
63 | { |
||
64 | // TODO |
||
66 | } |
||
67 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.