mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-17 10:39:45 +05:30
getScopes() now have the grant type and client ID passed
This commit is contained in:
parent
a7b4f7d66b
commit
a18b4184f5
@ -115,7 +115,7 @@ class ClientCredentials implements GrantTypeInterface {
|
|||||||
$authParams['scopes'] = array();
|
$authParams['scopes'] = array();
|
||||||
|
|
||||||
foreach ($scopes as $scope) {
|
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) {
|
if ($scopeDetails === false) {
|
||||||
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_scope'), $scope), 4);
|
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_scope'), $scope), 4);
|
||||||
|
@ -158,7 +158,7 @@ class Password implements GrantTypeInterface {
|
|||||||
$authParams['scopes'] = array();
|
$authParams['scopes'] = array();
|
||||||
|
|
||||||
foreach ($scopes as $scope) {
|
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) {
|
if ($scopeDetails === false) {
|
||||||
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_scope'), $scope), 4);
|
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_scope'), $scope), 4);
|
||||||
|
@ -35,7 +35,8 @@ interface ScopeInterface
|
|||||||
* </code>
|
* </code>
|
||||||
*
|
*
|
||||||
* @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
|
* @return bool|array If the scope doesn't exist return false
|
||||||
*/
|
*/
|
||||||
public function getScope($scope);
|
public function getScope($scope, $clientId = null, $grantType = null);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user