Merge pull request #818 from imanghafoori1/master

flatten code
This commit is contained in:
Andrew Millington 2017-11-23 22:42:26 +00:00 committed by GitHub
commit a53e753b1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -178,7 +178,9 @@ class AuthorizationServer implements EmitterAwareInterface
public function respondToAccessTokenRequest(ServerRequestInterface $request, ResponseInterface $response) public function respondToAccessTokenRequest(ServerRequestInterface $request, ResponseInterface $response)
{ {
foreach ($this->enabledGrantTypes as $grantType) { foreach ($this->enabledGrantTypes as $grantType) {
if ($grantType->canRespondToAccessTokenRequest($request)) { if (!$grantType->canRespondToAccessTokenRequest($request)) {
continue;
}
$tokenResponse = $grantType->respondToAccessTokenRequest( $tokenResponse = $grantType->respondToAccessTokenRequest(
$request, $request,
$this->getResponseType(), $this->getResponseType(),
@ -188,7 +190,7 @@ class AuthorizationServer implements EmitterAwareInterface
if ($tokenResponse instanceof ResponseTypeInterface) { if ($tokenResponse instanceof ResponseTypeInterface) {
return $tokenResponse->generateHttpResponse($response); return $tokenResponse->generateHttpResponse($response);
} }
}
} }
throw OAuthServerException::unsupportedGrantType(); throw OAuthServerException::unsupportedGrantType();