Skip to content

Commit

Permalink
Merge pull request #43 from steverhoades/fix-dependebot-vulnerability
Browse files Browse the repository at this point in the history
Remove support for Lcobucci\JWT < 4.1 due to vulnerability.
  • Loading branch information
steverhoades authored Oct 28, 2021
2 parents bfe62d1 + 4e24336 commit 5f8f024
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"require": {
"league/oauth2-server": "^5.1|^6.0|^7.0|^8.0",
"lcobucci/jwt": "^3.4.3|^4.1"
"lcobucci/jwt": "4.1.5"
},
"require-dev": {
"phpunit/phpunit": "^5.0|^9.5",
Expand Down
11 changes: 5 additions & 6 deletions src/IdTokenResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use League\OAuth2\Server\Entities\ScopeEntityInterface;
use League\OAuth2\Server\ResponseTypes\BearerTokenResponse;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use Lcobucci\JWT\Encoding\ChainedFormatter;
use Lcobucci\JWT\Token\Builder;
use Lcobucci\JWT\Encoding\JoseEncoder;

class IdTokenResponse extends BearerTokenResponse
{
Expand All @@ -37,12 +40,8 @@ public function __construct(

protected function getBuilder(AccessTokenEntityInterface $accessToken, UserEntityInterface $userEntity)
{
if (class_exists("Lcobucci\JWT\Token\Builder")) {
$claimsFormatter = \Lcobucci\JWT\Encoding\ChainedFormatter::withUnixTimestampDates();
$builder = new \Lcobucci\JWT\Token\Builder(new \Lcobucci\JWT\Encoding\JoseEncoder(), $claimsFormatter);
} else {
$builder = new \Lcobucci\JWT\Builder();
}
$claimsFormatter = ChainedFormatter::withUnixTimestampDates();
$builder = new Builder(new JoseEncoder(), $claimsFormatter);

// Since version 8.0 league/oauth2-server returns \DateTimeImmutable
$expiresAt = $accessToken->getExpiryDateTime();
Expand Down

0 comments on commit 5f8f024

Please sign in to comment.