Migrating from Keycloak
Keycloak and UniAuth expose overlapping OAuth/OIDC capabilities, but they are not spec-for-spec peers. Realm, client, role, federation, SAML, SCIM, session, and logout behavior require separate mapping and testing.
Endpoint Mapping
Keycloak prefixes endpoints with /realms/{realm}/protocol/openid-connect/…. UniAuth has a single issuer at https://uniauth.id. Tenanting is achieved via Organizations (/api/admin/organizations) and per-client org_id scoping.
| Keycloak | UniAuth |
|---|---|
| /realms/{realm}/.well-known/openid-configuration | /.well-known/openid-configuration |
| /realms/{realm}/protocol/openid-connect/certs | /.well-known/jwks.json |
| /realms/{realm}/protocol/openid-connect/auth | /api/oauth/authorize |
| /realms/{realm}/protocol/openid-connect/token | /api/oauth/token |
| /realms/{realm}/protocol/openid-connect/userinfo | /api/oauth/userinfo |
| /realms/{realm}/protocol/openid-connect/logout | /api/oauth/end-session |
| /realms/{realm}/protocol/openid-connect/revoke | /api/oauth/revoke |
| /realms/{realm}/protocol/openid-connect/token/introspect | /api/oauth/introspect |
| /realms/{realm}/protocol/openid-connect/auth/device | /api/oauth/device |
| /realms/{realm}/clients-registrations/openid-connect | /api/oauth/register |
| /realms/{realm}/protocol/saml | /api/saml/sso |
| /realms/{realm}/protocol/saml/descriptor | /api/saml/metadata |
| /realms/{realm}/scim/v2 | /api/scim/v2 |
Concept Mapping
| Keycloak concept | Candidate UniAuth mapping | Notes |
|---|---|---|
| Realm | Organization + per-client org_id scoping | Single issuer for all tenants; apps are tenant-scoped |
| Client | OAuth Client (/account/developer or /admin/oauth-clients) | Overlapping OAuth/OIDC concepts; verify grants, authentication method, redirects, scopes, claims, and lifecycle behavior. |
| Client Scope | Scope + Custom Claim Mapping per client | Keycloak's per-client-scope mapping ≈ custom_claims JSON on our oauth_clients |
| Realm Role | Group (scim_groups) | Emitted in 'groups' OIDC claim |
| Client Role | Custom Claim (role: "role") | Per-client role claim via lib/custom-claims |
| Composite Role | — | Not native; resolve via nested group membership in your app |
| User Federation (LDAP) | Upstream Identity Providers table | Currently OIDC/OAuth2 upstreams; LDAP on roadmap |
| Identity Provider (social) | connected_services via upstream_identity_providers | Dynamic list via /api/auth/providers |
| Authentication Flow | Saved auth-flow inventory (runtime unavailable) | Definitions can be stored per client, but canonical login and authorization do not execute them. |
| Protocol Mapper | Custom Claim Mapping on oauth_clients | Overlapping mapping mechanism; exact sources, values, and issuance behavior differ and require testing. |
| Authz Services (UMA) | — | Not implemented; use scope + claims + app-side policy |
| Event Listener SPI | Limited signed webhooks; no event-stream platform | Five user-lifecycle webhook names have located producers. /api/admin/event-streaming is a process-local scaffold with no production emitters, durability, fleet aggregation, or replay. |
| Offline Sessions | Refresh tokens (with rotation) | 30-day TTL, family-based replay detection |
| Session Client | oauth_refresh_tokens + sessions | Browser sessions and OAuth token families are separate; deleting a browser session does not establish full OAuth-token revocation. |
Claim Mapping
The following claim names can appear in both systems (sub,email,name,preferred_username,locale,zoneinfo); verify exact presence, values, subject semantics, and interoperability.
Pairwise subject identifiers: UniAuth emits per-client pairwisesub values by default. Keycloak does not— sub is the realm UUID. If your app correlates users across clients viasub, useemail instead.
User Migration
Option 1: Gradual via SCIM (recommended)
If you keep Keycloak live, use a separately validated provisioning process to send supported SCIM records to UniAuth (https://uniauth.id/api/scim/v2). Do not assume Keycloak can target this endpoint directly; verify schema, credentials, reconciliation, deletion, and rollback before moving any app.
Option 2: Export + bulk import
Use Keycloak’s realm export:
# export from Keycloak
kc.sh export --dir /tmp/export --users different_files \
--realm your-realmTransform the resulting JSON to UniAuth’s import schema (one object per user with email,firstName,lastName,groups) and POST to/api/admin/users/import (schema validation caps a request at 10,000 users and supports dry-run preview). This is an input cap, not a throughput guarantee; rehearse smaller batches and reconcile results.
Passwords: Password hashes and credential fields are not accepted by the standard import path, and standard profile import sends no onboarding message. Pre-provision users, then separately initiate a supported password reset or magic-link sign-in, or use a separately validated bridge, before password sign-in.
Option 3: Federation bridge
An upstream OIDC bridge is only a candidate architecture. This repository does not establish automatic JIT provisioning or a percentage-based safe cutover; validate account linking, provisioning, rollback, and reversal before use.
Minimal Config Diff
- issuer: https://kc.example.com/realms/your-realm
+ issuer: https://uniauth.id
- jwks_uri: https://kc.example.com/realms/your-realm/protocol/openid-connect/certs
+ jwks_uri: https://uniauth.id/.well-known/jwks.json
- client_id: your-kc-client
+ client_id: uni_…
- client_secret: …
+ client_secret: unis_…If your library uses OIDC discovery (set issuer only), the issuer change is only a starting point; migrate and test client settings, redirects, claims, sessions, logout, and failure behavior.