mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
Remove getScopes function and use validateScopes instead
This commit is contained in:
@@ -86,7 +86,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
|
||||
$this->validateAuthorizationCode($authCodePayload, $client, $request);
|
||||
|
||||
$scopes = $this->scopeRepository->finalizeScopes(
|
||||
$this->getScopes($authCodePayload),
|
||||
$this->validateScopes($authCodePayload->scopes),
|
||||
$this->getIdentifier(),
|
||||
$client,
|
||||
$authCodePayload->user_id
|
||||
@@ -194,32 +194,6 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get scopes from the auth code payload.
|
||||
*
|
||||
* @param \stdClass $authCodePayload
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getScopes($authCodePayload)
|
||||
{
|
||||
$scopes = [];
|
||||
|
||||
foreach ($authCodePayload->scopes as $scopeId) {
|
||||
$scope = $this->scopeRepository->getScopeEntityByIdentifier($scopeId);
|
||||
|
||||
if ($scope instanceof ScopeEntityInterface === false) {
|
||||
// @codeCoverageIgnoreStart
|
||||
throw OAuthServerException::invalidScope($scopeId);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
$scopes[] = $scope;
|
||||
}
|
||||
|
||||
return $scopes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the grant identifier that can be used in matching up requests.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user