Identity provider quickstart: Keycloak
The Live Host has one login: your OIDC identity provider (ADR 0007). This page gets you a working one in minutes: Keycloak, shipped as a compose profile with a realm that already carries everything the Live Host needs. Evaluate with it as is, on one computer; for production keep the realm (realm-designiq.json, not the demo users of designiq-users-0.json) and run Keycloak the way you run Keycloak (real database, TLS, start instead of start-dev). Microsoft Entra ID instead: entra-id.md.
Evaluating without any login at all? That is LIVE_AUTH=none (operating modes), no IdP involved.
What the realm carries
deploy/keycloak/realm-designiq.json, imported on Keycloak's first start:
| Item | What / why |
|---|---|
realm designiq | one realm for the platform; self-registration off |
client designiq-web | the browser login: public client, PKCE S256, redirect http://localhost:8301/auth/oidc/callback |
client designiq-mcp | MCP clients: public client, PKCE S256, redirect http://localhost:8765/callback (Claude Code: --client-id designiq-mcp --callback-port 8765) |
| three protocol mappers on each client | audience: a fixed aud: designiq (Keycloak does not honor RFC 8707 resource indicators, so the Live Host is told the fixed value: LIVE_OIDC_AUDIENCE=designiq); github_login and gitlab_username: the user attributes as claims in the access token (LIVE_OIDC_LOGIN_CLAIM's default, and the GitLab username) |
user profile attribute github_login | declared, editable by admins only: the claim decides which repositories a person may write, so the person must never be able to set it (the Live Host refuses tokens without it, and never falls back to preferred_username). Letters, digits, ., _ and -, so a GitLab username fits too |
user profile attribute gitlab_username | the same for the GitLab username: LIVE_OIDC_LOGIN_CLAIM=gitlab_username on a host that connects only a GitLab, LIVE_OIDC_GITLAB_LOGIN_CLAIM=gitlab_username on one with a GitHub App beside it (The GitLab username) |
identity provider github (disabled) | the production path: GitHub as the login method behind Keycloak, with a mapper that copies the verified GitHub login into github_login at every sign-in (sync mode FORCE). Enable it with your own GitHub OAuth App, see below |
| brute force detection | on, with Keycloak's defaults: an account is locked for a while after repeated failed logins |
Next to it, deploy/keycloak/designiq-users-0.json holds the two demo users, which the compose profile imports as well: petra/petra carries github_login = petra, nobody/nobody carries no claim and is refused fail-closed. Their passwords are published here and petra claims a GitHub login that may be someone's, so they live in a file of their own: a Keycloak you keep never gets them. KEYCLOAK_DEMO_USERS=0 in .env, before the first start, leaves them out.
1. Start Keycloak
cd deploy
cp -n .env.example .env # unless you have one: it pins the release to run (DESIGNIQ_VERSION), step 2 fills in the rest
# set KEYCLOAK_ADMIN_PASSWORD in .env to a password of yours (openssl rand -base64 18 makes one)
docker compose --profile keycloak up -d keycloakAdmin console: http://localhost:8080, user admin (or KEYCLOAK_ADMIN) with the KEYCLOAK_ADMIN_PASSWORD from .env; without one the container refuses to start and says so in its log. Keycloak listens on 127.0.0.1 only: Docker would publish a port past host firewalls such as ufw, and the Live Host reaches Keycloak over the compose network anyway. The realm and the demo users (unless KEYCLOAK_DEMO_USERS=0) are imported on the first start. Keycloak keeps its database in the volume keycloak-data, so users and changes made in the console survive a recreate of the container (an upgrade, a changed .env); a docker compose --profile keycloak down -v deletes it and the next start imports a fresh realm (Keep what you set up). A quickstart set up before 5.0 has other realm, client and audience names: see upgrading-to-5.md.
2. Point the Live Host at it
oidc mode needs the IdP and a git connection: per-repo authorization runs on the platform's credential at the git host, an identity alone can write nothing. Register a GitHub App (github-app-setup.md) or connect a GitLab (gitlab-setup.md) first; to try the login without either, run the stub provider the E2E uses (see "Verified" below).
From source, host on your machine, Keycloak in Docker:
LIVE_OIDC_ISSUER=http://localhost:8080/realms/designiq \
LIVE_OIDC_JWKS_URL=http://localhost:8080/realms/designiq/protocol/openid-connect/certs \
LIVE_OIDC_AUDIENCE=designiq \
LIVE_OIDC_CLIENT_ID=designiq-web \
LIVE_OIDC_LOGIN_LABEL=Keycloak \
pnpm live-host # plus GITHUB_APP_ID / GITHUB_APP_PRIVATE_KEY_FILE / GITHUB_APP_SLUG, or GITLAB_URL / GITLAB_TOKENBoth in containers: fill in deploy/.env: LIVE_PUBLIC_URL=http://localhost:8301 (the realm's redirect URI is exactly that; the template's https://design.example.com placeholder would be refused by Keycloak), the GitHub App or GitLab values, and the OIDC block from .env.example uncommented as is. On Linux, also create deploy/data for the Live Host's user before the first start (mkdir -p data && sudo chown 1000:1000 data && sudo chmod 700 data, see the image). Then run docker compose --profile keycloak up -d. The block differs from the source-run values in one respect: the Live Host reaches Keycloak over the compose network, so JWKS and the token endpoint go via http://keycloak:8080 (LIVE_OIDC_JWKS_URL, LIVE_OIDC_TOKEN_URL), while the issuer and the authorize URL (LIVE_OIDC_AUTHORIZE_URL) stay what the browser sees. KC_HOSTNAME is pinned in the compose file so a token minted over the container network carries the same issuer.
3. Sign in
Open http://localhost:8301 → Sign in with Keycloak → petra / petra. The overview lists the repositories petra may write, as decided by your GitHub App, so for real repositories set github_login on your own Keycloak user to your real GitHub login (admin console → Users → the user → Attributes; only admins can). With a GitLab, set gitlab_username to your GitLab username instead (and LIVE_OIDC_LOGIN_CLAIM=gitlab_username on a host with GitLab only): the overview lists the projects where you have Developer or more.
Try nobody / nobody: Keycloak signs them in, the Live Host refuses the callback with auth/missing-claim: a person without a verified git-provider login gets no session.
Logout, run from source as above, ends the designIQ session, not Keycloak's: Sign in with Keycloak right after asks for no password. On a shared device, set LIVE_OIDC_LOGOUT=idp: the Logout then goes on to Keycloak's sign-out (one confirmation) and back. In containers, the .env.example block of step 2 sets it already, with LIVE_OIDC_LOGOUT_URL=http://localhost:8080/realms/designiq/protocol/openid-connect/logout (the Live Host cannot read the discovery document at the browser's address): there Logout ends Keycloak's session too. Comment both lines out for a Logout that leaves it (Sign-out).
4. Connect an MCP client
claude mcp add --transport http designiq http://localhost:8301/mcp \
--client-id designiq-mcp --callback-port 8765The client hits /mcp → 401 + WWW-Authenticate → reads the protected-resource metadata → discovers Keycloak → runs the code+PKCE flow on the pre-registered designiq-mcp client → presents an access token with aud: designiq and github_login. With LIVE_MCP_CLIENT_ID=designiq-mcp and LIVE_MCP_CALLBACK_PORT=8765 on the Live Host (both in the .env.example block of step 2), the Connect an AI client dialog of the start page hands people exactly this command. Other clients and their redirect URIs: extending/mcp-idp-setup.md. Register each client's callback on designiq-mcp (or one client per surface). What to tell the people who connect their AI client: Connect an AI client.
5. Your real users: GitHub as the login behind Keycloak
The demo users are local accounts with an admin-set attribute. For real people, make GitHub the login method so the claim is populated by GitHub itself:
- Create a GitHub OAuth App (org → Settings → Developer settings → OAuth Apps) with the authorization callback
http://localhost:8080/realms/designiq/broker/github/endpoint(Keycloak's broker endpoint; your Keycloak URL in production). - Admin console → Identity providers → GitHub: paste client id + secret, enable.
- The mapper github_login from the GitHub profile is already there: at every sign-in it writes the verified GitHub
logininto the attribute (sync mode FORCE: a renamed GitHub account updates on the next login). - Optionally remove the username/password form from the browser flow (Authentication → browser) so GitHub is the only way in, the identity contract the Live Host assumes (ADR 0005).
This path is configuration; the automated verification below covers the local users (it has no GitHub credentials).
The GitLab username
With a GitLab, the token must carry each person's GitLab username, from a source the person cannot edit: the realm's admin-only attribute gitlab_username, mapped into the token by both clients. Name it in the Live Host: LIVE_OIDC_LOGIN_CLAIM=gitlab_username when the host connects only a GitLab, LIVE_OIDC_GITLAB_LOGIN_CLAIM=gitlab_username when a GitHub App is connected beside it (gitlab-setup.md). Ways to fill the attribute:
- By hand, per person: admin console → Users → the user → Attributes →
gitlab_username. Fine for a pilot of a few dozen people. - From your directory. When Keycloak federates the LDAP or Active Directory that GitLab signs people in with: User federation → your provider → Mappers → Add mapper, type user-attribute-ldap-mapper, LDAP attribute = the one GitLab takes its usernames from (
uidof theldap_serversblock ingitlab.rb, oftensAMAccountNameoruid), user model attributegitlab_username, Read only on. Keycloak then writes it at every sign-in. - From GitLab itself, when people sign in at GitLab with its own passwords: an identity provider of type OpenID Connect v1.0 at your GitLab (an application in GitLab's Admin area with the scopes
openidandprofile, its callback<Keycloak URL>/realms/designiq/broker/<alias>/endpoint), with a mapper Attribute Importer from the claimnickname(GitLab's username) togitlab_username, sync mode FORCE. Not part of the shipped realm, and not verified here.
Compare a few people's claims with their GitLab profile once: GitLab gives a person signing in through LDAP or SSO another username when theirs is taken. A person without the attribute is refused at sign-in on a GitLab-only host (Token carries no 'gitlab_username' claim), and sees no GitLab project on a host with both.
6. Beyond localhost
- Realm: Clients →
designiq-web→ Valid redirect URIs<LIVE_PUBLIC_URL>/auth/oidc/callback, Web origins<LIVE_PUBLIC_URL>and Valid post logout redirect URIs<LIVE_PUBLIC_URL>/, each in place of itshttp://localhost:8301entry. Without the last one Keycloak refuses the sign-out ofLIVE_OIDC_LOGOUT=idp(Invalid redirect uri) and its session stays: the next person at a shared computer is signed in as the one before.designiq-mcp→ the callbacks of the MCP clients you allow. - Compose:
KEYCLOAK_PUBLIC_URL(the issuer origin every token carries) in.env;LIVE_OIDC_ISSUER,LIVE_OIDC_AUTHORIZE_URLandLIVE_OIDC_LOGOUT_URL(<KEYCLOAK_PUBLIC_URL>/realms/designiq/protocol/openid-connect/logout) follow it. The compose file publishes Keycloak on127.0.0.1:8080: other machines reach it through your TLS proxy. The keycloak service setsKC_PROXY_HEADERS: xforwarded, so Keycloak takes the scheme and host from the proxy'sX-Forwarded-Proto,X-Forwarded-HostandX-Forwarded-For: the proxy must send them (Caddy does by default, nginx needsproxy_set_headerfor each). Without them Keycloak logs you must use proxy-headers and sets its session cookies withoutSecure. - Keycloak itself: a database, TLS and
start, as in Keycloak's own production guide. The realm export (realm-designiq.json) is yours to keep; nothing in it is specific to dev mode. Leavedesigniq-users-0.jsonout (with the compose profile:KEYCLOAK_DEMO_USERS=0before its first start), and deletepetraandnobodyfrom a Keycloak that imported them. If people sign in with Keycloak passwords rather than through GitHub or your directory, add a password policy (Authentication → Policies). - Sign out once after the move: Keycloak asks to confirm and you are back at the start page; Sign in with Keycloak then asks for the password again.
Keep what you set up
The compose profile keeps Keycloak's database in the volume keycloak-data: the realm, the users you create and every change made in the console outlive docker compose up -d, an upgrade and a recreate of the container. Only down -v (or docker volume rm) deletes them, and the next start imports the realm again. The profile stays an evaluation setup (dev mode, an H2 database in that volume): back the volume up if people depend on it, or move to a Keycloak of your own.
Keycloak imports the realm only while it does not have it. A newer realm-designiq.json (a designIQ release changed it) therefore does not reach a Keycloak that imported an older one, and neither does KEYCLOAK_DEMO_USERS once the realm is there. The admin password is set at the first start too: change it in the console (realm master → Users → admin), not in .env. A realm imported from an older realm-designiq.json, one without gitlab_username, gets it by hand in three steps:
- Realm settings → User profile → Create attribute: name
gitlab_username, who can edit: admin only, a validator pattern^[A-Za-z0-9_.][A-Za-z0-9_.-]*$. While there, opengithub_loginand give it the same pattern and a length up to 255, so it takes GitLab usernames with.and_. - Clients →
designiq-web→ Client scopes →designiq-web-dedicated→ Add mapper → By configuration → User Attribute: user attribute and token claim namegitlab_username, Add to access token on. - The same mapper on
designiq-mcp.
Verified
apps/live-host/test/keycloak-e2e.sh (needs Docker; not part of pnpm test) boots this exact compose profile, a GitHub stub and a fresh Live Host in oidc mode, then proves: the prerequisite check, the browser login through Keycloak's form, an MCP bearer from the designiq-mcp code+PKCE flow at /api/me and /mcp, a release on that identity (PR at the stub, the human as git author), and fail-closed refusal of a token without github_login at /api/me, /mcp and the browser callback.
Other identity providers
Any OIDC provider that issues audience-bound JWTs with the login claim works. The Live Host side is pure configuration. Microsoft Entra ID: entra-id.md. The requirements table and the verified WorkOS AuthKit recipe: extending/mcp-idp-setup.md; the seam for anything beyond OIDC: extending/sso.md. Connecting AI clients through any of them: Connect an AI client.