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:
Alex Bilbie 2013-05-09 10:06:26 -07:00
parent ddefb2ee16
commit 351c2e97ea
2 changed files with 2 additions and 2 deletions

View File

@ -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());

View File

@ -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());