feat(auth): pluggable OIDC provider (Keycloak / Entra / generic) - #175
Merged
Conversation
9 tasks
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.
Make the OIDC provider configurable per deployment (Keycloak / Microsoft Entra / generic OIDC), with zero config change for existing Keycloak deployments (prod on EKS keeps working as-is).
What changed
config.py: addedAUTH_PROVIDER+OIDC_*settings andresolved_*properties (issuer, client id/secret, audience, scopes, roles-claims, idp-hint, discovery URL).AUTH_PROVIDERdefaults tokeycloakand reads the existingKEYCLOAK_*vars.auth/oidc.py(new, replacesauth/keycloak.py): genericOidcClient— resolves endpoints from.well-known/openid-configuration, extracts roles from configurable dotted claim-paths (extract_roles), configurable scopes/audience, logout via the discoveredend_session_endpoint.main.py+cli/main.pyconstructOidcClientanddiscover()→fetch_jwks()at startup; all consumers useapp.state.oidc..env.example: documentsAUTH_PROVIDER+OIDC_*with an Entra example.Provider role defaults (approach C — presets over a generic mechanism): keycloak →
realm_access.roles+resource_access.{client}.roles; entra →roles; overridable viaOIDC_ROLES_CLAIMS. Audience = client id for all (Keycloak already validated this).Test plan
roles, wrong-aud/wrong-iss rejection, discovery parsing).rolesclaim,OIDC_AUDIENCEif the access-tokenaudisn't the bare client id). To verify locally once Entra is set up.Follow-up: standardize on
OIDC_*/ deprecateKEYCLOAK_*aliases (#174).