This commit is contained in:
Alex Bilbie
2016-04-10 10:07:08 +01:00
parent 44937f3600
commit b7064befe4
6 changed files with 378 additions and 203 deletions

View File

@@ -124,6 +124,28 @@ class Server implements EmitterAwareInterface
$this->grantTypeAccessTokenTTL[$grantType->getIdentifier()] = $accessTokenTTL;
}
/**
* @param \Psr\Http\Message\ServerRequestInterface $request
*
* @throws \League\OAuth2\Server\Exception\OAuthServerException
*/
public function respondToAuthorizationRequest(ServerRequestInterface $request)
{
$authRequest = null;
while ($authRequest === null && $grantType = array_shift($this->enabledGrantTypes)) {
/** @var \League\OAuth2\Server\Grant\GrantTypeInterface $grantType */
if ($grantType->canRespondToAccessTokenRequest($request)) {
$authRequest = $grantType->respondToRequest(
$request,
$this->getResponseType(),
$this->grantTypeAccessTokenTTL[$grantType->getIdentifier()]
);
}
}
throw OAuthServerException::unsupportedGrantType();
}
/**
* Return an access token response.
*