Skip to content

Commit 871c337

Browse files
fix deprecation
formatting formatting formatting fix backward compatibility bump lcobucci/jwt
1 parent c67aa70 commit 871c337

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/AuthorizationValidators/BearerTokenValidator.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,20 @@ private function initJwtConfiguration(): void
7474
throw new RuntimeException('Public key is empty');
7575
}
7676

77-
$this->jwtConfiguration->setValidationConstraints(
77+
$validationConstraints = [
7878
new LooseValidAt($clock, $this->jwtValidAtDateLeeway),
7979
new SignedWith(
8080
new Sha256(),
8181
InMemory::plainText($publicKeyContents, $this->publicKey->getPassPhrase() ?? '')
82-
)
83-
);
82+
),
83+
];
84+
85+
// TODO: next major release: bump lcobucci/jwt to ^5.5 and remove the following check
86+
if (method_exists($this->jwtConfiguration, 'withValidationConstraints') === true) {
87+
$this->jwtConfiguration = $this->jwtConfiguration->withValidationConstraints(...$validationConstraints);
88+
} else {
89+
$this->jwtConfiguration->setValidationConstraints(...$validationConstraints);
90+
}
8491
}
8592

8693
/**

src/Entities/ClientEntityInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)