File tree Expand file tree Collapse file tree 3 files changed +16
-7
lines changed
Expand file tree Collapse file tree 3 files changed +16
-7
lines changed Original file line number Diff line number Diff line change 88 "ext-openssl" : " *" ,
99 "league/event" : " ^3.0" ,
1010 "league/uri" : " ^7.0" ,
11- "lcobucci/jwt" : " ^5.5 " ,
11+ "lcobucci/jwt" : " ^5.0 " ,
1212 "psr/http-message" : " ^2.0" ,
1313 "defuse/php-encryption" : " ^2.4" ,
1414 "ext-json" : " *" ,
Original file line number Diff line number Diff line change @@ -61,6 +61,11 @@ public function setPublicKey(CryptKeyInterface $key): void
6161 */
6262 private function initJwtConfiguration (): void
6363 {
64+ $ this ->jwtConfiguration = Configuration::forSymmetricSigner (
65+ new Sha256 (),
66+ InMemory::plainText ('empty ' , 'empty ' )
67+ );
68+
6469 $ clock = new SystemClock (new DateTimeZone (date_default_timezone_get ()));
6570
6671 $ publicKeyContents = $ this ->publicKey ->getKeyContents ();
@@ -69,16 +74,20 @@ private function initJwtConfiguration(): void
6974 throw new RuntimeException ('Public key is empty ' );
7075 }
7176
72- $ this ->jwtConfiguration = Configuration::forSymmetricSigner (
73- new Sha256 (),
74- InMemory::plainText ('empty ' , 'empty ' )
75- )->withValidationConstraints (
77+ $ validationConstraints = [
7678 new LooseValidAt ($ clock , $ this ->jwtValidAtDateLeeway ),
7779 new SignedWith (
7880 new Sha256 (),
7981 InMemory::plainText ($ publicKeyContents , $ this ->publicKey ->getPassPhrase () ?? '' )
8082 )
81- );
83+ ];
84+
85+ // TODO: next major release: remove this check
86+ if (method_exists ($ this ->jwtConfiguration , 'withValidationConstraints ' ) === true ) {
87+ $ this ->jwtConfiguration = $ this ->jwtConfiguration ->withValidationConstraints (...$ validationConstraints );
88+ } else {
89+ $ this ->jwtConfiguration ->setValidationConstraints (...$ validationConstraints );
90+ }
8291 }
8392
8493 /**
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public function isConfidential(): bool;
4242 /*
4343 * Returns true if the client supports the given grant type.
4444 *
45- * To be added in a future major release.
45+ * TODO: To be added in a future major release.
4646 */
4747 // public function supportsGrantType(string $grantType): bool;
4848}
You can’t perform that action at this time.
0 commit comments