feat(auth): add OIDC claim-based authorization (allowedClaimKey/allowedClaimValues)#3594
Open
brucearctor wants to merge 1 commit into
Open
feat(auth): add OIDC claim-based authorization (allowedClaimKey/allowedClaimValues)#3594brucearctor wants to merge 1 commit into
brucearctor wants to merge 1 commit into
Conversation
|
@brucearctor is attempting to deploy a commit to the Temporal Team on Vercel. A member of the Team first needs to authorize it. |
…edClaimValues) Add support for restricting UI access based on OIDC ID token claims. Operators can now configure allowedClaimKey and allowedClaimValues on an auth provider to gate login to users with specific group memberships, roles, or other claim values. Features: - New AuthProvider config fields: allowedClaimKey, allowedClaimValues - Supports flat string claims, array claims, and nested dot-notation paths (e.g., realm_access.roles for Keycloak) - Supports literal keys containing colons (e.g., cognito:groups) and dots (e.g., URL-namespaced Auth0 claims) - Docker env vars: TEMPORAL_AUTH_ALLOWED_CLAIM_KEY, TEMPORAL_AUTH_ALLOWED_CLAIM_VALUES (comma-separated) - Config validation: both fields must be set together - Generic 403 error response (no claim metadata leaked to clients) - 16 new unit tests covering all claim types and edge cases Backward compatible: if neither field is set, behavior is unchanged. Closes temporalio#3562
d26cf84 to
6b11ad1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description & motivation 💭
Closes #3562
Currently, the Temporal UI allows any user who can authenticate with the configured OIDC provider to access the UI. This is a security gap when the UI is externally exposed and the OIDC provider serves a large tenant (e.g., an entire Azure AD / Entra ID directory).
This PR adds claim-based authorization — two new
AuthProviderconfig fields that let operators restrict UI login to users whose ID token contains specific claim values (e.g., a group membership or role).New Config Fields
Docker Env Vars
Key Design Decisions
ExchangeCodesucceeds but beforeSetUser, the callback inspects the ID token payload. If the user lacks the required claim, login is rejected with 403. Most IdPs don't update group claims on token refresh, so re-checking on refresh would give false confidence.maxSessionDurationalready bounds the window.realm_access.rolesfor Keycloak) and literal keys containing colons (e.g.,cognito:groupsfor AWS Cognito) or dots (e.g., Auth0 URL-namespaced claims).Design Considerations 🎨
None — this is purely server-side config with no UI changes.
Testing 🧪
How was this tested 👻
16 new unit tests in
server/server/auth/auth_test.gocovering:cognito:groups)https://myapp.example.com/roles)All existing tests pass.
go vetclean on all modified packages.Steps for others to test: 🚶🏽♂️🚶🏽♀️
allowedClaimKey: groupsandallowedClaimValues: ["test-group"]in a providerpnpm dev:with-auth(the mock OIDC server)groups: ["test-group"], access is granted; otherwise 403Checklists
Merge Checklist
go vetclean)AUTHENTICATION.md)docker.yaml)Issue(s) closed
Closes #3562
Docs
Any docs updates needed?
AUTHENTICATION.mdhas been updated with: