mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-01-18 17:42:54 +05:30
Merge pull request #448 from juliangut/validate_authenticated_request
V5 - rename validateRequest
This commit is contained in:
commit
4ab9c52767
@ -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
|
||||
|
@ -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');
|
||||
|
@ -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]));
|
||||
|
@ -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;
|
||||
|
@ -35,7 +35,7 @@ interface ResponseTypeInterface
|
||||
*
|
||||
* @return ServerRequestInterface
|
||||
*/
|
||||
public function determineAccessTokenInHeader(ServerRequestInterface $request);
|
||||
public function validateAccessToken(ServerRequestInterface $request);
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user