From 1f6bb40952e157d63db4a82ab7930a29992b7875 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Guti=C3=A9rrez?= Date: Fri, 12 Feb 2016 18:45:47 +0100 Subject: [PATCH] correcting param access mistake --- src/Grant/AuthCodeGrant.php | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/Grant/AuthCodeGrant.php b/src/Grant/AuthCodeGrant.php index 010bc482..f9e17ea2 100644 --- a/src/Grant/AuthCodeGrant.php +++ b/src/Grant/AuthCodeGrant.php @@ -315,16 +315,12 @@ class AuthCodeGrant extends AbstractGrant ResponseTypeInterface $responseType, \DateInterval $accessTokenTTL ) { - $requestParameters = (array) $request->getParsedBody(); - - if (array_key_exists('response_type', $requestParameters) - && $requestParameters['response_type'] === 'code' - && array_key_exists('client_id', $requestParameters) + if (array_key_exists('response_type', $request->getQueryParams()) + && $request->getQueryParams()['response_type'] === 'code' + && array_key_exists('client_id', $request->getQueryParams()) ) { return $this->respondToAuthorizationRequest($request); - } elseif (array_key_exists('grant_type', $requestParameters) - && $requestParameters['grant_type'] === $this->getIdentifier() - ) { + } elseif (parent::canRespondToRequest($request)) { return $this->respondToAccessTokenRequest($request, $responseType, $accessTokenTTL); } else { throw OAuthServerException::serverError('respondToRequest() should not have been called'); @@ -336,13 +332,11 @@ class AuthCodeGrant extends AbstractGrant */ public function canRespondToRequest(ServerRequestInterface $request) { - $requestParameters = (array) $request->getParsedBody(); - return ( ( - array_key_exists('response_type', $requestParameters) - && $requestParameters['response_type'] === 'code' - && array_key_exists('client_id', $requestParameters) + array_key_exists('response_type', $request->getQueryParams()) + && $request->getQueryParams()['response_type'] === 'code' + && isset($request->getQueryParams()['client_id']) ) || parent::canRespondToRequest($request) );