Doc improvements

This commit is contained in:
Alex Bilbie 2016-02-22 07:58:12 +00:00
parent d02437dd73
commit e08669d50c

View File

@ -208,14 +208,16 @@ class AuthCodeGrant extends AbstractGrant
); );
} }
$stateParameter = $this->getQueryStringParameter('state', $request); // The user has either approved or denied the client, so redirect them back
$redirectUri = new Uri($client->getRedirectUri()); $redirectUri = new Uri($client->getRedirectUri());
parse_str($redirectUri->getQuery(), $redirectPayload); parse_str($redirectUri->getQuery(), $redirectPayload);
$stateParameter = $this->getQueryStringParameter('state', $request);
if ($stateParameter !== null) { if ($stateParameter !== null) {
$redirectPayload['state'] = $stateParameter; $redirectPayload['state'] = $stateParameter;
} }
// THe user approved the client, redirect them back with an auth code
if ($userHasApprovedClient === true) { if ($userHasApprovedClient === true) {
$authCode = $this->issueAuthCode( $authCode = $this->issueAuthCode(
$this->authCodeTTL, $this->authCodeTTL,
@ -242,6 +244,7 @@ class AuthCodeGrant extends AbstractGrant
return new Response\RedirectResponse($redirectUri->withQuery(http_build_query($redirectPayload))); return new Response\RedirectResponse($redirectUri->withQuery(http_build_query($redirectPayload)));
} }
// The user denied the client, redirect them back with an error
$exception = OAuthServerException::accessDenied('The user denied the request', (string) $redirectUri); $exception = OAuthServerException::accessDenied('The user denied the request', (string) $redirectUri);
return $exception->generateHttpResponse(); return $exception->generateHttpResponse();