Description
In 6.0 a change was introduced that made alg
required when parsing keys.
At the time someone already noted that it was a breaking change: #376 (comment)
This is a breaking change that is currently not obvious from the 6.0 release notes.
As a notable example, Microsoft do not output JWK with the alg key populated:
https://login.microsoftonline.com/common/discovery/keys
I think the release notes should encourage developers to inspect JWK::parseKeySet beyond just its return type.
Thanks!
The solution was implemented in #426 where a default algorithm value could be set.
As far as I can tell no motivation for making this algorithm a required parameter was given. I'm working on an OIDC implementation and to me this feels like a very brittle approach, given that:
- OIDC relies on discovery documents (https://login.microsoftonline.com/markteffect.nl/v2.0/.well-known/openid-configuration)
- OIDC relies on a
jwks_uri
configured in those documents, for example (https://login.microsoftonline.com/fd227a0d-5bcf-4e54-98c7-46a67c8cab14/discovery/v2.0/keys)
This means that in advance I cannot know what default algorithm to use. Sure, I could check the JWKS contents or the tokens I receive and see that it is RS256
today, but the whole point of this approach to configuration is that the other party can change it whenever they want. This means if Microsoft decides to switch to RS384
, my production code will break.
Could you elaborate on why this requirement, which as is mentioned in the source code, is stricter than the spec was added?