Conditions | 5 |
Paths | 4 |
Total Lines | 14 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
50 | public function verifyScopes(ClientInterface $client, array $scopes): void |
||
51 | { |
||
52 | if(empty($scopes)) { |
||
53 | throw new OAuthException('invalid_scope', |
||
54 | 'The request scope is unknown.', |
||
55 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
||
56 | } |
||
57 | |||
58 | if ($client instanceof RegisteredClient && is_array($client->getMetadata()->getScope())) { |
||
|
|||
59 | $supportedScopes = explode(' ', $client->getMetadata()->getScope()); |
||
60 | if(!empty(array_diff($scopes, $supportedScopes))) { |
||
61 | throw new OAuthException('invalid_scope', |
||
62 | 'The request scope is invalid. Supported scopes : '.$client->getMetadata()->getScope(), |
||
63 | 'https://tools.ietf.org/html/rfc6749#section-4.1'); |
||
64 | } |
||
68 | } |