1818use Jose \Component \Signature \Serializer \CompactSerializer ;
1919use PHPUnit \Framework \TestCase ;
2020use Psr \Log \LoggerInterface ;
21- use Symfony \Component \Clock \Clock ;
2221use Symfony \Component \Security \Core \Exception \BadCredentialsException ;
2322use Symfony \Component \Security \Core \User \OidcUser ;
2423use Symfony \Component \Security \Http \AccessToken \Oidc \OidcTokenHandler ;
@@ -41,7 +40,7 @@ public function testGetsUserIdentifierFromSignedToken(string $claim, string $exp
4140 'iat ' => $ time ,
4241 'nbf ' => $ time ,
4342 'exp ' => $ time + 3600 ,
44- 'iss ' => 'https://www.example.com/ ' ,
43+ 'iss ' => 'https://www.example.com ' ,
4544 'aud ' => self ::AUDIENCE ,
4645 'sub ' => 'e21bf182-1538-406e-8ccb-e25a17aba39f ' ,
4746 'email ' => 'foo@example.com ' ,
@@ -55,10 +54,10 @@ public function testGetsUserIdentifierFromSignedToken(string $claim, string $exp
5554 $ userBadge = (new OidcTokenHandler (
5655 new ES256 (),
5756 $ this ->getJWK (),
58- $ loggerMock ,
59- new Clock () ,
57+ self :: AUDIENCE ,
58+ [ ' https://www.example.com ' ] ,
6059 $ claim ,
61- self :: AUDIENCE
60+ $ loggerMock ,
6261 ))->getUserBadgeFrom ($ token );
6362 $ actualUser = $ userBadge ->getUserLoader ()();
6463
@@ -89,10 +88,10 @@ public function testThrowsAnErrorIfTokenIsInvalid(string $token)
8988 (new OidcTokenHandler (
9089 new ES256 (),
9190 $ this ->getJWK (),
92- $ loggerMock ,
93- new Clock () ,
91+ self :: AUDIENCE ,
92+ [ ' https://www.example.com ' ] ,
9493 'sub ' ,
95- self :: AUDIENCE
94+ $ loggerMock ,
9695 ))->getUserBadgeFrom ($ token );
9796 }
9897
@@ -106,7 +105,7 @@ public static function getInvalidTokens(): iterable
106105 'iat ' => time () - 3600 ,
107106 'nbf ' => time () - 3600 ,
108107 'exp ' => time () - 3590 ,
109- 'iss ' => 'https://www.example.com/ ' ,
108+ 'iss ' => 'https://www.example.com ' ,
110109 'aud ' => self ::AUDIENCE ,
111110 'sub ' => 'e21bf182-1538-406e-8ccb-e25a17aba39f ' ,
112111 'email ' => 'foo@example.com ' ,
@@ -118,7 +117,7 @@ public static function getInvalidTokens(): iterable
118117 'iat ' => time (),
119118 'nbf ' => time (),
120119 'exp ' => time () + 3590 ,
121- 'iss ' => 'https://www.example.com/ ' ,
120+ 'iss ' => 'https://www.example.com ' ,
122121 'aud ' => 'invalid ' ,
123122 'sub ' => 'e21bf182-1538-406e-8ccb-e25a17aba39f ' ,
124123 'email ' => 'foo@example.com ' ,
@@ -139,7 +138,7 @@ public function testThrowsAnErrorIfUserPropertyIsMissing()
139138 'iat ' => $ time ,
140139 'nbf ' => $ time ,
141140 'exp ' => $ time + 3600 ,
142- 'iss ' => 'https://www.example.com/ ' ,
141+ 'iss ' => 'https://www.example.com ' ,
143142 'aud ' => self ::AUDIENCE ,
144143 'sub ' => 'e21bf182-1538-406e-8ccb-e25a17aba39f ' ,
145144 ];
@@ -148,10 +147,10 @@ public function testThrowsAnErrorIfUserPropertyIsMissing()
148147 (new OidcTokenHandler (
149148 new ES256 (),
150149 self ::getJWK (),
151- $ loggerMock ,
152- new Clock () ,
150+ self :: AUDIENCE ,
151+ [ ' https://www.example.com ' ] ,
153152 'email ' ,
154- self :: AUDIENCE
153+ $ loggerMock ,
155154 ))->getUserBadgeFrom ($ token );
156155 }
157156
0 commit comments