Revert fix for client ID exception

This commit is contained in:
Andrew Millington 2018-04-20 18:22:07 +01:00
parent 9fc288ce53
commit c8b44ff5c7
No known key found for this signature in database
GPG Key ID: 815DE090877B53F3
2 changed files with 10 additions and 24 deletions

View File

@ -200,27 +200,6 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
return 'authorization_code'; return 'authorization_code';
} }
/**
* Fetch the client_id parameter from the query string.
*
* @return string|null
* @throws OAuthServerException
*/
protected function getClientIdFromRequest($request)
{
$clientId = $this->getQueryStringParameter(
'client_id',
$request,
$this->getServerParameter('PHP_AUTH_USER', $request)
);
if (is_null($clientId)) {
throw OAuthServerException::invalidRequest('client_id');
}
return $clientId;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -229,7 +208,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
return ( return (
array_key_exists('response_type', $request->getQueryParams()) array_key_exists('response_type', $request->getQueryParams())
&& $request->getQueryParams()['response_type'] === 'code' && $request->getQueryParams()['response_type'] === 'code'
&& $this->getClientIdFromRequest($request) !== null && isset($request->getQueryParams()['client_id'])
); );
} }
@ -238,7 +217,14 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
*/ */
public function validateAuthorizationRequest(ServerRequestInterface $request) public function validateAuthorizationRequest(ServerRequestInterface $request)
{ {
$clientId = $this->getClientIdFromRequest($request); $clientId = $this->getQueryStringParameter(
'client_id',
$request,
$this->getServerParameter('PHP_AUTH_USER', $request)
);
if (is_null($clientId)) {
throw OAuthServerException::invalidRequest('client_id');
}
$client = $this->clientRepository->getClientEntity( $client = $this->clientRepository->getClientEntity(
$clientId, $clientId,

View File

@ -335,7 +335,7 @@ class AuthCodeGrantTest extends TestCase
] ]
); );
$grant->canRespondToAuthorizationRequest($request); $grant->validateAuthorizationRequest($request);
} }
/** /**