Skip to content

Commit 289fb49

Browse files
authored
Merge pull request #1236 from derrabus/bugfix/allow-jwt-4.1
Allow lcobucci/jwt 4.1
2 parents 97dbc97 + eae0272 commit 289fb49

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"php": "^7.2 || ^8.0",
88
"ext-openssl": "*",
99
"league/event": "^2.2",
10-
"lcobucci/jwt": "^3.4 || ~4.0.0",
10+
"lcobucci/jwt": "^3.4 || ^4.0",
1111
"psr/http-message": "^1.0.1",
1212
"defuse/php-encryption": "^2.2.1",
1313
"ext-json": "*"

src/AuthorizationValidators/BearerTokenValidator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Lcobucci\JWT\Signer\Key\LocalFileReference;
1717
use Lcobucci\JWT\Signer\Rsa\Sha256;
1818
use Lcobucci\JWT\Validation\Constraint\SignedWith;
19+
use Lcobucci\JWT\Validation\Constraint\StrictValidAt;
1920
use Lcobucci\JWT\Validation\Constraint\ValidAt;
2021
use Lcobucci\JWT\Validation\RequiredConstraintsViolated;
2122
use League\OAuth2\Server\CryptKey;
@@ -74,7 +75,9 @@ private function initJwtConfiguration()
7475
);
7576

7677
$this->jwtConfiguration->setValidationConstraints(
77-
new ValidAt(new SystemClock(new DateTimeZone(\date_default_timezone_get()))),
78+
\class_exists(StrictValidAt::class)
79+
? new StrictValidAt(new SystemClock(new DateTimeZone(\date_default_timezone_get())))
80+
: new ValidAt(new SystemClock(new DateTimeZone(\date_default_timezone_get()))),
7881
new SignedWith(new Sha256(), LocalFileReference::file($this->publicKey->getKeyPath()))
7982
);
8083
}

0 commit comments

Comments
 (0)