mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-01-05 19:43:56 +05:30
Merge branch 'v5-fix' of https://github.com/assembledadam/oauth2-server into assembledadam-v5-fix
This commit is contained in:
commit
d7dd07cf18
@ -3,6 +3,7 @@
|
|||||||
namespace League\OAuth2\Server\AuthorizationValidators;
|
namespace League\OAuth2\Server\AuthorizationValidators;
|
||||||
|
|
||||||
use Lcobucci\JWT\Parser;
|
use Lcobucci\JWT\Parser;
|
||||||
|
use Lcobucci\JWT\ValidationData;
|
||||||
use Lcobucci\JWT\Signer\Rsa\Sha256;
|
use Lcobucci\JWT\Signer\Rsa\Sha256;
|
||||||
use League\OAuth2\Server\CryptTrait;
|
use League\OAuth2\Server\CryptTrait;
|
||||||
use League\OAuth2\Server\Exception\OAuthServerException;
|
use League\OAuth2\Server\Exception\OAuthServerException;
|
||||||
@ -47,6 +48,14 @@ class BearerTokenValidator implements AuthorizationValidatorInterface
|
|||||||
throw OAuthServerException::accessDenied('Access token could not be verified');
|
throw OAuthServerException::accessDenied('Access token could not be verified');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// validate
|
||||||
|
$data = new ValidationData();
|
||||||
|
$data->setCurrentTime(time());
|
||||||
|
|
||||||
|
if ($token->validate($data) === false) {
|
||||||
|
throw OAuthServerException::accessDenied('Access token is invalid');
|
||||||
|
}
|
||||||
|
|
||||||
// Check if token has been revoked
|
// Check if token has been revoked
|
||||||
if ($this->accessTokenRepository->isAccessTokenRevoked($token->getClaim('jti'))) {
|
if ($this->accessTokenRepository->isAccessTokenRevoked($token->getClaim('jti'))) {
|
||||||
throw OAuthServerException::accessDenied('Access token has been revoked');
|
throw OAuthServerException::accessDenied('Access token has been revoked');
|
||||||
|
Loading…
Reference in New Issue
Block a user