diff --git a/src/OAuth2/Grant/ClientCredentials.php b/src/OAuth2/Grant/ClientCredentials.php index 88ac8d1a..2909132e 100644 --- a/src/OAuth2/Grant/ClientCredentials.php +++ b/src/OAuth2/Grant/ClientCredentials.php @@ -115,7 +115,7 @@ class ClientCredentials implements GrantTypeInterface { $authParams['scopes'] = array(); foreach ($scopes as $scope) { - $scopeDetails = $this->authServer->getStorage('scope')->getScope($scope); + $scopeDetails = $this->authServer->getStorage('scope')->getScope($scope, $authParams['client_id'], $this->identifier); if ($scopeDetails === false) { throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_scope'), $scope), 4); diff --git a/src/OAuth2/Grant/Password.php b/src/OAuth2/Grant/Password.php index 8ea78101..e82c03b7 100644 --- a/src/OAuth2/Grant/Password.php +++ b/src/OAuth2/Grant/Password.php @@ -158,7 +158,7 @@ class Password implements GrantTypeInterface { $authParams['scopes'] = array(); foreach ($scopes as $scope) { - $scopeDetails = $this->authServer->getStorage('scope')->getScope($scope); + $scopeDetails = $this->authServer->getStorage('scope')->getScope($scope, $authParams['client_id'], $this->identifier); if ($scopeDetails === false) { throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_scope'), $scope), 4); diff --git a/src/OAuth2/Storage/ScopeInterface.php b/src/OAuth2/Storage/ScopeInterface.php index 99c6689a..f254facc 100644 --- a/src/OAuth2/Storage/ScopeInterface.php +++ b/src/OAuth2/Storage/ScopeInterface.php @@ -34,8 +34,9 @@ interface ScopeInterface * ) * * - * @param string $scope The scope + * @param string $scope The scope + * @param string $clientId The client ID * @return bool|array If the scope doesn't exist return false */ - public function getScope($scope); + public function getScope($scope, $clientId = null, $grantType = null); }