diff --git a/composer.json b/composer.json index d7b2f0f83..450845b4b 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "require": { "php": "^8.0", "ext-json": "*", - "firebase/php-jwt": "^6.3.1", + "firebase/php-jwt": "^6.4", "illuminate/auth": "^9.0|^10.0", "illuminate/console": "^9.0|^10.0", "illuminate/container": "^9.0|^10.0", @@ -26,11 +26,11 @@ "illuminate/encryption": "^9.0|^10.0", "illuminate/http": "^9.0|^10.0", "illuminate/support": "^9.0|^10.0", - "lcobucci/jwt": "^3.4|^4.0", - "league/oauth2-server": "^8.2", - "nyholm/psr7": "^1.3", + "lcobucci/jwt": "^4.3|^5.0", + "league/oauth2-server": "^8.5.1", + "nyholm/psr7": "^1.5", "phpseclib/phpseclib": "^2.0|^3.0", - "symfony/psr-http-message-bridge": "^2.0" + "symfony/psr-http-message-bridge": "^2.1" }, "require-dev": { "mockery/mockery": "^1.0", diff --git a/src/PassportServiceProvider.php b/src/PassportServiceProvider.php index 64ed0b925..99e345e17 100644 --- a/src/PassportServiceProvider.php +++ b/src/PassportServiceProvider.php @@ -16,8 +16,9 @@ use Laravel\Passport\Bridge\RefreshTokenRepository; use Laravel\Passport\Guards\TokenGuard; use Laravel\Passport\Http\Controllers\AuthorizationController; -use Lcobucci\JWT\Configuration; -use Lcobucci\JWT\Parser; +use Lcobucci\JWT\Encoding\JoseEncoder; +use Lcobucci\JWT\Parser as ParserContract; +use Lcobucci\JWT\Token\Parser; use League\OAuth2\Server\AuthorizationServer; use League\OAuth2\Server\CryptKey; use League\OAuth2\Server\Grant\AuthCodeGrant; @@ -294,8 +295,8 @@ protected function registerClientRepository() */ protected function registerJWTParser() { - $this->app->singleton(Parser::class, function () { - return Configuration::forUnsecuredSigner()->parser(); + $this->app->singleton(ParserContract::class, function () { + return new Parser(new JoseEncoder); }); } diff --git a/tests/Unit/PersonalAccessTokenFactoryTest.php b/tests/Unit/PersonalAccessTokenFactoryTest.php index 33e576465..c35127104 100644 --- a/tests/Unit/PersonalAccessTokenFactoryTest.php +++ b/tests/Unit/PersonalAccessTokenFactoryTest.php @@ -42,7 +42,7 @@ public function test_access_token_can_be_created() $parsedToken = new PlainToken( new DataSet([], ''), new DataSet([RegisteredClaims::ID => 'token'], ''), - Signature::fromEmptyData() + new Signature('', '') ); $jwt->shouldReceive('parse')->with('foo')->andReturn($parsedToken);