mirror of
https://github.com/elyby/oauth2-server.git
synced 2026-04-18 03:40:50 +05:30
Fix #169
This commit is contained in:
@@ -30,7 +30,7 @@ class InvalidRequestException extends OAuthException
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
public function __construct($parameter)
|
||||
public function __construct($parameter, $shouldRedirect = false)
|
||||
{
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
@@ -38,5 +38,7 @@ class InvalidRequestException extends OAuthException
|
||||
$parameter
|
||||
)
|
||||
);
|
||||
|
||||
$this->serverShouldRedirect = $shouldRedirect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class InvalidScopeException extends OAuthException
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
||||
public function __construct($parameter)
|
||||
public function __construct($parameter, $shouldRedirect = false)
|
||||
{
|
||||
parent::__construct(
|
||||
sprintf(
|
||||
@@ -38,5 +38,7 @@ class InvalidScopeException extends OAuthException
|
||||
$parameter
|
||||
)
|
||||
);
|
||||
|
||||
$this->serverShouldRedirect = $shouldRedirect;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ class OAuthException extends \Exception
|
||||
*/
|
||||
public $httpStatusCode = 400;
|
||||
|
||||
/**
|
||||
* If true the server should redirect back to the client
|
||||
* @var boolean
|
||||
*/
|
||||
public $serverShouldRedirect = false;
|
||||
|
||||
/**
|
||||
* The exception type
|
||||
*/
|
||||
@@ -36,6 +42,15 @@ class OAuthException extends \Exception
|
||||
parent::__construct($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the server redirect back to the client?
|
||||
* @return bool
|
||||
*/
|
||||
public function shouldRedirect()
|
||||
{
|
||||
return $this->serverShouldRedirect;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all headers that have to be send with the error response
|
||||
* @return array Array with header values
|
||||
|
||||
@@ -32,5 +32,6 @@ class UnsupportedResponseTypeException extends OAuthException
|
||||
public function __construct($parameter)
|
||||
{
|
||||
parent::__construct('The authorization server does not support obtaining an access token using this method.');
|
||||
$this->serverShouldRedirect = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user