|
12 | 12 | use Laravel\Passport\HasApiTokens; |
13 | 13 | use Laravel\Passport\Token; |
14 | 14 | use Laravel\Passport\TokenRepository; |
15 | | -use Lcobucci\JWT\Parser; |
| 15 | +use Lcobucci\JWT\Configuration; |
16 | 16 |
|
17 | 17 | class AccessTokenControllerTest extends PassportTestCase |
18 | 18 | { |
@@ -77,10 +77,10 @@ public function testGettingAccessTokenWithClientCredentialsGrant() |
77 | 77 | $expiresInSeconds = 31536000; |
78 | 78 | $this->assertEqualsWithDelta($expiresInSeconds, $decodedResponse['expires_in'], 5); |
79 | 79 |
|
80 | | - $jwtAccessToken = (new Parser())->parse($decodedResponse['access_token']); |
81 | | - $this->assertTrue($this->app->make(ClientRepository::class)->findActive($jwtAccessToken->getClaim('aud'))->is($client)); |
| 80 | + $jwtAccessToken = Configuration::forUnsecuredSigner()->parser()->parse($decodedResponse['access_token']); |
| 81 | + $this->assertTrue($this->app->make(ClientRepository::class)->findActive($jwtAccessToken->claims()->get('aud'))->is($client)); |
82 | 82 |
|
83 | | - $token = $this->app->make(TokenRepository::class)->find($jwtAccessToken->getClaim('jti')); |
| 83 | + $token = $this->app->make(TokenRepository::class)->find($jwtAccessToken->claims()->get('jti')); |
84 | 84 | $this->assertInstanceOf(Token::class, $token); |
85 | 85 | $this->assertTrue($token->client->is($client)); |
86 | 86 | $this->assertFalse($token->revoked); |
@@ -170,11 +170,11 @@ public function testGettingAccessTokenWithPasswordGrant() |
170 | 170 | $expiresInSeconds = 31536000; |
171 | 171 | $this->assertEqualsWithDelta($expiresInSeconds, $decodedResponse['expires_in'], 5); |
172 | 172 |
|
173 | | - $jwtAccessToken = (new Parser())->parse($decodedResponse['access_token']); |
174 | | - $this->assertTrue($this->app->make(ClientRepository::class)->findActive($jwtAccessToken->getClaim('aud'))->is($client)); |
175 | | - $this->assertTrue($this->app->make('auth')->createUserProvider()->retrieveById($jwtAccessToken->getClaim('sub'))->is($user)); |
| 173 | + $jwtAccessToken = Configuration::forUnsecuredSigner()->parser()->parse($decodedResponse['access_token']); |
| 174 | + $this->assertTrue($this->app->make(ClientRepository::class)->findActive($jwtAccessToken->claims()->get('aud'))->is($client)); |
| 175 | + $this->assertTrue($this->app->make('auth')->createUserProvider()->retrieveById($jwtAccessToken->claims()->get('sub'))->is($user)); |
176 | 176 |
|
177 | | - $token = $this->app->make(TokenRepository::class)->find($jwtAccessToken->getClaim('jti')); |
| 177 | + $token = $this->app->make(TokenRepository::class)->find($jwtAccessToken->claims()->get('jti')); |
178 | 178 | $this->assertInstanceOf(Token::class, $token); |
179 | 179 | $this->assertFalse($token->revoked); |
180 | 180 | $this->assertTrue($token->user->is($user)); |
|
0 commit comments