mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
Fixing line lengths
This commit is contained in:
parent
e8be38cbfc
commit
d01720bcc2
@ -20,17 +20,22 @@ class Server
|
|||||||
);
|
);
|
||||||
|
|
||||||
protected $errors = array(
|
protected $errors = array(
|
||||||
'invalid_request' => 'The request is missing a required parameter, includes an invalid parameter value,
|
'invalid_request' => 'The request is missing a required parameter,
|
||||||
includes a parameter more than once, or is otherwise malformed.',
|
includes an invalid parameter value, includes a parameter more than
|
||||||
'unauthorized_client' => 'The client is not authorized to request an access token using this method.',
|
once, or is otherwise malformed.',
|
||||||
'access_denied' => 'The resource owner or authorization server denied the request.',
|
'unauthorized_client' => 'The client is not authorized to request an
|
||||||
'unsupported_response_type' => 'The authorization server does not support obtaining an access token using this
|
access token using this method.',
|
||||||
method.',
|
'access_denied' => 'The resource owner or authorization server denied
|
||||||
'invalid_scope' => 'The requested scope is invalid, unknown, or malformed.',
|
the request.',
|
||||||
'server_error' => 'The authorization server encountered an unexpected condition which prevented it from
|
'unsupported_response_type' => 'The authorization server does not
|
||||||
fulfilling the request.',
|
support obtaining an access token using this method.',
|
||||||
'temporarily_unavailable' => 'The authorization server is currently unable to handle the request due to a
|
'invalid_scope' => 'The requested scope is invalid, unknown, or
|
||||||
temporary overloading or maintenance of the server.'
|
malformed.',
|
||||||
|
'server_error' => 'The authorization server encountered an unexpected
|
||||||
|
condition which prevented it from fulfilling the request.',
|
||||||
|
'temporarily_unavailable' => 'The authorization server is currently
|
||||||
|
unable to handle the request due to a temporary overloading or
|
||||||
|
maintenance of the server.'
|
||||||
);
|
);
|
||||||
|
|
||||||
public function __construct(array $options)
|
public function __construct(array $options)
|
||||||
@ -50,7 +55,8 @@ class Server
|
|||||||
// Client ID
|
// Client ID
|
||||||
if ( ! isset($authParams['client_id']) && ! isset($_GET['client_id'])) {
|
if ( ! isset($authParams['client_id']) && ! isset($_GET['client_id'])) {
|
||||||
|
|
||||||
throw new OAuthServerClientException('invalid_request: ' . $this->errors['invalid_request']);
|
throw new OAuthServerClientException('invalid_request: ' .
|
||||||
|
$this->errors['invalid_request']);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -60,9 +66,11 @@ class Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Redirect URI
|
// Redirect URI
|
||||||
if ( ! isset($authParams['redirect_uri']) && ! isset($_GET['redirect_uri'])) {
|
if ( ! isset($authParams['redirect_uri']) &&
|
||||||
|
! isset($_GET['redirect_uri'])) {
|
||||||
|
|
||||||
throw new OAuthServerClientException('invalid_request: ' . $this->errors['invalid_request']);
|
throw new OAuthServerClientException('invalid_request: ' .
|
||||||
|
$this->errors['invalid_request']);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -72,17 +80,21 @@ class Server
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate client ID and redirect URI
|
// Validate client ID and redirect URI
|
||||||
$clientDetails = $this->db->validateClient($params['client_id'], null, $params['redirect_uri']);
|
$clientDetails = $this->db->validateClient($params['client_id'], null,
|
||||||
|
$params['redirect_uri']);
|
||||||
|
|
||||||
if ($clientDetails === false) {
|
if ($clientDetails === false) {
|
||||||
|
|
||||||
throw new OAuthServerClientException('unauthorized_client: ' . $this->errors['unauthorized_client']);
|
throw new OAuthServerClientException('unauthorized_client: ' .
|
||||||
|
$this->errors['unauthorized_client']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Response type
|
// Response type
|
||||||
if ( ! isset($authParams['response_type']) && ! isset($_GET['response_type'])) {
|
if ( ! isset($authParams['response_type']) &&
|
||||||
|
! isset($_GET['response_type'])) {
|
||||||
|
|
||||||
throw new OAuthServerClientException('invalid_request: ' . $this->errors['invalid_request']);
|
throw new OAuthServerClientException('invalid_request: ' .
|
||||||
|
$this->errors['invalid_request']);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -90,10 +102,11 @@ class Server
|
|||||||
$authParams['response_type'] : $_GET['response_type'];
|
$authParams['response_type'] : $_GET['response_type'];
|
||||||
|
|
||||||
// Ensure response type is one that is recognised
|
// Ensure response type is one that is recognised
|
||||||
if ( ! in_array($params['response_type'], $this->config['response_types'])) {
|
if ( ! in_array($params['response_type'],
|
||||||
|
$this->config['response_types'])) {
|
||||||
|
|
||||||
throw new OAuthServerClientException('unsupported_response_type: ' .
|
throw new OAuthServerClientException('unsupported_response_type:
|
||||||
$this->errors['unsupported_response_type']);
|
' . $this->errors['unsupported_response_type']);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +114,10 @@ class Server
|
|||||||
// Get and validate scopes
|
// Get and validate scopes
|
||||||
if (isset($authParams['scope']) || isset($_GET['scope'])) {
|
if (isset($authParams['scope']) || isset($_GET['scope'])) {
|
||||||
|
|
||||||
$scopes = (isset($authParams['client_id'])) ?$authParams['scope'] : $_GET['scope'];
|
$scopes = $_GET['scope'];
|
||||||
|
if (isset($authParams['client_id'])) {
|
||||||
|
$authParams['scope'];
|
||||||
|
}
|
||||||
|
|
||||||
$scopes = explode($this->config['scope_delimeter'], $scopes);
|
$scopes = explode($this->config['scope_delimeter'], $scopes);
|
||||||
|
|
||||||
@ -115,7 +131,8 @@ class Server
|
|||||||
|
|
||||||
if (count($scopes) === 0) {
|
if (count($scopes) === 0) {
|
||||||
|
|
||||||
throw new OAuthServerClientException('invalid_request: ' . $this->errors['invalid_request']);
|
throw new OAuthServerClientException('invalid_request: ' .
|
||||||
|
$this->errors['invalid_request']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$params['scopes'] = array();
|
$params['scopes'] = array();
|
||||||
@ -126,7 +143,8 @@ class Server
|
|||||||
|
|
||||||
if ($scopeDetails === false) {
|
if ($scopeDetails === false) {
|
||||||
|
|
||||||
throw new OAuthServerClientException('invalid_scope: ' . $this->errors['invalid_scope']);
|
throw new OAuthServerClientException('invalid_scope: ' .
|
||||||
|
$this->errors['invalid_scope']);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user