From dbcaaa1f359899d8bab48847130cd184002a3153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juli=C3=A1n=20Guti=C3=A9rrez?= Date: Sat, 13 Feb 2016 14:38:23 +0100 Subject: [PATCH] rename determineAccessTokenInHeader --- src/Middleware/ResourceServerMiddleware.php | 2 +- src/ResponseTypes/AbstractResponseType.php | 2 +- src/ResponseTypes/BearerTokenResponse.php | 4 ++-- src/ResponseTypes/MAC.php | 2 +- src/ResponseTypes/ResponseTypeInterface.php | 2 +- src/Server.php | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Middleware/ResourceServerMiddleware.php b/src/Middleware/ResourceServerMiddleware.php index 0f0b20ae..3b92537b 100644 --- a/src/Middleware/ResourceServerMiddleware.php +++ b/src/Middleware/ResourceServerMiddleware.php @@ -35,7 +35,7 @@ class ResourceServerMiddleware public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) { try { - $request = $this->server->validateRequest($request); + $request = $this->server->validateAuthenticatedRequest($request); } catch (OAuthServerException $exception) { return $exception->generateHttpResponse($response); } catch (\Exception $exception) { diff --git a/src/ResponseTypes/AbstractResponseType.php b/src/ResponseTypes/AbstractResponseType.php index 9605a463..58916664 100644 --- a/src/ResponseTypes/AbstractResponseType.php +++ b/src/ResponseTypes/AbstractResponseType.php @@ -78,7 +78,7 @@ abstract class AbstractResponseType implements ResponseTypeInterface /** * {@inheritdoc} */ - public function determineAccessTokenInHeader(ServerRequestInterface $request) + public function validateAccessToken(ServerRequestInterface $request) { if ($request->hasHeader('authorization') === false) { throw OAuthServerException::accessDenied('Missing "Authorization" header'); diff --git a/src/ResponseTypes/BearerTokenResponse.php b/src/ResponseTypes/BearerTokenResponse.php index d1b88218..1ab2a5d6 100644 --- a/src/ResponseTypes/BearerTokenResponse.php +++ b/src/ResponseTypes/BearerTokenResponse.php @@ -79,9 +79,9 @@ class BearerTokenResponse extends AbstractResponseType /** * {@inheritdoc} */ - public function determineAccessTokenInHeader(ServerRequestInterface $request) + public function validateAccessToken(ServerRequestInterface $request) { - $request = parent::determineAccessTokenInHeader($request); + $request = parent::validateAccessToken($request); $header = $request->getHeader('authorization'); $jwt = trim(preg_replace('/^(?:\s+)?Bearer\s/', '', $header[0])); diff --git a/src/ResponseTypes/MAC.php b/src/ResponseTypes/MAC.php index 48c2274f..ee6aa62e 100644 --- a/src/ResponseTypes/MAC.php +++ b/src/ResponseTypes/MAC.php @@ -42,7 +42,7 @@ class MAC extends AbstractTokenType implements TokenTypeInterface /** * {@inheritdoc} */ - public function determineAccessTokenInHeader(Request $request) + public function validateAccessToken(Request $request) { if ($request->headers->has('Authorization') === false) { return; diff --git a/src/ResponseTypes/ResponseTypeInterface.php b/src/ResponseTypes/ResponseTypeInterface.php index 6524f049..1a7155cc 100644 --- a/src/ResponseTypes/ResponseTypeInterface.php +++ b/src/ResponseTypes/ResponseTypeInterface.php @@ -36,7 +36,7 @@ interface ResponseTypeInterface * * @return ServerRequestInterface */ - public function determineAccessTokenInHeader(ServerRequestInterface $request); + public function validateAccessToken(ServerRequestInterface $request); /** * @param ResponseInterface $response diff --git a/src/Server.php b/src/Server.php index 4e7799d3..45f9213f 100644 --- a/src/Server.php +++ b/src/Server.php @@ -157,9 +157,9 @@ class Server implements EmitterAwareInterface * * @throws \League\OAuth2\Server\Exception\OAuthServerException */ - public function validateRequest(ServerRequestInterface $request) + public function validateAuthenticatedRequest(ServerRequestInterface $request) { - return $this->getResponseType()->determineAccessTokenInHeader($request); + return $this->getResponseType()->validateAccessToken($request); } /**