mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-02 19:51:03 +05:30
rename determineAccessTokenInHeader
This commit is contained in:
parent
186853390a
commit
dbcaaa1f35
@ -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) {
|
||||
|
@ -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');
|
||||
|
@ -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]));
|
||||
|
@ -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;
|
||||
|
@ -36,7 +36,7 @@ interface ResponseTypeInterface
|
||||
*
|
||||
* @return ServerRequestInterface
|
||||
*/
|
||||
public function determineAccessTokenInHeader(ServerRequestInterface $request);
|
||||
public function validateAccessToken(ServerRequestInterface $request);
|
||||
|
||||
/**
|
||||
* @param ResponseInterface $response
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user