Skip to content

Commit

Permalink
[11.x] Allow lcobucci/jwt v5 and cleaned up version constraints (#1649
Browse files Browse the repository at this point in the history
)

* Allow `lcobucci/jwt` v5

* Temp change to see why CI no likey

* Update composer.json

* Update composer.json

* Fixes

* Update composer.json
  • Loading branch information
GrahamCampbell authored Apr 4, 2023
1 parent 2583a0a commit ef5fa30
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
9 changes: 5 additions & 4 deletions src/PassportServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
});
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/PersonalAccessTokenFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ef5fa30

Please sign in to comment.