Skip to content

Commit b0868a5

Browse files
authored
chore(deps): Add Laravel 10 support (#2210)
* chore(deps): Add Laravel 10 support * Apply fixes from StyleCI (#2211) [ci skip] [skip ci] * cleanup readme * add compat table and alias
1 parent 014be8d commit b0868a5

File tree

9 files changed

+72
-375
lines changed

9 files changed

+72
-375
lines changed

.github/workflows/phpunit.yml

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
php: [7.4, 8.0, 8.1]
18-
laravel: [6.*, 7.*, 8.*, 9.*]
17+
php: [8.0, 8.1, 8.2]
18+
laravel: [9.*, 10.*]
1919
os: [ubuntu-latest]
2020
coverage: [none]
2121
include:
22-
- php: 8.1
23-
laravel: 9.*
22+
- php: 8.2
23+
laravel: 10.*
2424
os: ubuntu-latest
2525
coverage: xdebug
2626
exclude:
27-
- php: 7.4
28-
laravel: 9.*
27+
- php: 8.0
28+
laravel: 10.*
2929

3030
name: '[P${{ matrix.php }}] [L${{ matrix.laravel }}] [${{ matrix.coverage }}]'
3131

@@ -43,10 +43,10 @@ jobs:
4343

4444
- name: Get composer cache directory
4545
id: composer-cache
46-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
46+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
4747

4848
- name: Cache dependencies
49-
uses: actions/cache@v2
49+
uses: actions/cache@v3
5050
with:
5151
path: ${{ steps.composer-cache.outputs.dir }}
5252
key: "php-${{ matrix.php }}-laravel-${{ matrix.laravel }}-${{ hashFiles('**/composer.json') }}"

README.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99

1010
## Documentation
1111

12-
Documentation for `1.*` [here](http://jwt-auth.com)
12+
[jwt-auth.com](https://jwt-auth.com)
13+
14+
| jwt-auth version | Laravel version(s) |
15+
|---|---|
16+
| 1.x | 6 / 7 / 8 |
17+
| 2.x | 9 / 10 |
1318

14-
For version `0.5.*` See the [WIKI](https://github.com/tymondesigns/jwt-auth/wiki) for documentation.
1519

1620
[<img src="https://user-images.githubusercontent.com/1801923/57975478-a7a88900-79c1-11e9-924b-d7fa742f743b.png" height="40">](https://www.patreon.com/bePatron?u=11815122)
1721

@@ -28,5 +32,3 @@ If you discover any security related issues, please email [email protected] ins
2832
## License
2933

3034
The MIT License (MIT)
31-
32-
[![SensioLabs Insight](https://insight.sensiolabs.com/projects/ba600082-7869-4ea8-b877-0bf6a86d4988/big.svg)](https://insight.sensiolabs.com/projects/ba600082-7869-4ea8-b877-0bf6a86d4988)

composer.json

+13-14
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,20 @@
2323
}
2424
],
2525
"require": {
26-
"php": "^7.4|^8.0",
27-
"illuminate/auth": "^5.2|^6|^7|^8|^9",
28-
"illuminate/contracts": "^5.2|^6|^7|^8|^9",
29-
"illuminate/http": "^5.2|^6|^7|^8|^9",
30-
"illuminate/support": "^5.2|^6|^7|^8|^9",
31-
"lcobucci/jwt": "^3.4|^4.0",
32-
"namshi/jose": "^7.0",
33-
"nesbot/carbon": "^1.0|^2.0"
26+
"php": "^8.0",
27+
"illuminate/auth": "^9.0|^10.0",
28+
"illuminate/contracts": "^9.0|^10.0",
29+
"illuminate/http": "^9.0|^10.0",
30+
"illuminate/support": "^9.0|^10.0",
31+
"lcobucci/jwt": "^4.0",
32+
"nesbot/carbon": "^2.0"
3433
},
3534
"require-dev": {
36-
"illuminate/console": "^5.2|^6|^7|^8|^9",
37-
"illuminate/database": "^5.2|^6|^7|^8|^9",
38-
"illuminate/routing": "^5.2|^6|^7|^8|^9",
35+
"illuminate/console": "^9.0|^10.0",
36+
"illuminate/database": "^9.0|^10.0",
37+
"illuminate/routing": "^9.0|^10.0",
3938
"mockery/mockery": ">=0.9.9",
40-
"phpunit/phpunit": "^8.5|^9.4",
41-
"yoast/phpunit-polyfills": "^0.2.0"
39+
"phpunit/phpunit": "^9.4"
4240
},
4341
"autoload": {
4442
"psr-4": {
@@ -52,7 +50,8 @@
5250
},
5351
"extra": {
5452
"branch-alias": {
55-
"dev-develop": "1.0-dev"
53+
"dev-develop": "1.0-dev",
54+
"dev-2.x": "2.0-dev"
5655
},
5756
"laravel": {
5857
"aliases": {

src/Providers/JWT/Namshi.php

-103
This file was deleted.

tests/AbstractTestCase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
use Carbon\Carbon;
1515
use Mockery;
16-
use Yoast\PHPUnitPolyfills\TestCases\TestCase;
16+
use PHPUnit\Framework\TestCase;
1717

1818
abstract class AbstractTestCase extends TestCase
1919
{

tests/Providers/JWT/LcobucciTest.php

+9-8
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Tymon\JWTAuth\Test\Providers\JWT;
1313

14+
use Illuminate\Support\Str;
1415
use Tymon\JWTAuth\Exceptions\JWTException;
1516
use Tymon\JWTAuth\Exceptions\TokenInvalidException;
1617
use Tymon\JWTAuth\Providers\JWT\Lcobucci;
@@ -30,7 +31,7 @@ public function it_can_encode_claims_using_a_symmetric_key()
3031
'custom_claim' => 'foobar',
3132
];
3233

33-
$token = $this->getProvider('secret', Provider::ALGO_HS256)->encode($payload);
34+
$token = $this->getProvider(Str::random(64), Provider::ALGO_HS256)->encode($payload);
3435
[$header, $payload, $signature] = explode('.', $token);
3536

3637
$claims = json_decode(base64_decode($payload), true);
@@ -57,7 +58,7 @@ public function it_can_encode_and_decode_a_token_using_a_symmetric_key()
5758
'custom_claim' => 'foobar',
5859
];
5960

60-
$provider = $this->getProvider('secret', Provider::ALGO_HS256);
61+
$provider = $this->getProvider(Str::random(64), Provider::ALGO_HS256);
6162

6263
$token = $provider->encode($payload);
6364
$claims = $provider->decode($token);
@@ -81,7 +82,7 @@ public function it_can_encode_and_decode_a_token_using_an_asymmetric_RS256_key()
8182
];
8283

8384
$provider = $this->getProvider(
84-
'secret',
85+
Str::random(64),
8586
Provider::ALGO_RS256,
8687
['private' => $this->getDummyPrivateKey(), 'public' => $this->getDummyPublicKey()]
8788
);
@@ -115,7 +116,7 @@ public function it_should_throw_an_invalid_exception_when_the_payload_could_not_
115116
'invalid_utf8' => "\xB1\x31", // cannot be encoded as JSON
116117
];
117118

118-
$this->getProvider('secret', Provider::ALGO_HS256)->encode($payload);
119+
$this->getProvider(Str::random(64), Provider::ALGO_HS256)->encode($payload);
119120
}
120121

121122
/** @test */
@@ -125,8 +126,8 @@ public function it_should_throw_a_token_invalid_exception_when_the_token_could_n
125126
$this->expectExceptionMessage('Token Signature could not be verified.');
126127

127128
// This has a different secret than the one used to encode the token
128-
$this->getProvider('secret', Provider::ALGO_HS256)
129-
->decode('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiZXhwIjoxNjQ5MjYxMDY1LCJpYXQiOjE2NDkyNTc0NjUsImlzcyI6Ii9mb28iLCJjdXN0b21fY2xhaW0iOiJmb29iYXIifQ.jZufNqDHAxtboUIPmDp4ZFOIQxK-B5G6vNdBEp-9uL8');
129+
$this->getProvider(Str::random(64), Provider::ALGO_HS256)
130+
->decode('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiZXhwIjoxNjQ5MjYxMDY1LCJpYXQiOjE2NDkyNTc0NjUsImlzcyI6Ii9mb28iLCJjdXN0b21fY2xhaW0iOiJmb29iYXIifQ.jamiInQiin-1RUviliPjZxl0MLEnQnVTbr2sGooeXBY');
130131
}
131132

132133
/** @test */
@@ -136,8 +137,8 @@ public function it_should_throw_a_token_invalid_exception_when_the_token_could_n
136137
$this->expectExceptionMessage('Token Signature could not be verified.');
137138

138139
// This sub claim for this token has been tampered with so the signature will not match
139-
$this->getProvider('secret', Provider::ALGO_HS256)
140-
->decode('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyIiwiZXhwIjoxNjQ5MjY0OTA2LCJpYXQiOjE2NDkyNjEzMDYsImlzcyI6Ii9mb28iLCJjdXN0b21fY2xhaW0iOiJmb29iYXIifQ.IcJvMvwMXf8oEpnz8-hvAy60QDE_o8XFaxhbZIGVy0U');
140+
$this->getProvider(Str::random(64), Provider::ALGO_HS256)
141+
->decode('eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiZXhwIjoxNjQ5MjYxMDY1LCJpYXQiOjE2NDkyNTc0NjUsImlzcyI6Ii9mb29iYXIiLCJjdXN0b21fY2xhaW0iOiJmb29iYXIifQ.jamiInQiin-1RUviliPjZxl0MLEnQnVTbr2sGooeXBY');
141142
}
142143

143144
/** @test */

0 commit comments

Comments
 (0)