rename determineAccessTokenInHeader

This commit is contained in:
Julián Gutiérrez 2016-02-13 14:38:23 +01:00
parent 186853390a
commit dbcaaa1f35
6 changed files with 8 additions and 8 deletions

View File

@ -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) {

View File

@ -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');

View File

@ -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]));

View File

@ -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;

View File

@ -36,7 +36,7 @@ interface ResponseTypeInterface
*
* @return ServerRequestInterface
*/
public function determineAccessTokenInHeader(ServerRequestInterface $request);
public function validateAccessToken(ServerRequestInterface $request);
/**
* @param ResponseInterface $response

View File

@ -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);
}
/**