Skip to content

Commit

Permalink
Update dependency of lcobucci/jwt lib on Apple Provider (#592)
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctrineDark authored Dec 3, 2020
1 parent 1d4a2e2 commit b03a927
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Support\Str;
use Laravel\Socialite\Two\InvalidStateException;
use Lcobucci\JWT\Parser;
use Lcobucci\JWT\Signer\Key;
use Lcobucci\JWT\Signer\Rsa\Sha256;
use SocialiteProviders\Manager\OAuth2\AbstractProvider;
use SocialiteProviders\Manager\OAuth2\User;
Expand Down Expand Up @@ -132,7 +133,7 @@ public static function verify($jwt)
if ($token->getClaim('iss') !== self::URL) {
throw new InvalidStateException('Invalid Issuer', Response::HTTP_UNAUTHORIZED);
}
if ($token->isExpired()) {
if ($token->isExpired(new \DateTime())) {
throw new InvalidStateException('Token Expired', Response::HTTP_UNAUTHORIZED);
}

Expand All @@ -149,7 +150,7 @@ public static function verify($jwt)
if (isset($publicKeys[$kid])) {
$publicKey = openssl_pkey_get_details($publicKeys[$kid]);

if ($token->verify($signer, $publicKey['key'])) {
if ($token->verify($signer, new Key($publicKey['key']))) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"ext-json": "*",
"ext-openssl": "*",
"firebase/php-jwt": "^5.2",
"lcobucci/jwt": "^3.3",
"lcobucci/jwt": "^3.4",

This comment has been minimized.

Copy link
@lahivee

lahivee Jan 5, 2021

Version 3.4 does not seem to support PHP8 which causes errors on installing (at least with me). The JWT package requires at least version 4.0 from what I see here: https://packagist.org/packages/lcobucci/jwt#4.0.0 . Do you guys don't get an error on ´composer install´ or update? @m1guelpf @atymic @DoctrineDark

This comment has been minimized.

Copy link
@Iamscaredofcode

Iamscaredofcode Jan 5, 2021

I experience this error too but wonder why the others have not come accross this?? I am sure they have tested the install successfully so I am confused a bit. @atymic @DoctrineDark could you please confirm that it works for you?

This comment has been minimized.

Copy link
@m1guelpf

m1guelpf Jan 5, 2021

Member

I'm still waiting for some of my dependencies to upgrade to PHP 8 (I run composer with --ignore-platform-req=php), so I didn't come across this. @atymic Can we support both versions?

This comment has been minimized.

Copy link
@lahivee

lahivee Jan 5, 2021

@m1guelpf @atymic I think this is the one that's the missing piece: SocialiteProviders/Providers#606 ; that's for the ignore flat, good to know; but I shy away from using it in production since it affects all packages

This comment has been minimized.

Copy link
@atymic

atymic Jan 5, 2021

Member

Merged, sorry for the delay.

This comment has been minimized.

Copy link
@lahivee

lahivee Jan 6, 2021

thank you!

"socialiteproviders/manager": "~4.0"
},
"autoload": {
Expand Down

0 comments on commit b03a927

Please sign in to comment.