Open dteleguin opened 2 years ago
Worth noting that it is not sufficient to match only against the kid
value. The kty
value also needs to match.
I have encountered OPs in the wild with multiple keys in a JWKS that use the same kid
but which have different kty
values, and the JWK specification (RFC 7517) specifically allows this.
Hi @dteleguin ,
Thanks for your suggestion. This has been added to our backlog and will be considered as an improvement to be added in in the future.
All the best, Nick.-
Impacted package
Which packages do you think might be impacted by the bug ?
Bug description
It is not uncommon for OIDC IdPs to use multiple JWK keys, resulting in the array published at
jwks_uri
to have more than one element. For example:(While Google, MS and Okta are of low relevance here, Ping, Keycloak and Connect2ID could potentially become Solid-OIDC compliant in the near future as they either already ship the necessary features like DPoP and PKCE or will start shipping them soon.)
Currently, this is not supported by the library as it would just pick the first key (IRedirectHandler.ts:73):
The statement about JWKS having to contain only the current key seems erroneous to me; I couldn't find any specification that would mandate the only key. Actually, the
kid
of the key should be matched against the corresponding header claim of the access/ID token.@justinwb @jamiefiedler
Expected result
Successful validation of acess/ID tokens minted by an IdP using multiple keys.
Actual result
Validation would only succeed if the token was signed by the first key from the published JWKS set.
Environment