If the client should redirect during AuthCodeGrant authorisation then provide a redirect uri

This commit is contained in:
Alex Bilbie
2014-11-08 17:03:15 +00:00
parent b9debaab26
commit 6b29b7450e
6 changed files with 34 additions and 18 deletions

View File

@@ -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(),
]
);
}
/**