1 | <?php |
||
26 | final class TokenEndpointScopeExtension implements TokenEndpointExtension |
||
27 | { |
||
28 | /** |
||
29 | * @var ScopeRepository |
||
30 | */ |
||
31 | private $scopeRepository; |
||
32 | |||
33 | /** |
||
34 | * @var ScopePolicyManager |
||
35 | */ |
||
36 | private $scopePolicyManager; |
||
37 | |||
38 | /** |
||
39 | * ScopeProcessor constructor. |
||
40 | * |
||
41 | * @param ScopeRepository $scopeRepository |
||
42 | * @param ScopePolicyManager $scopePolicyManager |
||
43 | */ |
||
44 | public function __construct(ScopeRepository $scopeRepository, ScopePolicyManager $scopePolicyManager) |
||
49 | |||
50 | /** |
||
51 | * {@inheritdoc} |
||
52 | */ |
||
53 | public function beforeAccessTokenIssuance(ServerRequestInterface $request, GrantTypeData $grantTypeData, GrantType $grantType, callable $next): GrantTypeData |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function afterAccessTokenIssuance(Client $client, ResourceOwner $resourceOwner, AccessToken $accessToken, callable $next): array |
||
75 | |||
76 | /** |
||
77 | * @param ServerRequestInterface $request |
||
78 | * @param GrantTypeData $grantTypeData |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | private function getScope(ServerRequestInterface $request, GrantTypeData $grantTypeData): string |
||
91 | |||
92 | /** |
||
93 | * @param string $scope |
||
94 | * @param Client $client |
||
95 | * |
||
96 | * @return string |
||
97 | * |
||
98 | * @throws OAuth2Exception |
||
99 | */ |
||
100 | private function applyScopePolicy(string $scope, Client $client): string |
||
108 | |||
109 | /** |
||
110 | * @param string $scope |
||
111 | * @param GrantTypeData $grantTypeData |
||
112 | * |
||
113 | * @throws OAuth2Exception |
||
114 | */ |
||
115 | private function checkRequestedScopeIsAvailable(string $scope, GrantTypeData $grantTypeData) |
||
129 | |||
130 | /** |
||
131 | * @param Client $client |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | private function getAvailableScopesForClient(Client $client): string |
||
139 | } |
||
140 |
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: