File tree Expand file tree Collapse file tree 4 files changed +37
-3
lines changed Expand file tree Collapse file tree 4 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 22
22
"ext-json" : " *" ,
23
23
"league/oauth2-client" : " ^2.0" ,
24
24
"firebase/php-jwt" : " ^5.2 || ^6.0" ,
25
- "lcobucci/jwt" : " ^3.4 || ^4.0"
25
+ "lcobucci/jwt" : " ^3.4 || ^4.0 || ^5.0 "
26
26
},
27
27
"require-dev" : {
28
28
"phpunit/phpunit" : " ^5.7 || ^6.0 || ^9.3" ,
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace League \OAuth2 \Client \Test ;
4
+
5
+ use Lcobucci \JWT \Signer ;
6
+ use Lcobucci \JWT \Signer \Key ;
7
+
8
+ final class KeyDumpSigner implements Signer
9
+ {
10
+ public function algorithmId (): string
11
+ {
12
+ return 'keydump ' ;
13
+ }
14
+
15
+ public function sign (string $ payload , Key $ key ): string
16
+ {
17
+ return $ key ->contents ();
18
+ }
19
+
20
+ public function verify (string $ expected , string $ payload , Key $ key ): bool
21
+ {
22
+ return $ expected === $ key ->contents ();
23
+ }
24
+ }
Original file line number Diff line number Diff line change 6
6
use GuzzleHttp \Psr7 \Response ;
7
7
use Lcobucci \JWT \Configuration ;
8
8
use Lcobucci \JWT \Signer \Key ;
9
+ use Lcobucci \JWT \Signer \Hmac \Sha256 ;
9
10
use League \OAuth2 \Client \Provider \Apple ;
10
11
use League \OAuth2 \Client \Provider \AppleResourceOwner ;
12
+ use League \OAuth2 \Client \Test \KeyDumpSigner ;
11
13
use League \OAuth2 \Client \Token \AccessToken ;
12
14
use League \OAuth2 \Client \Token \AppleAccessToken ;
13
15
use League \OAuth2 \Client \Tool \QueryBuilderTrait ;
@@ -131,7 +133,10 @@ public function testGetAccessToken()
131
133
$ provider = m::mock ($ provider );
132
134
133
135
134
- $ configuration = Configuration::forUnsecuredSigner ();
136
+ $ configuration = Configuration::forSymmetricSigner (
137
+ new KeyDumpSigner (),
138
+ Key \InMemory::plainText ('private ' )
139
+ );
135
140
136
141
$ time = new \DateTimeImmutable ();
137
142
$ expiresAt = $ time ->modify ('+1 Hour ' );
Original file line number Diff line number Diff line change 3
3
namespace League \OAuth2 \Client \Test \Provider ;
4
4
5
5
use Lcobucci \JWT \Configuration ;
6
+ use Lcobucci \JWT \Signer \Key \InMemory ;
6
7
use League \OAuth2 \Client \Provider \Apple ;
8
+ use League \OAuth2 \Client \Test \KeyDumpSigner ;
7
9
8
10
/**
9
11
* Class TestApple
@@ -17,7 +19,10 @@ class TestApple extends Apple
17
19
*/
18
20
public function getConfiguration ()
19
21
{
20
- return Configuration::forUnsecuredSigner ();
22
+ return Configuration::forSymmetricSigner (
23
+ new KeyDumpSigner (),
24
+ InMemory::plainText ('private ' )
25
+ );
21
26
}
22
27
23
28
/**
You can’t perform that action at this time.
0 commit comments