From de9edc6b330735931c93ac282001d5cae4c48f98 Mon Sep 17 00:00:00 2001 From: Picalausa Francois Date: Sun, 23 Aug 2020 17:32:55 +0900 Subject: [PATCH 1/3] refactor: move away from deprecated interfaces --- src/IdTokenResponse.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/IdTokenResponse.php b/src/IdTokenResponse.php index 1fb4f95..600ddd8 100644 --- a/src/IdTokenResponse.php +++ b/src/IdTokenResponse.php @@ -39,11 +39,11 @@ protected function getBuilder(AccessTokenEntityInterface $accessToken, UserEntit { // Add required id_token claims $builder = (new Builder()) - ->setAudience($accessToken->getClient()->getIdentifier()) - ->setIssuer('https://' . $_SERVER['HTTP_HOST']) - ->setIssuedAt(time()) - ->setExpiration($accessToken->getExpiryDateTime()->getTimestamp()) - ->setSubject($userEntity->getIdentifier()); + ->permittedFor($accessToken->getClient()->getIdentifier()) + ->issuedBy('https://' . $_SERVER['HTTP_HOST']) + ->issuedAt(time()) + ->expiresAt($accessToken->getExpiryDateTime()->getTimestamp()) + ->relatedTo($userEntity->getIdentifier()); return $builder; } @@ -78,8 +78,7 @@ protected function getExtraParams(AccessTokenEntityInterface $accessToken) } $token = $builder - ->sign(new Sha256(), new Key($this->privateKey->getKeyPath(), $this->privateKey->getPassPhrase())) - ->getToken(); + ->getToken(new Sha256(), new Key($this->privateKey->getKeyPath(), $this->privateKey->getPassPhrase())); return [ 'id_token' => (string) $token From 36f168a1844498b7f16669eed4b36caa9db0f38c Mon Sep 17 00:00:00 2001 From: Picalausa Francois Date: Tue, 25 Aug 2020 18:59:35 +0900 Subject: [PATCH 2/3] refactor: update remaining deprecated call to builder --- src/IdTokenResponse.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IdTokenResponse.php b/src/IdTokenResponse.php index 600ddd8..9d0dea9 100644 --- a/src/IdTokenResponse.php +++ b/src/IdTokenResponse.php @@ -74,7 +74,7 @@ protected function getExtraParams(AccessTokenEntityInterface $accessToken) $claims = $this->claimExtractor->extract($accessToken->getScopes(), $userEntity->getClaims()); foreach ($claims as $claimName => $claimValue) { - $builder->set($claimName, $claimValue); + $builder = $builder->withClaim($claimName, $claimValue); } $token = $builder From 830a26d7a9ff0f8c8058c186efc39fdcd5905ae8 Mon Sep 17 00:00:00 2001 From: Picalausa Francois Date: Tue, 25 Aug 2020 19:00:14 +0900 Subject: [PATCH 3/3] fix: add version range requirement on lcobucci/jwt builder methods --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 5a3bb6f..687a575 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ } ], "require": { - "league/oauth2-server": "^5.1|^6.0|^7.0|^8.0" + "league/oauth2-server": "^5.1|^6.0|^7.0|^8.0", + "lcobucci/jwt": "^3.3" }, "require-dev": { "phpunit/phpunit": "^5.0",