mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
PHPCS fixes
This commit is contained in:
@ -174,7 +174,7 @@ class AuthorizationServer extends AbstractServer
|
|||||||
|
|
||||||
$this->grantTypes[$identifier] = $grantType;
|
$this->grantTypes[$identifier] = $grantType;
|
||||||
|
|
||||||
if ( ! is_null($grantType->getResponseType())) {
|
if (!is_null($grantType->getResponseType())) {
|
||||||
$this->responseTypes[] = $grantType->getResponseType();
|
$this->responseTypes[] = $grantType->getResponseType();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -316,7 +316,7 @@ class AuthorizationServer extends AbstractServer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure grant type is one that is recognised and is enabled
|
// Ensure grant type is one that is recognised and is enabled
|
||||||
if ( ! in_array($grantType, array_keys($this->grantTypes))) {
|
if (!in_array($grantType, array_keys($this->grantTypes))) {
|
||||||
throw new Exception\UnsupportedGrantTypeException($grantType);
|
throw new Exception\UnsupportedGrantTypeException($grantType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,6 +32,12 @@ class InvalidGrantException extends OAuthException
|
|||||||
|
|
||||||
public function __construct($parameter)
|
public function __construct($parameter)
|
||||||
{
|
{
|
||||||
parent::__construct(sprintf('The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. Check the "%s" parameter.', $parameter));
|
parent::__construct(
|
||||||
|
sprintf(
|
||||||
|
'The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used
|
||||||
|
in the authorization request, or was issued to another client. Check the "%s" parameter.',
|
||||||
|
$parameter
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,12 @@ class InvalidRequestException extends OAuthException
|
|||||||
|
|
||||||
public function __construct($parameter)
|
public function __construct($parameter)
|
||||||
{
|
{
|
||||||
parent::__construct(sprintf('The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "%s" parameter.', $parameter));
|
parent::__construct(
|
||||||
|
sprintf(
|
||||||
|
'The request is missing a required parameter, includes an invalid parameter value, includes a parameter
|
||||||
|
more than once, or is otherwise malformed. Check the "%s" parameter.',
|
||||||
|
$parameter
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,11 @@ class InvalidScopeException extends OAuthException
|
|||||||
|
|
||||||
public function __construct($parameter)
|
public function __construct($parameter)
|
||||||
{
|
{
|
||||||
parent::__construct(sprintf('The requested scope is invalid, unknown, or malformed. Check the "%s" scope.', $parameter));
|
parent::__construct(
|
||||||
|
sprintf(
|
||||||
|
'The requested scope is invalid, unknown, or malformed. Check the "%s" scope.',
|
||||||
|
$parameter
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,10 @@ class ServerErrorException extends OAuthException
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function __construct($parameter = 'The authorization server encountered an unexpected condition which prevented it from fulfilling the request.')
|
public function __construct(
|
||||||
{
|
$parameter = 'The authorization server encountered an unexpected condition which prevented it from fulfilling'
|
||||||
|
. 'the request.'
|
||||||
|
) {
|
||||||
parent::__construct($parameter);
|
parent::__construct($parameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,11 @@ class UnsupportedGrantTypeException extends OAuthException
|
|||||||
|
|
||||||
public function __construct($parameter)
|
public function __construct($parameter)
|
||||||
{
|
{
|
||||||
parent::__construct(sprintf('The authorization grant type "%s" is not supported by the authorization server.', $parameter));
|
parent::__construct(
|
||||||
|
sprintf(
|
||||||
|
'The authorization grant type "%s" is not supported by the authorization server.',
|
||||||
|
$parameter
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,13 +116,15 @@ abstract class AbstractGrant implements GrantTypeInterface
|
|||||||
|
|
||||||
for ($i = 0; $i < count($scopesList); $i++) {
|
for ($i = 0; $i < count($scopesList); $i++) {
|
||||||
$scopesList[$i] = trim($scopesList[$i]);
|
$scopesList[$i] = trim($scopesList[$i]);
|
||||||
if ($scopesList[$i] === '') unset($scopesList[$i]); // Remove any junk scopes
|
if ($scopesList[$i] === '') {
|
||||||
|
unset($scopesList[$i]); // Remove any junk scopes
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
$this->server->scopeParamRequired() === true &&
|
$this->server->scopeParamRequired() === true
|
||||||
$this->server->getDefaultScope() === null &&
|
&& $this->server->getDefaultScope() === null
|
||||||
count($scopesList) === 0
|
&& count($scopesList) === 0
|
||||||
) {
|
) {
|
||||||
throw new Exception\InvalidRequestException('scope');
|
throw new Exception\InvalidRequestException('scope');
|
||||||
} elseif (count($scopesList) === 0 && $this->server->getDefaultScope() !== null) {
|
} elseif (count($scopesList) === 0 && $this->server->getDefaultScope() !== null) {
|
||||||
@ -185,5 +187,4 @@ abstract class AbstractGrant implements GrantTypeInterface
|
|||||||
* @return array An array of parameters to be passed back to the client
|
* @return array An array of parameters to be passed back to the client
|
||||||
*/
|
*/
|
||||||
abstract public function completeFlow();
|
abstract public function completeFlow();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -164,5 +164,4 @@ class PasswordGrant extends AbstractGrant
|
|||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,9 @@ class ResourceServer extends AbstractServer
|
|||||||
*/
|
*/
|
||||||
public function isValidRequest($headersOnly = true, $accessToken = null)
|
public function isValidRequest($headersOnly = true, $accessToken = null)
|
||||||
{
|
{
|
||||||
$accessTokenString = ($accessToken !== null) ? $accessToken : $this->determineAccessToken($headersOnly, $accessToken);
|
$accessTokenString = ($accessToken !== null)
|
||||||
|
? $accessToken
|
||||||
|
: $this->determineAccessToken($headersOnly, $accessToken);
|
||||||
|
|
||||||
// Set the access token
|
// Set the access token
|
||||||
$this->accessToken = $this->storages['access_token']->get($accessTokenString);
|
$this->accessToken = $this->storages['access_token']->get($accessTokenString);
|
||||||
|
@ -23,7 +23,7 @@ interface ClientInterface
|
|||||||
* @param string $clientId The client's ID
|
* @param string $clientId The client's ID
|
||||||
* @param string $clientSecret The client's secret (default = "null")
|
* @param string $clientSecret The client's secret (default = "null")
|
||||||
* @param string $redirectUri The client's redirect URI (default = "null")
|
* @param string $redirectUri The client's redirect URI (default = "null")
|
||||||
* @param string $grantType The grant type used in the request (default = "null")
|
* @param string $grantType The grant type used (default = "null")
|
||||||
* @return League\OAuth2\Server\Entity\ClientEntity
|
* @return League\OAuth2\Server\Entity\ClientEntity
|
||||||
*/
|
*/
|
||||||
public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null);
|
public function get($clientId, $clientSecret = null, $redirectUri = null, $grantType = null);
|
||||||
|
Reference in New Issue
Block a user