mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-15 09:47:46 +05:30
If scope parameter is required and there are not requested scopes AND there is no default scope set then fail
Should have been included in with previous commit
This commit is contained in:
parent
ddefb2ee16
commit
351c2e97ea
@ -122,7 +122,7 @@ class ClientCredentials implements GrantTypeInterface {
|
|||||||
if ($scopes[$i] === '') unset($scopes[$i]); // Remove any junk scopes
|
if ($scopes[$i] === '') unset($scopes[$i]); // Remove any junk scopes
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->authServer->scopeParamRequired() === true && count($scopes) === 0) {
|
if ($this->authServer->scopeParamRequired() === true && $this->authServer->getDefaultScope() === null && count($scopes) === 0) {
|
||||||
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'scope'), 0);
|
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'scope'), 0);
|
||||||
} elseif (count($scopes) === 0 && $this->authServer->getDefaultScope()) {
|
} elseif (count($scopes) === 0 && $this->authServer->getDefaultScope()) {
|
||||||
$scopes = array($this->authServer->getDefaultScope());
|
$scopes = array($this->authServer->getDefaultScope());
|
||||||
|
@ -166,7 +166,7 @@ class Password implements GrantTypeInterface {
|
|||||||
if ($scopes[$i] === '') unset($scopes[$i]); // Remove any junk scopes
|
if ($scopes[$i] === '') unset($scopes[$i]); // Remove any junk scopes
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->authServer->scopeParamRequired() === true && count($scopes) === 0) {
|
if ($this->authServer->scopeParamRequired() === true && $this->authServer->getDefaultScope() === null && count($scopes) === 0) {
|
||||||
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'scope'), 0);
|
throw new Exception\ClientException(sprintf($this->authServer->getExceptionMessage('invalid_request'), 'scope'), 0);
|
||||||
} elseif (count($scopes) === 0 && $this->authServer->getDefaultScope()) {
|
} elseif (count($scopes) === 0 && $this->authServer->getDefaultScope()) {
|
||||||
$scopes = array($this->authServer->getDefaultScope());
|
$scopes = array($this->authServer->getDefaultScope());
|
||||||
|
Loading…
Reference in New Issue
Block a user