mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-11-08 21:52:24 +05:30
Revert fix for client ID exception
This commit is contained in:
parent
9fc288ce53
commit
c8b44ff5c7
@ -200,27 +200,6 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
|
||||
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}
|
||||
*/
|
||||
@ -229,7 +208,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
|
||||
return (
|
||||
array_key_exists('response_type', $request->getQueryParams())
|
||||
&& $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)
|
||||
{
|
||||
$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(
|
||||
$clientId,
|
||||
|
@ -335,7 +335,7 @@ class AuthCodeGrantTest extends TestCase
|
||||
]
|
||||
);
|
||||
|
||||
$grant->canRespondToAuthorizationRequest($request);
|
||||
$grant->validateAuthorizationRequest($request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user