Merge pull request #892 from Sephster/fix-issue-837

Revert fix for client ID exception
This commit is contained in:
Andrew Millington 2018-04-21 17:49:42 +01:00 committed by GitHub
commit 7e07033b10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 28 deletions

View File

@ -201,12 +201,21 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
}
/**
* Fetch the client_id parameter from the query string.
*
* @return string|null
* @throws OAuthServerException
* {@inheritdoc}
*/
protected function getClientIdFromRequest($request)
public function canRespondToAuthorizationRequest(ServerRequestInterface $request)
{
return (
array_key_exists('response_type', $request->getQueryParams())
&& $request->getQueryParams()['response_type'] === 'code'
&& isset($request->getQueryParams()['client_id'])
);
}
/**
* {@inheritdoc}
*/
public function validateAuthorizationRequest(ServerRequestInterface $request)
{
$clientId = $this->getQueryStringParameter(
'client_id',
@ -218,28 +227,6 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
throw OAuthServerException::invalidRequest('client_id');
}
return $clientId;
}
/**
* {@inheritdoc}
*/
public function canRespondToAuthorizationRequest(ServerRequestInterface $request)
{
return (
array_key_exists('response_type', $request->getQueryParams())
&& $request->getQueryParams()['response_type'] === 'code'
&& $this->getClientIdFromRequest($request) !== null
);
}
/**
* {@inheritdoc}
*/
public function validateAuthorizationRequest(ServerRequestInterface $request)
{
$clientId = $this->getClientIdFromRequest($request);
$client = $this->clientRepository->getClientEntity(
$clientId,
$this->getIdentifier(),
@ -253,6 +240,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
}
$redirectUri = $this->getQueryStringParameter('redirect_uri', $request);
if ($redirectUri !== null) {
if (
is_string($client->getRedirectUri())
@ -298,6 +286,7 @@ class AuthCodeGrant extends AbstractAuthorizeGrant
}
$codeChallengeMethod = $this->getQueryStringParameter('code_challenge_method', $request, 'plain');
if (in_array($codeChallengeMethod, ['plain', 'S256'], true) === false) {
throw OAuthServerException::invalidRequest(
'code_challenge_method',

View File

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