3838 */
3939abstract class AbstractTokenVerifier implements TokenVerifierInterface
4040{
41- protected string $ issuer ;
42-
43- protected string $ clientId ;
44-
45- protected ?string $ clientSecret ;
46-
47- protected ?string $ expectedAzp ;
48-
49- protected ?string $ expectedAlg ;
50-
51- protected int $ clockTolerance ;
52-
53- protected bool $ authTimeRequired ;
54-
55- protected bool $ aadIssValidation ;
56-
5741 protected JwksProviderInterface $ jwksProvider ;
5842
5943 protected TokenDecrypterInterface $ decrypter ;
@@ -70,26 +54,18 @@ abstract class AbstractTokenVerifier implements TokenVerifierInterface
7054 * @psalm-internal \Facile\JoseVerifier
7155 */
7256 final public function __construct (
73- string $ issuer ,
74- string $ clientId ,
75- ?string $ clientSecret = null ,
76- bool $ authTimeRequired = false ,
77- int $ clockTolerance = 0 ,
78- bool $ aadIssValidation = false ,
79- ?string $ expectedAzp = null ,
80- ?string $ expectedAlg = null ,
57+ protected string $ issuer ,
58+ protected string $ clientId ,
59+ protected ?string $ clientSecret = null ,
60+ protected bool $ authTimeRequired = false ,
61+ protected int $ clockTolerance = 0 ,
62+ protected bool $ aadIssValidation = false ,
63+ protected ?string $ expectedAzp = null ,
64+ protected ?string $ expectedAlg = null ,
8165 ?JwksProviderInterface $ jwksProvider = null ,
8266 ?TokenDecrypterInterface $ decrypter = null ,
8367 ?ClockInterface $ clock = null ,
8468 ) {
85- $ this ->issuer = $ issuer ;
86- $ this ->clientId = $ clientId ;
87- $ this ->clientSecret = $ clientSecret ;
88- $ this ->authTimeRequired = $ authTimeRequired ;
89- $ this ->clockTolerance = $ clockTolerance ;
90- $ this ->aadIssValidation = $ aadIssValidation ;
91- $ this ->expectedAzp = $ expectedAzp ;
92- $ this ->expectedAlg = $ expectedAlg ;
9369 $ this ->jwksProvider = $ jwksProvider ?? new MemoryJwksProvider ();
9470 $ this ->decrypter = $ decrypter ?? new NullTokenDecrypter ();
9571 $ this ->clock = $ clock ?? new InternalClock ();
@@ -238,12 +214,12 @@ private function getJWKFromKid(string $kid): JWK
238214 $ jwks = JWKSet::createFromKeyData ($ this ->jwksProvider ->getJwks ());
239215 $ jwk = $ jwks ->selectKey ('sig ' , null , ['kid ' => $ kid ]);
240216
241- if (null === $ jwk ) {
217+ if (! $ jwk instanceof JWK ) {
242218 $ jwks = JWKSet::createFromKeyData ($ this ->jwksProvider ->reload ()->getJwks ());
243219 $ jwk = $ jwks ->selectKey ('sig ' , null , ['kid ' => $ kid ]);
244220 }
245221
246- if (null === $ jwk ) {
222+ if (! $ jwk instanceof JWK ) {
247223 throw new InvalidTokenException ('Unable to find the jwk with the provided kid: ' . $ kid );
248224 }
249225
0 commit comments