mirror of
https://github.com/elyby/oauth2-server.git
synced 2025-05-31 14:12:07 +05:30
Merge pull request #904 from dzibma/master
Fix uncaught exception produced by unsigned token
This commit is contained in:
@@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Catch and handle `BadMethodCallException` from the `verify()` method of the JWT token in the `validateAuthorization` method (PR #904)
|
||||||
|
|
||||||
## [7.1.1] - released 2018-05-21
|
## [7.1.1] - released 2018-05-21
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -65,8 +65,12 @@ class BearerTokenValidator implements AuthorizationValidatorInterface
|
|||||||
try {
|
try {
|
||||||
// Attempt to parse and validate the JWT
|
// Attempt to parse and validate the JWT
|
||||||
$token = (new Parser())->parse($jwt);
|
$token = (new Parser())->parse($jwt);
|
||||||
if ($token->verify(new Sha256(), $this->publicKey->getKeyPath()) === false) {
|
try {
|
||||||
throw OAuthServerException::accessDenied('Access token could not be verified');
|
if ($token->verify(new Sha256(), $this->publicKey->getKeyPath()) === false) {
|
||||||
|
throw OAuthServerException::accessDenied('Access token could not be verified');
|
||||||
|
}
|
||||||
|
} catch (\BadMethodCallException $exception) {
|
||||||
|
throw OAuthServerException::accessDenied('Access token is not signed');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure access token hasn't expired
|
// Ensure access token hasn't expired
|
||||||
|
|||||||
Reference in New Issue
Block a user