In the example above, the token is valid for 3 different audiences that could be handled by 3 completely different apps. For instance, one application could only require the token to have example_microservices_api audience.
Normally, we'd define a Guardian's pipeline using VerifyHeader plug as follows:
While using JWT, there are situations where the same token is valid for different audiences:
In the example above, the token is valid for 3 different audiences that could be handled by 3 completely different apps. For instance, one application could only require the token to have
example_microservices_api
audience.Normally, we'd define a Guardian's pipeline using
VerifyHeader
plug as follows:This will fail because the
aud
claim doesn't match the token'saud
claim andGuardian.Plug.Verify.verify_literal_claim
only does an equal check:https://github.com/ueberauth/guardian/blob/38aa02508fe9e832d7fdd0bb081a4e6f172b7b56/lib/guardian/token/verify.ex#L68-L80.
Could we change this code to something that consider where claim's value is a list?
N.B: I could probably write this code n a better way.