Merge pull request #448 from juliangut/validate_authenticated_request

V5 - rename validateRequest
This commit is contained in:
Alex Bilbie 2016-03-10 17:47:28 +00:00
commit 4ab9c52767
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);
// @codeCoverageIgnoreStart

View File

@ -77,7 +77,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

@ -67,9 +67,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

@ -41,7 +41,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

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

View File

@ -158,9 +158,9 @@ class Server implements EmitterAwareInterface
*
* @return \Psr\Http\Message\ServerRequestInterface
*/
public function validateRequest(ServerRequestInterface $request)
public function validateAuthenticatedRequest(ServerRequestInterface $request)
{
return $this->getResponseType()->determineAccessTokenInHeader($request);
return $this->getResponseType()->validateAccessToken($request);
}
/**