A realm may declare external authentication providers (OAuth2 explicit endpoints or OIDC discovery). They are optional: when none are configured, the realm only accepts local password (+ TOTP) logins as before.
How it works
- A provider is an
external_auth_providerentity (/api/providers,providers.read/providers.write/providers.delete). New permissionsproviders.read,providers.write,providers.deletewere added; theipseity-admin-platformrole grants them, and every realm receives anipseity-admin-providersrole. - The account key is the email address. During a provider login Ipseity
resolves the identity document's email (the
email_claim, defaultemail) and signs into the local principal whoseemailmatches — any provider that reports the same email signs into the same account ("multiple paths to the account that is unique by email"). Principalemailis unique within a realm (enforced on write). - Auto-provisioning. When no principal has that email and the provider has
auto_provisionenabled (default), Ipseity creates a principal on first login, named deterministically from the email (ext-<sha256(email)>) with theloginpermission, the provider'sdefault_groups/default_roles, and the email retained. Structured names from the identity document are captured:given_name/family_nameare stored (from userinfo, falling back to theid_tokenclaims), anddisplay_nameis the provider'snameclaim, or is synthesized as"given family"when nonameis present. The old identity is never deleted, so an external identity cannot be "re-created" under the same email. - Blacklisting still applies. A principal without the
loginpermission is banned from every authentication source, including external providers (ipseity.superdoes not implylogin).
Supported source types
| Source type | Endpoints | Notes |
|---|---|---|
oauth2 |
explicit authorization_endpoint, token_endpoint, userinfo_endpoint; optional issuer and jwks_uri |
userinfo supplies the email; when the provider returns an id_token (e.g. Google with an openid scope) it is verified against the provider JWKS — see below |
oidc |
discovery_url (or issuer) |
discovery document resolves endpoints + JWKS; id_token signatures are verified (RS256 via the provider JWKS, HS256 via client secret) against the correct iss / aud / exp |
Each can be a public client (PKCE, no secret — the server generates and
holds the PKCE verifier across the hop) or a private client (client_secret,
encrypted at rest, sent over the server-to-server token exchange).
Verifying oauth2 id_tokens
An oauth2 provider may still return an RS256 id_token (any provider that
honours an openid scope — Google does). To verify it the server needs the
provider's JWKS document. jwks_uri is resolved in this order:
- the provider's explicit
jwks_uri, then - the provider's
issuer— the server fetches<issuer>/.well-known/openid-configuration(cached for one hour) and uses the advertisedjwks_uri(this also fills a missingissuerfor theisscheck).
So an oauth2 Google provider configured with explicit endpoints works as long
as its Issuer is set to https://accounts.google.com (the console exposes
Issuer and JWKS URI fields on the provider form). A non-discoverable provider
should set jwks_uri explicitly. If neither is available and an id_token
needs verifying, the callback reports that jwks_uri is required.
Flow
- The login page advertises your providers automatically. When a realm has
at least one enabled provider,
GET /oauth/authorizerenders a "Sign in with …" button for each one (using the provider'sdisplay_name, falling back to itsname) right below the username/password form. Clicking a button re-issues the same authorize request withexternal_provider=<name>, so users never have to construct the URL by hand. Disabled providers are hidden. - The user starts a normal authorization request and adds
external_provider=<name>toGET /oauth/authorize(or clicks the button). Ipseity validates the ipseity client / redirect URI / scope / PKCE challenge, persists the pending authorization in the realm's KV under a random state token, and redirects the browser to the provider (authorization_code+ PKCE for public clients). - The provider redirects back to
GET /oauth/extlogin/callbackwith acodeand the opaquestate(which carries the realm so the callback can route without realms appearing in the URL path). Ipseity exchanges the code, fetches userinfo, verifies theid_token(OIDC), and resolves / provisions the principal by email. - Ipseity issues an ipseity authorization code bound to the original authorize
request and redirects the browser back to the client's
redirect_uri— the rest of the OAuth/OIDC flow is unchanged.
The pending authorize state survives until the callback (TTL
IPSEITY_EXTERNAL_LOGIN_TTL_SECONDS, default 15 minutes — deliberately longer
than the auth-code TTL so the user has time to complete the IdP's own screens,
including MFA and scope approval). Browser failures, including expired state,
provider refusal and DNS/connection/discovery/JWKS failures, return to the original
login form with a readable error. The client, scopes, application state, nonce,
PKCE and validated theme are preserved, and the provider is not automatically
restarted. Recovery-only KV records outlive the pending state; see
browser login recovery for TTLs and fallback behavior.
A transport failure during the code exchange keeps the pending state. Low-level
non-navigation callers retain the existing diagnostic page and retry URL. A
provider refusal (error=access_denied and friends) consumes the pending state;
state is also consumed once the provider has accepted the code, including when a
later userinfo/JWKS request fails. Recovery always requires a fresh sign-in and
does not bypass this single-use behavior.
Administration
GET/POST /api/providers,GET/PUT/DELETE /api/providers/<name>under the realm'sproviders.*permissions (cross-realm viaX-Ipseity-Realmforipseity.superprincipals).- Provider
client_secretis encrypted at rest and redacted from API responses. - Disabling a provider (
enabled: false) rejects new logins through it; existing accounts and tokens are unaffected. - A
providersmanagement page is in the console (list, create, edit, delete).
