Skip to content

SSO login (OIDC)

Last updated: 2026-11-21T08:59:43-03:00 (UTC-3)

Optional federated MFA policy adds signed assurance and login-time freshness checks to configured legacy or named providers. SSO by itself is not MFA. Policies and their durable epochs are managed separately from issuer/client trust; local login paths retain their own controls.

Console users sign in with their corporate account (Google, Keycloak, Okta, authentik, Auth0, or any OpenID Connect provider), with no new password to manage. The gateway never sees the user’s password and never returns provider tokens to the browser. Flag: oidc_login.

What SSO does not do: grant a role or access. Whoever signs in is a local gateway user, with the role and teams an admin assigned. The provider’s email, domain, groups, and roles do not promote anyone.

Related feature Flag Guide
Restrict login to IdP groups oidc_group_policy Groups
End the console session when the IdP logs out oidc_backchannel_logout Logout
Also sign out of the IdP when signing out of the console oidc_rp_logout Logout
Create and deactivate users from the IdP scim SCIM

The existing admin.oidc profile remains supported unchanged. Named providers add an opt-in multi-provider path; its explicit mapping does not inherit the legacy SCIM externalId or JIT lookup. Their Google/Microsoft setup has separate named-vendor admission switches and exact trust requirements; those switches do not disable this legacy singleton.

features:
ui: true
console_users: true
oidc_login: true # boot
admin:
oidc:
label: Corporate SSO
issuer_url: https://identity.example.com/realms/company
client_id: ai-gateway
client_secret_env: GATEWAY_OIDC_CLIENT_SECRET
redirect_url: https://gateway.example.com/api/v1/admin/auth/oidc/callback
allowed_endpoint_origins: []
allow_loopback_http: false
subject_users:
immutable-idp-subject: usr_0123456789abcdef0123456789abcdef
  • oidc_login is a boot flag and requires PostgreSQL. This legacy profile uses one issuer. To offer several providers side by side, use named OIDC providers; each profile has its own trust and explicit local-user links.
  • The client secret lives in an environment variable or Secret, never in the YAML or the browser.
  • subject_users links the provider’s sub to a local user (the usr_… ID appears in Console users). With SCIM, the link comes from provisioning and the map can stay empty; the SCIM link wins over the map.
  • Local login and the admin bootstrap token keep working, for recovery.

The console shows the SSO button on the login screen with the configured label.

Every key is boot trust: set it in the YAML and roll the gateway out.

Key Default What it does
label required Text of the SSO button, 1–80 bytes
issuer_url required The provider’s issuer, compared byte for byte with the token’s iss (keep a trailing slash if the provider publishes one); HTTPS, no credentials, query or fragment
client_id required The confidential client registered at the provider, at most 512 bytes
client_secret_env required Name of the environment variable (or Secret key) that holds the client secret; the value must be at least 8 bytes
redirect_url required The callback registered at the provider; its path must be /api/v1/admin/auth/oidc/callback on the console origin
post_logout_redirect_url empty Where the provider sends the browser after an RP-initiated logout; must be on the console origin
allowed_endpoint_origins [] Up to 8 extra exact HTTPS origins (no path) the discovery document may point token and JWKS endpoints to
allow_loopback_http false Allows http://localhost for local development only; also requires admin.allow_insecure_http: true and a loopback redirect
subject_users {} Map of the provider’s immutable sub to an existing usr_… ID, 1–1000 entries unless scim or federated_jit links users
session_epoch empty 1–64 identifier characters; changing it ends every console session this provider created
  • A confidential OIDC client, with Standard Flow and PKCE S256 required.
  • Only the exact redirect URI above, no wildcard.
  • The realm’s exact issuer, with /realms/<realm>.

Keycloak can broker Google social login; in that case the gateway trusts Keycloak’s issuer.

A web-type OAuth client, with the exact callback:

issuer_url: https://accounts.google.com
allowed_endpoint_origins:
- https://oauth2.googleapis.com
- https://www.googleapis.com

Allow only the origins that discovery publishes (token and JWKS live on other hosts). Domain wildcards are not accepted. The gateway requests only the openid scope.

The issuer may end in / (…/application/o/<slug>/ in authentik, https://tenant/ in Auth0). In authentik, configure an RSA signing key on the OAuth2 provider: without it, the ID token is signed with HS256, which the gateway refuses.

HTTP only with allow_loopback_http: true, admin.allow_insecure_http: true, and a callback on localhost or a loopback IP. A private-network host is not an exception. Never in production.

  • Flow: Authorization Code with PKCE S256, state and nonce, discovery, and JWKS. The code is exchanged on the backend.
  • Identity: the issuer + sub pair. The sub is immutable; the email is not used as a shortcut.
  • ID token validation: RS256, ES256, or PS256 signature via JWKS, exact issuer, audience, expiration, subject, and nonce.
  • Session: the user’s role, teams, and status are reread from PostgreSQL on every request. Deactivating the user or changing the role takes effect on the next request.
  • Configuration change: changing the issuer, client, endpoints, redirect, secret, or links invalidates federated sessions.
  • Failure: the browser goes back to /ui/#login=failed, with a generic message; API calls get a JSON 401. Provider details do not leak.

Endpoints:

Endpoint What it does
GET /api/v1/admin/auth/providers Minimal public list {providers:[{id,label,login_url}]}; empty with the flag off
GET /api/v1/admin/auth/oidc/start Starts the login and redirects to the provider
GET /api/v1/admin/auth/oidc/callback Receives code and state, creates the session, and returns to /ui

The flow cookie is encrypted (AES-GCM), HttpOnly, SameSite=Lax, valid for five minutes, and contains no tokens. No provider token is stored.

  • Up to four simultaneous callbacks per process; the excess gets 503 and the user tries again.
  • Discovery, token, and JWKS: HTTPS on the issuer’s origin or on the explicit list, no redirects, 8 s per HTTP call, 10 s in total, up to 1 MiB.
  • Signing out of the console ends the local session. To reflect a logout done in the IdP, turn on backchannel logout; to also sign out of the IdP, RP logout.
  • This legacy singleton was tested against real Keycloak 26.4 and authentik 2025.10. The separate named Google/Microsoft profiles have real Web-client/account qualification; that does not retrospectively certify this singleton or Okta.
  • First-login user creation is opt-in: JIT provisioning creates a pending user, with the user role and no teams, for allowlisted identities; or use SCIM. For a SAML-only IdP, see SAML.

m7gtwcontact@m7gtw.com