Remove getScopes function and use validateScopes instead

This commit is contained in:
sephster
2018-10-13 16:11:44 +01:00
parent 50ab9dd8ac
commit 322b55eddf
2 changed files with 19 additions and 31 deletions

View File

@@ -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.
*