mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
If the client should redirect during AuthCodeGrant authorisation then provide a redirect uri
This commit is contained in:
@@ -24,10 +24,10 @@ class OAuthException extends \Exception
|
||||
public $httpStatusCode = 400;
|
||||
|
||||
/**
|
||||
* If true the server should redirect back to the client
|
||||
* @var boolean
|
||||
* Redirect URI if the server should redirect back to the client
|
||||
* @var string|null
|
||||
*/
|
||||
public $serverShouldRedirect = false;
|
||||
public $redirectUri = null;
|
||||
|
||||
/**
|
||||
* The exception type
|
||||
@@ -48,7 +48,22 @@ class OAuthException extends \Exception
|
||||
*/
|
||||
public function shouldRedirect()
|
||||
{
|
||||
return $this->serverShouldRedirect;
|
||||
return is_null($this->redirectUri) ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return redirect URI if set
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRedirectUri()
|
||||
{
|
||||
return \League\OAuth2\Server\Util\RedirectUri::make(
|
||||
$this->redirectUri,
|
||||
[
|
||||
'error' => $this->errorType,
|
||||
'message' => $this->getMessage(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user