Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow OIDC to validate custom claims in the access token #27138

Closed
djnalluri opened this issue Aug 4, 2022 · 3 comments · Fixed by #27292
Closed

Allow OIDC to validate custom claims in the access token #27138

djnalluri opened this issue Aug 4, 2022 · 3 comments · Fixed by #27292
Labels
area/oidc kind/enhancement New feature or request
Milestone

Comments

@djnalluri
Copy link
Contributor

Description

In the OIDC extension, the two main claims that can be customized to verify access tokens are issuer and audience. This is fine for a lot of use cases however it gets trickier in a multi-tenant scenario where multiple organizations are mixed into the same user pool. The issuer and audience remain the same, however, providers like Auth0 insert an extra claim named org_id to represent the tenant. While it is possible to work around this on Auth0 by encoding the organization into the audience, it's not a clean implementation of what the audience claim is supposed to represent and some other providers don't have this kind of capability. It would be nice if the OIDC extension was able to validate custom claims in the access token.

Implementation ideas

I propose adding a new configuration property named quarkus.oidc.token.custom-claims. It would be a string map with the keys representing the claims and the value being the claim's target value. An example would be quarkus.oidc.token.custom-claims.org_id=org_.... If the claim's value doesn't match or doesn't exist, the authentication attempt is rejected with a 401 error.

@djnalluri djnalluri added the kind/enhancement New feature or request label Aug 4, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 4, 2022

/cc @pedroigor, @sberyozkin

@quarkus-bot quarkus-bot bot added the area/oidc label Aug 4, 2022
@djnalluri
Copy link
Contributor Author

I may be able to start a PR if the proposed approach seems suitable.

@sberyozkin
Copy link
Member

@djnalluri IMHO it makes sense. I'd only propose to name it somehow differently, these are the additional required claims, so I'd name it required-claims. Please start working on a PR, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/oidc kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants