18
18
use Jose \Component \Signature \Serializer \CompactSerializer ;
19
19
use PHPUnit \Framework \TestCase ;
20
20
use Psr \Log \LoggerInterface ;
21
- use Symfony \Component \Clock \Clock ;
22
21
use Symfony \Component \Security \Core \Exception \BadCredentialsException ;
23
22
use Symfony \Component \Security \Core \User \OidcUser ;
24
23
use Symfony \Component \Security \Http \AccessToken \Oidc \OidcTokenHandler ;
@@ -41,7 +40,7 @@ public function testGetsUserIdentifierFromSignedToken(string $claim, string $exp
41
40
'iat ' => $ time ,
42
41
'nbf ' => $ time ,
43
42
'exp ' => $ time + 3600 ,
44
- 'iss ' => 'https://www.example.com/ ' ,
43
+ 'iss ' => 'https://www.example.com ' ,
45
44
'aud ' => self ::AUDIENCE ,
46
45
'sub ' => 'e21bf182-1538-406e-8ccb-e25a17aba39f ' ,
47
46
@@ -55,10 +54,10 @@ public function testGetsUserIdentifierFromSignedToken(string $claim, string $exp
55
54
$ userBadge = (new OidcTokenHandler (
56
55
new ES256 (),
57
56
$ this ->getJWK (),
58
- $ loggerMock ,
59
- new Clock () ,
57
+ self :: AUDIENCE ,
58
+ [ ' https://www.example.com ' ] ,
60
59
$ claim ,
61
- self :: AUDIENCE
60
+ $ loggerMock ,
62
61
))->getUserBadgeFrom ($ token );
63
62
$ actualUser = $ userBadge ->getUserLoader ()();
64
63
@@ -89,10 +88,10 @@ public function testThrowsAnErrorIfTokenIsInvalid(string $token)
89
88
(new OidcTokenHandler (
90
89
new ES256 (),
91
90
$ this ->getJWK (),
92
- $ loggerMock ,
93
- new Clock () ,
91
+ self :: AUDIENCE ,
92
+ [ ' https://www.example.com ' ] ,
94
93
'sub ' ,
95
- self :: AUDIENCE
94
+ $ loggerMock ,
96
95
))->getUserBadgeFrom ($ token );
97
96
}
98
97
@@ -106,7 +105,7 @@ public static function getInvalidTokens(): iterable
106
105
'iat ' => time () - 3600 ,
107
106
'nbf ' => time () - 3600 ,
108
107
'exp ' => time () - 3590 ,
109
- 'iss ' => 'https://www.example.com/ ' ,
108
+ 'iss ' => 'https://www.example.com ' ,
110
109
'aud ' => self ::AUDIENCE ,
111
110
'sub ' => 'e21bf182-1538-406e-8ccb-e25a17aba39f ' ,
112
111
@@ -118,7 +117,7 @@ public static function getInvalidTokens(): iterable
118
117
'iat ' => time (),
119
118
'nbf ' => time (),
120
119
'exp ' => time () + 3590 ,
121
- 'iss ' => 'https://www.example.com/ ' ,
120
+ 'iss ' => 'https://www.example.com ' ,
122
121
'aud ' => 'invalid ' ,
123
122
'sub ' => 'e21bf182-1538-406e-8ccb-e25a17aba39f ' ,
124
123
@@ -139,7 +138,7 @@ public function testThrowsAnErrorIfUserPropertyIsMissing()
139
138
'iat ' => $ time ,
140
139
'nbf ' => $ time ,
141
140
'exp ' => $ time + 3600 ,
142
- 'iss ' => 'https://www.example.com/ ' ,
141
+ 'iss ' => 'https://www.example.com ' ,
143
142
'aud ' => self ::AUDIENCE ,
144
143
'sub ' => 'e21bf182-1538-406e-8ccb-e25a17aba39f ' ,
145
144
];
@@ -148,10 +147,10 @@ public function testThrowsAnErrorIfUserPropertyIsMissing()
148
147
(new OidcTokenHandler (
149
148
new ES256 (),
150
149
self ::getJWK (),
151
- $ loggerMock ,
152
- new Clock () ,
150
+ self :: AUDIENCE ,
151
+ [ ' https://www.example.com ' ] ,
153
152
'email ' ,
154
- self :: AUDIENCE
153
+ $ loggerMock ,
155
154
))->getUserBadgeFrom ($ token );
156
155
}
157
156
0 commit comments