panva / openid-client

OAuth 2 / OpenID Connect Client API for JavaScript Runtimes
MIT License
1.83k stars 392 forks source link

JWT validation for id token throws if the authorized presenter (azp field) is not defined if there are multiple audiences #311

Closed deepaksrgm2010 closed 3 years ago

deepaksrgm2010 commented 3 years ago

Currently , JWT validation does not seem to account for azp field not being defined when there are multiple audiences defined.

according to the specs

"If the ID Token contains multiple audiences, the Client SHOULD verify that an azp Claim is present" This is a SHOULD ,hence recommended, but not a MUST, hence not mandatory

I am reading this as that azp is not mandatory if multiple audiences are present and an OP is complaint when azp is not provided for multiple audiences.

Hence is it possible to accommodate this when validating id token ?

panva commented 3 years ago
  1. As a certified software this client MUST exhibit this behaviour.
  2. SHOULD doesn’t mean that an implementation is free to ignore a requirement because it doesn’t feel like honouring it.
deepaksrgm2010 commented 3 years ago

Thanks for your quick and clear response @panva!

I am not sure, if all other certified libraries exhibit the same behaviour. It looks like the following certified libraries do not enforce an azp to be present on multiple audiences. Examples:

For me, the standard seems to be not very precise on the need here. I found an interesting discussion on oidc issue regarding this

panva commented 3 years ago

If and when there's finally an errata published about this i will revisit the topic. Until then the client will honour the SHOULD.