Skip to content

feat(auth): pluggable OIDC provider (Keycloak / Entra / generic) - #175

Merged
hweej merged 5 commits into
mainfrom
feat/pluggable-oidc-provider
Aug 6, 2026
Merged

feat(auth): pluggable OIDC provider (Keycloak / Entra / generic)#175
hweej merged 5 commits into
mainfrom
feat/pluggable-oidc-provider

Conversation

@hweej

@hweej hweej commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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: added AUTH_PROVIDER + OIDC_* settings and resolved_* properties (issuer, client id/secret, audience, scopes, roles-claims, idp-hint, discovery URL). AUTH_PROVIDER defaults to keycloak and reads the existing KEYCLOAK_* vars.
  • auth/oidc.py (new, replaces auth/keycloak.py): generic OidcClient — resolves endpoints from .well-known/openid-configuration, extracts roles from configurable dotted claim-paths (extract_roles), configurable scopes/audience, logout via the discovered end_session_endpoint.
  • Cutover: main.py + cli/main.py construct OidcClient and discover()fetch_jwks() at startup; all consumers use app.state.oidc.
  • .env.example: documents AUTH_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 via OIDC_ROLES_CLAIMS. Audience = client id for all (Keycloak already validated this).

Test plan

  • 321 backend tests pass. Backward-compat is directly tested (Keycloak-only config resolves identically; dual-role merge; issuer/audience). New providers covered (Entra roles, wrong-aud/wrong-iss rejection, discovery parsing).
  • Entra end-to-end — needs a real Entra tenant + app registration (App Roles → roles claim, OIDC_AUDIENCE if the access-token aud isn't the bare client id). To verify locally once Entra is set up.

Follow-up: standardize on OIDC_* / deprecate KEYCLOAK_* aliases (#174).

@hweej hweej self-assigned this Aug 4, 2026
@hweej hweej added the enhancement New feature or request label Aug 4, 2026
@hweej
hweej merged commit 88dd3a3 into main Aug 6, 2026
3 checks passed
@hweej
hweej deleted the feat/pluggable-oidc-provider branch August 6, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant