-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,11 @@ public function setPublicKey(CryptKeyInterface $key): void | |
*/ | ||
private function initJwtConfiguration(): void | ||
{ | ||
$this->jwtConfiguration = Configuration::forSymmetricSigner( | ||
new Sha256(), | ||
InMemory::plainText('empty', 'empty') | ||
); | ||
|
||
$clock = new SystemClock(new DateTimeZone(date_default_timezone_get())); | ||
|
||
$publicKeyContents = $this->publicKey->getKeyContents(); | ||
|
@@ -69,16 +74,20 @@ private function initJwtConfiguration(): void | |
throw new RuntimeException('Public key is empty'); | ||
} | ||
|
||
$this->jwtConfiguration = Configuration::forSymmetricSigner( | ||
new Sha256(), | ||
InMemory::plainText('empty', 'empty') | ||
)->withValidationConstraints( | ||
$validationConstraints = [ | ||
new LooseValidAt($clock, $this->jwtValidAtDateLeeway), | ||
new SignedWith( | ||
new Sha256(), | ||
InMemory::plainText($publicKeyContents, $this->publicKey->getPassPhrase() ?? '') | ||
) | ||
); | ||
]; | ||
|
||
// TODO: next major release: remove this check | ||
if (method_exists($this->jwtConfiguration, 'withValidationConstraints') === true) { | ||
Check failure on line 86 in src/AuthorizationValidators/BearerTokenValidator.php
|
||
$this->jwtConfiguration = $this->jwtConfiguration->withValidationConstraints(...$validationConstraints); | ||
} else { | ||
$this->jwtConfiguration->setValidationConstraints(...$validationConstraints); | ||
Check failure on line 89 in src/AuthorizationValidators/BearerTokenValidator.php
|
||
} | ||
} | ||
|
||
/** | ||
|