Identity and access
The Zitadel model, the login flow, claims and authorization.

One Zitadel instance (v4.x, deployed per deployment/compose.zitadel.yaml)
serves all tenants. It replaces the Keycloak draft.
Zitadel structure
Instance (single issuer: https://id.<platform-domain>)
├─ Org: fortspace-platform operators, control-plane + cockpit apps, service accounts
├─ Org: acme users, service accounts, optional Entra/Okta IdP, MFA policy
├─ Org: globex ...
├─ Project: Fortspace Cockpit (platform org; granted to nobody)
│ roles: operator
│ apps: cockpit (web, client secret)
├─ Project: Fortspace Admin (platform org; granted to nobody, ADR-023)
│ roles: superadmin
│ apps: rustfs-console, future role-blind tools
├─ Project: Fortspace Console (platform org; granted to every tenant org)
│ roles: tenant_admin
│ apps: console (planned, ADR-031)
└─ Project: Fortspace Workspace (platform org; granted to every tenant org)
roles: member, team_lead, tenant_stack
apps: meet-<slug> (user-agent, PKCE, no secret; one per tenant),
chat-<slug> (planned), maybe webmail
One project per product (ADR-032). A Zitadel project is an
audience (its id is in aud of every token issued to its apps), a role set and a grant unit (to whom
it is granted). Two products share a project only if all three are equal. All four projects have
projectRoleAssertion on; operator and superadmin are never granted to a tenant org.
| Project | Granted to | Roles | Apps | Accepted by | Login gate (role / org) |
|---|---|---|---|---|---|
Fortspace Cockpit |
nobody | operator |
cockpit |
CP API /admin/v1 |
off / off |
Fortspace Admin |
nobody | superadmin |
rustfs-console, future role-blind tools |
RustFS console | on / on |
Fortspace Console |
every tenant org | tenant_admin |
console (planned) |
CP API /tenant/v1 (planned) |
off / on |
Fortspace Workspace |
every tenant org | member, team_lead, tenant_stack |
meet-<slug>, later chat-<slug> |
go-meet, Tuwunel; CP API /internal/v1 (the stack only, pinned by sub) |
off / on |
The login gate (ADR-032 amendment). “Role” is Zitadel’s
authorizationRequired (a user needs a role on the project to log in), “org” is
projectAccessRequired (the user’s org must own the project or hold a grant on it). Zitadel’s
login v2 cannot explain either refusal: the person sees “Unknown error occurred” on the password
page and the app never hears of the attempt. So Zitadel authenticates and our products decide:
a product that checks org and role itself lets the login through and refuses with its own error
page (cockpit /auth/error?code=no_access or wrong_organization, go-meet
/api/v1.0/oidc/error/?code=no_access or wrong_organization). Only Fortspace Admin keeps the
whole gate (role and org): RustFS cannot read roles, Zitadel is its only check. Console and Workspace
keep only the org part, which every tenant org passes through its grant (and the platform org as the
owner); only a user of an org without a grant (an org made by hand, or a tenant whose saga has not
granted the projects yet) stops on Zitadel’s “Unknown error occurred” (Errors.User.ProjectRequired).
Consequence: any account of the instance can get a Cockpit-audience token, and any
user of a tenant org a Console or Workspace token, without a role; every consumer refuses them
(the claim checks below). A new role-blind product gets its own gated project and never joins
Console or Workspace.
The first tenant admin gets tenant_admin on Console and member on Workspace (otherwise go-meet
would refuse them). The stack service account keeps the tenant_stack role on Workspace as a label, but the role is
not what yields the audience: Zitadel issues the Workspace aud to any machine user of a tenant
org that asks with the :aud scope, with or without a role (spike T00 Q3). That is why the API
decides by sub, never by this role or by the audience alone.
Facts that shape the design (verified against Zitadel docs):
- A user belongs to exactly one org and cannot be moved. The same email may exist in two orgs as two accounts.
- One domain can be verified on only one org. Domain → org routing is an
application responsibility — the control plane keeps
tenant_domains. - Orgs are not separate issuers; branding/policies are overridable per org, the issuer is shared.
- Do not reuse Zitadel’s default project; create provider-owned ones and grant
them to orgs. “Require project grant / role on authentication” is a deliberate
per-project setting (
projectAccessRequired,authorizationRequired; alwaysprojectRoleAssertion: true): see the login gate above. Where it is on, a user with no authorization on the project cannot log in at all and is told nothing useful; where it is off, the app receives the login and must refuse it. - Usernames are unique per instance, not per org (the same
admin@acme.euin a second org answers 409). The control plane creates humans as<orgId>.<email>and finds them by email, case-insensitively (TEXT_QUERY_METHOD_EQUALS_IGNORE_CASE; plainEQUALSis case-sensitive). Humans with the same email in two tenants are two separate Zitadel users. - Search is eventually consistent (projection-based): a just-created org can be
missing from
_search, a deleted one shows as inactive for a moment, and commands on a just-created org can answerOrganisation not found. The adapter retries; an org name is not reused right after deletion. ListApplicationsreturns 100 entries by default and truncates silently. The adapter asks the server for the exact app name (nameFilter, exact and case-sensitive) and falls back to paging; otherwise past ~100 tenants themeet-<slug>app would be missed, duplicated or orphaned.- A project grant has no id in the v2 API: creating it again answers 409
(treated as success) and a repeat does not update the granted role set.
DeleteApplicationandGenerateClientSecretrequire theprojectId. - External IdPs (Entra ID, Okta, SAML) are configured on the tenant org; auto-create/auto-link policies are separate and default to off.
Principals
| Principal | Where | Auth | Used for |
|---|---|---|---|
| Employee | tenant org, role member |
Zitadel login (local, passkey, or federated IdP) + MFA forced (login policy) | go-meet, chat |
| Tenant admin | tenant org, role tenant_admin (Console) + member (Workspace) |
same, MFA forced | tenant self-service (console) |
| Operator | platform org, role operator (Cockpit) |
login + MFA | cockpit |
| Superadmin | platform org | login + MFA | everything: cockpit, RustFS console, Zitadel IAM_OWNER (below) |
| Guest | none | go-meet guest session (link/PIN), no Zitadel account | joining a call |
| Tenant stack service account | tenant org | JWT profile (private key) | token broker calls, event callbacks |
| Control-plane service account | platform org | JWT profile | Zitadel management API |
| Provisioner | platform org | JWT profile, narrow IAM roles | creating orgs/projects/grants |
| Platform setup | platform org (platform-setup) |
JWT profile, IAM_OWNER |
tools/prod, superadmin.sh, and the Zitadel provider of the base stack (ADR-033); key in Infisical, replaces the bootstrap PAT |
The provisioner (cp-provisioner, a machine user) needs only the instance role
IAM_ORG_MANAGER plus ORG_OWNER on the fortspace-platform org: that was
verified to be enough for the whole saga (create org, project grant, app,
machine user, authorizations, key, human user, invite, delete app, deactivate
and delete org). IAM_OWNER is not needed. It logs in with the JWT profile and
the scopes openid urn:zitadel:iam:org:project:id:zitadel:aud urn:zitadel:iam:org:project:id:<workspaceProjectId>:aud urn:zitadel:iam:org:project:id:<consoleProjectId>:aud (the zitadel
audience is what the management and v2 APIs require; the Workspace and Console
audiences are for the grants it manages on those projects). Its key file lives in
Infisical /platform/zitadel#PROVISIONER_KEY_JSON.
No resource-owner-password grant exists in Zitadel; interactive clients use
authorization code + PKCE. go-meet already supports this as a public client
(OIDC_USE_PKCE=true, no client_secret; production startup refuses a public
client without PKCE — see go-meet/AUTH.md).
Login flow (browser)
- Browser opens
https://meet.acme.<platform-domain>; go-meet redirects to/api/v1.0/oidc/authenticate/. - go-meet builds the authorization request with scopes
openid email profile urn:zitadel:iam:org:id:<acme-org-id> urn:zitadel:iam:org:project:id:<workspace-project-id>:aud urn:zitadel:iam:user:resourceowner(without the last one the resource-owner claims are absent). Theorg:idscope only routes the login to that org’s policies and IdPs; it is not the control (see step 5). - If the org has a federated IdP, Zitadel’s login redirects to Entra/Okta (org-domain scope can pre-route by domain).
- Zitadel returns a code; go-meet exchanges it (PKCE) and calls userinfo.
- go-meet validates the ID token: issuer, audience (its client id),
exp, then the tenant check, before userinfo and before any user is created: the claimurn:zitadel:iam:user:resourceowner:idmust equalZITADEL_ORG_IDof this stack, and the claimurn:zitadel:iam:org:project:<ZITADEL_PROJECT_ID>:roles(Workspace) must hold at least one role granted in that org. On failure go-meet logs a warning (suband the reason, never the token), creates no user and no session, and redirects to the failure URL. The same check runs when a refreshed ID token is parsed; a failure destroys the session. Email domain is never used for authorization. - go-meet creates its own Redis-backed
__Host-sessionidcookie (HttpOnly, Secure, SameSite=Lax, host-only) under a new session id at every login (ADR-035).
Moving between products
Every product keeps its own session and gets tokens for its own audience. With a usable
Zitadel SSO session, going from one product to another is silent: the product redirects to the
authorize endpoint with prompt=none (go-meet already does this with ?silent=true) and receives its
own tokens, with its own project audience and roles. There is no RFC 8693 token exchange and no
token is forwarded between products; products talk to each other server to server with their own
identity (the stack’s JWT-profile token, see below).
A silent login that cannot succeed never returns to the app on login v2 (prod’s login UI,
measured on v4.20.6; control-plane docs/notes/zitadel.md, “Login v1 vs v2”). Login v1 redirected
back with error=login_required; login v2 does not: with no session the person lands on the login
form, with a session of another org than the org:id scope on a bare JSON 400 (No active session found), and, on a gated project, with a session of a user without a role on a JSON 500. So a product
must only try prompt=none as a top-level redirect it can afford to lose (never in an iframe or a
background request, and never wait for an error), and the answer to a refused user is the product’s
own error page after an interactive login. Since the role gate is off for Cockpit, Console and
Workspace (and the org gate for Cockpit), a user without a role gets a code there and the product
explains.
The org:id scope only routes the login and is not a control: a foreign-org user can complete an
interactive login on the app when the client drops the scope (spike T00 Q1; on login v1 even
prompt=none with a session of another org returned a code for that org, Q2). The claim check of
step 5 is the only thing that refuses them.
Claims go-meet expects
| Claim | Source | Use |
|---|---|---|
sub |
standard | user key (meet_user.sub) |
email, name |
userinfo response only | profile (display; never used for authorization) |
urn:zitadel:iam:user:resourceowner:id |
scope urn:zitadel:iam:user:resourceowner |
tenant check (must equal the stack’s org id); :name (= slug) and :primary_domain come with it |
urn:zitadel:iam:org:project:<pid>:roles |
project role assertion | tenant check (a role granted in the stack’s org) and map roles → permissions; <pid> = Workspace |
| team ids | mapped from groups/roles → OIDC_TEAM_IDS_CLAIM (default team_ids) |
team-based access rows |
Verified against Zitadel v4.16 (details in the control-plane repo,
docs/notes/zitadel.md; prod runs v4.20.6, see 11):
- Roles claim.
urn:zitadel:iam:org:project:<projectId>:rolesis the project-specific claim; its shape is{ "<roleKey>": { "<grantingOrgId>": "<orgPrimaryDomain>" } }, so the role keys are the object keys and the inner key is the org the role is granted in (for tenant users, the resource owner). The genericurn:zitadel:iam:org:project:rolescarries the same content for human logins but is not emitted for machine tokens: consumers read the project-specific key only. The control plane ignores the generic one. - Where roles appear. Human logins through an app with
accessTokenRoleAssertion/idTokenRoleAssertionget the roles in the ID token, the access token and userinfo without extra scope. JWT-profile (machine) access tokens carry them only when the scopeurn:zitadel:iam:org:projects:rolesis requested; the per-project scopeurn:zitadel:iam:org:project:id:<pid>:rolesdoes not work. - Audience.
audis an array; it holds the project id when the scopeurn:zitadel:iam:org:project:id:<pid>:audwas requested (apps inside the project also get it without the scope; keep the scope for clarity). For app tokens the client id is inaudas well. - Profile claims (
name,email,given_name, …) are not in the ID or access token (Zitadel omits them unless “user info inside ID token” is on), only in the userinfo response. The console calls userinfo once at login to display the name; authorization never reads them. - Issuer is exactly the configured issuer, without a trailing slash.
- Machine access tokens last about 12 h (
expires_in≈ 43200); machine users are created withaccessTokenType: JWT.
The prototype’s claim handling targets Keycloak naming (
team_ids). A small adapter ininternal/domain/identitymust map Zitadel role claims into the team claim (tracked in 11, Q-04).
Machine-to-machine auth
tenant go-meet ── JWT-profile grant, RFC 7523 (sub=svc-account) ──▶ Zitadel token endpoint
◀── access token (aud = Workspace project, resource owner = acme org) ──
tenant go-meet ── Bearer ───────────────────────────────────────────▶ Control plane /internal/v1
control plane verifies: issuer, audience (Workspace), signature (JWKS),
resource-owner org id == tenants.zitadel_org_id, sub ==
tenants.zitadel_stack_user_id, slug matches the requested room prefix.
The stack requests the token with the scopes
openid urn:zitadel:iam:org:project:id:<workspaceProjectId>:aud urn:zitadel:iam:org:projects:roles urn:zitadel:iam:user:resourceowner
(audience for the Workspace project, the roles scope that machine tokens need, and the
resource-owner claims). The service account’s key file is Zitadel’s PKCS#1 PEM
inside a JSON document; clients that use jose import it through
node:crypto createPrivateKey first.
Each tenant stack gets one service account in its own org (<slug>-stack,
role tenant_stack on Workspace; its user id, the sub of its tokens, is stored as
tenants.zitadel_stack_user_id; key stored in Infisical
/tenants/<slug>/meet#ZITADEL_SA_KEY, injected as a file). Rotating the key =
new Zitadel key + Infisical update + redeploy; old key deleted last.
How the control plane verifies a token
- Signature via the issuer’s JWKS (
<issuer>/oauth/v2/keys), algorithm RS256 only, clock tolerance 5 s,issexact. The audience is checked per surface: each surface has its own verifier and accepts only its own project id, so a token valid for one surface is a 401 on another (wrong audience), not a 403. - The tenant id is never read from the request. Roles are read only from the project-specific claim of the surface’s own project.
| Surface | aud must contain |
Principal rule |
|---|---|---|
/admin/v1 |
Cockpit project id | resource owner = platform org and role operator in the Cockpit roles claim |
/internal/v1 (broker) |
Workspace project id | resource owner = a tenant’s zitadel_org_id and sub = that tenant’s zitadel_stack_user_id (the tenant_stack role is not checked: a human holding it is still a 403) |
/tenant/v1 (not built yet) |
Console project id | resource owner = a tenant org and role tenant_admin for that org in the Console roles claim |
- A failed discovery or JWKS fetch (identity provider outage) is a 503, not
a 401, and is never cached: the next request retries. Wrong algorithm,
unknown
kid, expired, wrongiss/audare 401; a valid token with the wrong org, role or stack identity is 403. - Auth runs before body parsing and validation, so an unauthenticated caller never sees a schema error.
Authorization layers
| Layer | Decision | Enforced by |
|---|---|---|
| Who is the user and which tenant? | org id + roles in verified token | go-meet / Tuwunel / console |
| May this user do X in this room? | room/team access tables, owner/admin roles | go-meet (access domain) |
| May this stack act on LiveKit room R? | R starts with <slug>__ for the caller’s verified tenant |
token broker |
| May this stack touch bucket B? | scoped S3 key limited to tenant-<slug> |
RustFS policy |
| May this operator do Y? | platform-org role + audit | control plane + console |
Logout and session lifecycle
- Ending the Zitadel session (
end_session) does not revoke the refresh tokens of any app: the SSO session ends, but each product’s refresh token keeps working (spike T00 Q5). Each product must end its own session: back-channel logout (below), a revoked refresh token on logout (as the cockpit does) and a short re-check on refresh. Back-channel delivery is untested on dev (Zitadel’s deny list refuses the dev hosts, T00 Q6). - RP-initiated logout and back-channel logout are implemented in go-meet
(
logout_tokentyplogout+jwt, replay cache). Zitadel must be configured to send back-channel logout per application. Zitadel validates thebackChannelLogoutUriagainst its outbound deny list (ZITADEL_HTTPCLIENT_DENYLIST: loopback, RFC 1918, link-local, CGNAT) and resolves the host, so the call fails withErrors.Project.App.Blocked.BackchannelLogoutURLfor a tenant host that is private or not resolvable from Zitadel. The provisioner therefore sets the URI only when the config flagbackchannelLogoutis on (production, where tenant hosts resolve publicly) and omits it in dev. - Suspending a tenant: control plane deactivates the org (Zitadel blocks new logins), and instructs go-meet to flush sessions; existing LiveKit tokens die within their TTL.
Operator login (cockpit)
The cockpit is an OIDC web client (cockpit, renamed from admin-console, client-secret basic
authentication, code + PKCE, JWT access tokens, role assertion on). Its server
performs the login and keeps the tokens in a sealed session cookie
(iron-session, HttpOnly, SameSite=Lax, chunked because the sealed session is
close to the 4 KB limit); the browser never sees a token. Facts verified with a
real login:
- The login asks for
openid profile email offline_access, the Cockpit project audience scope andurn:zitadel:iam:org:projects:roles. The roles claim arrives in the ID and access token even without the roles scope (project role assertion plus the app’s role assertion); the scope is requested anyway and is harmless. The cockpit only needs the role; the API (not the cockpit) checks the platform org. - The cockpit decides who is an operator with the API’s own rule (
checkPlatformRole,@fortspace/schemas), at login and on every refresh: the resource owner must be the platform org (ZITADEL_PLATFORM_ORG_ID, required at startup) andoperatormust be granted in that org. A user of another org gets/auth/error?code=wrong_organization, a platform user without the rolecode=no_access(403, no cookie, the session destroyed). A missing resource-owner claim or an empty platform org id refuses everyone. Zitadel does not gate the Cockpit project (see the login gate), so this check is what every other account meets. - Roles are re-checked from a refreshed ID token at most every 10 minutes. A
dead refresh token (unknown or revoked) is answered
400 invalid_requestwithErrors.User.RefreshToken.InvalidorErrors.OIDCSession.RefreshTokenInvalid, notinvalid_grant; only these end the session, any other refresh failure is transient (503). - Logout is
POSTonly: it revokes the refresh token, clears the cookie and redirects to Zitadel’send_session_endpoint(id_token_hint+ registeredpost_logout_redirect_uri). The cookie is stateless, so a copied pre-logout cookie keeps working until its next refresh, which the revoked refresh token then ends.
Login names. A seeded user (the bootstrap operator) logs in as
<username>@<orgPrimaryDomain>; a user created through POST /v2/users/new
with username: x logs in with the bare x. Ask GET /v2/users/{id} for
loginNames instead of guessing.
Tenant admin invitation
A human created with POST /v2/users/new is immediately USER_STATE_ACTIVE;
Zitadel 4.16 has no “invited but not consumed” state, so a never-invited and an
invited user look the same. POST /v2/users/{id}/invite_code { sendCode: {} }
creates the code and mails it; a new code overwrites the previous one. The
deprecated invite_code/resend is the only probe for “was an invite
delivered”: it succeeds only if a code exists and was sent, and answers
400 Code not found for a user that was never invited. It also re-delivers the
mail, so there is no read-only check.
Policy: the invite is re-sent on every run of the activate step (saga retry, reconciliation, re-provisioning of the same tenant). A duplicate invitation is harmless; a lost one blocks the tenant’s first login. Recording “invited” in the step output was rejected because it trusts our own state about a vendor whose state we cannot read back (see 11, ADR-019).
Login policy
Zitadel applies to a login the policy of the org it happens in: the org’s own, or the instance
default when the org has none. On a fresh v4.20.6 that default lets anybody self-register
(allowRegister on), says whether an account exists, does not force MFA (the setup can be skipped
for 30 days), and ends a login that has no app to return to on a “You are signed in” page with
nowhere to go. Before plan step W6 every tenant org inherited it: an unknown or foreign user was
offered “Register” inside the tenant org.
| Where | Who sets it | allowRegister |
ignoreUnknownUsernames |
defaultRedirectUri |
MFA |
|---|---|---|---|---|---|
| Instance default | base stack (zitadel-login-policy-instance) |
off | on | https://cockpit.<domain>/ |
forced: TOTP or security key, passkeys allowed, no skip |
fortspace-platform |
base stack (zitadel-login-policy-platform) |
off | on | https://cockpit.<domain>/ |
forced: TOTP or security key, passkeys allowed, no skip (unchanged) |
| Each tenant org | provisioning saga, step identity (ensureLoginPolicy) |
off | on | https://meet.<slug>.<domain>/ |
forced: the factors on offer copied from the instance default (at least TOTP and security key), no skip |
MFA is forced for every tenant user (decision Q2, 2026-12-03), in both places so nobody
escapes it: the policy the saga gives each new tenant org, and the instance default, which every
org without a policy of its own inherits (tenant orgs provisioned before W6, any org made by hand).
The platform org’s policy already forced it and is not touched beyond defaultRedirectUri.
- What “forced” is here:
forceMfaon: every login method needs a second factor, external identity providers included.forceMfaLocalOnlyis off: on its own it exempts IdP logins (a customer’s Entra or Okta), so it is never used instead.mfaInitSkipLifetime0: the setup page has no “Skip” (a skippable setup is not forced). A passkey login (user verification) counts as multi-factor and needs nothing more (login v2,shouldEnforceMFA). - Second factors offered: TOTP (authenticator app) and security keys (U2F); multi-factor:
passkeys (
U2F_WITH_VERIFICATION,passwordlessTypeallowed). No SMS or email codes. - Existing users without a second factor: at their next login, after the password, they land on
“Set up 2-Factor” (
/mfa/set?force=true) with no way past it but setting one up; then the login goes on (verified on dev). Nobody is locked out, nobody gets in without one through a new login; whether an SSO session made before the change is re-checked when reused was not tested. - Enforcement point: the hosted login (login v2,
checkMFAFactors) applies the policy; we run the stock one. Whether Zitadel’s API alone refuses a session without a second factor (a custom login UI) was not tested. - Machine users (
cp-provisioner,platform-setup,login-client, the tenant stack accounts) authenticate with JWT profile keys or PATs and never see the login UI: the policy does not apply. - Every field is written. An org policy replaces the instance one as a whole; the saga owns
registration,
ignoreUnknownUsernames, the redirect and the MFA fields, and copies every other field (passkeys, lifetimes, the factors on offer, identity providers) from the policy in force. A later change of the instance default does not reach orgs that already have their own policy, and the saga does not revisit them either: a provisioning retry only resumes a failed run and skips the steps that succeeded, so an ACTIVE tenant’s org keeps the policy it got. Such an org is fixed by hand (runbook). No tenant org has its own policy yet; a reconciling job is worth writing the next time the saga’s rule changes while tenants exist, not before. - Identity providers: the base stack declares none on the instance and platform login
policies, and the provider (zitadel/zitadel v3.8.8) detaches every IdP it does not declare when
it applies them. Attaching an IdP there by hand is undone by the next deploy: declare it in the
stack first.
scripts/zitadel-login-check.shlists them and exits 2. ignoreUnknownUsernames: an unknown name, a user of another org, a deactivated or locked user and a wrong password all get the same password page and one message. Nobody can probe which accounts exist; a deactivated user is no longer told so (decision D2: accepted).- The invitation still works: the tenant admin (and later each user) is created by us and gets
an invite link; it sets a password (or a passkey), then a second factor, with registration off,
and logs in (verified on dev, login v2). Self-service signup of a company goes through the control
plane’s
/public/v1(ADR-031), never through Zitadel’s registration. - Lost second factor: a superadmin removes it in the Zitadel console (the user, Authentication
factors or Passkeys), or with
DELETE /v2/users/{id}/totp,/u2f/{id},/passkeys/{id}; the user sets a new one up at the next login. Runbook: 12. - Texts: the login page says “Sign in with the account your organization gave you.” and the
password page’s failure message tells what to check and to ask “your administrator” (en, fr;
decision D4), set over Zitadel’s own texts (
DefaultHostedLoginTranslation, no fork). They show on pages without an org (cockpit, RustFS console). Zitadel v4.20.6 does not pass the instance’s texts on to an org (upstream bug, Q-20), and a tenant login page is an org page (org:idscope), so tenant pages show Zitadel’s “Enter your login details.” / “Failed to authenticate.”. Setting texts per org needsiam.policy.write, an instance permission: decision Q1 is not to grant it tocp-provisionerand to wait for the upstream fix; the saga sets no texts. - The login app caches settings for 15 minutes and texts for an hour: a change shows up then, or after a restart of the login container.
Measured outcomes (the recorder record:zitadel-login in the control plane, and the two-tenant
e2e): control-plane/docs/notes/zitadel.md, “Tenant login policy”.
OIDC coverage and superadmins
Every human login goes through Zitadel, except where the product makes that impossible:
| System | Login | Notes |
|---|---|---|
Cockpit (cockpit.) |
Zitadel OIDC, role operator |
cockpit app, project Fortspace Cockpit |
RustFS console (storage.) |
Zitadel OIDC, role superadmin |
app rustfs-console, project Fortspace Admin; off until base:rustfsOidc is set; root key is for the control plane only |
| go-meet, Tuwunel, Stalwart (planned) | Zitadel OIDC | per tenant org |
| Infisical | local admin + TOTP | generic OIDC/SAML is a paid feature; nobody needs the UI day to day (the control plane uses machine identities) |
| Coolify | local account | hosts Zitadel: it must work when Zitadel is down; keep one account, password in the offline escrow |
Mailpit (mail.) |
none of its own; optional OIDC login in front (base:mailpitAuthEnabled) |
the Traefik plugin traefikoidc against the operator’s external pocket-id (not Zitadel: the mails hold Zitadel’s own login codes), an allow-list of emails; holds Zitadel’s and Infisical’s mails; goes away with the prod EU SMTP relay |
| Zitadel itself | local, MFA enforced | login policy of the platform org: TOTP or passkey, no self-registration, no postponing the setup |
Why a separate project for admin UIs. The Console and Workspace projects are delegated to tenant
orgs (roles tenant_admin, member, …). A tool that cannot interpret Zitadel’s roles claim
(an object {role: {orgId: domain}}, not a list) is configured with a fixed policy for
everyone who logs in. RustFS is such a tool (RUSTFS_IDENTITY_OPENID_ROLE_POLICY=consoleAdmin,
verified against 1.0.6: its claim mapping accepts only a string list). Zitadel therefore does
the gatekeeping: the app lives in Fortspace Admin (authorizationRequired +
projectAccessRequired), which is never granted to a tenant org, so only users holding the
superadmin role can complete the login. It is the only project that keeps the role gate; a user
without the role sees Zitadel’s “Unknown error occurred”, which RustFS cannot improve. Callback: https://storage.<domain>/rustfs/admin/v3/oidc/callback/default
(RustFS’ admin API, pinned with REDIRECT_URI_DYNAMIC=false); the app asks for userinfo in the ID
token so that preferred_username is present.
The ID token’s audience. Zitadel puts the app’s project id in aud next to the client id,
and RustFS rejects every audience it was not told to trust (“Invalid audiences: <project id> is
not a trusted audience”): the code exchange fails with AccessDenied. The console therefore gets
RUSTFS_IDENTITY_OPENID_OTHER_AUDIENCES = the Fortspace Admin project id, written into the
stack config (base:rustfsOidc.projectId) by the platform setup. The same applies to any other
Zitadel app: the project id has to be listed, or the login fails after the redirect.
Superadmin is a human of the fortspace-platform org with the whole set:
| Right | Where |
|---|---|
IAM_OWNER |
Zitadel instance (orgs, IdPs, policies) |
operator |
project Fortspace Cockpit (cockpit, CP admin API) |
superadmin |
project Fortspace Admin (RustFS console, future admin UIs) |
| org admin | Infisical (invited by hand in the UI; password + TOTP) |
bastion/scripts/superadmin.sh grant|revoke <email> applies or removes the Zitadel part
(Infisical’s org invite refuses machine identities, so that one is manual)
(control-plane tools/prod, superadmin). The seeded operator is the first superadmin. New
role-blind admin UIs join by adding an app to Fortspace Admin; nothing else changes. The
cockpit is not in Fortspace Admin: RustFS cannot read roles, so every cockpit operator
would otherwise get the RustFS console (ADR-032).
The Login UI signs its sessions
Since v4.19.2 (fixing GHSA-jh92-5mrj-p2w2, an account
takeover through the unsigned Login v2 session cookie) the Login UI signs the session cookie it
puts in the browser. The signing key is a dedicated secret, ZITADEL_SESSION_COOKIE_SECRET
(32+ characters, the same on every replica), generated by the base stack and exposed in the stack
output (zitadel.sessionCookieSecret) so it can be escrowed. Without it the Login UI would derive
the key from the login-client PAT and log a deprecation warning — then regenerating that PAT would
sign every user out. After an upgrade to v4.19.2 or later, existing cookies carry no signature and
are ignored: everyone signs in once more (application sessions and issued tokens are unaffected).
No powerful credential at rest. The first-instance machine user bootstrap-admin has a
PAT valid until 2099 on the zitadel-bootstrap volume. The first platform-setup run
creates the platform-setup machine user (IAM_OWNER, key in
/platform/zitadel#SETUP_KEY_JSON), proves the key works, then revokes the PAT and
deletes admin.pat; later runs and superadmin.sh use the key and need no ssh. Trade-off: the
key sits in Infisical, readable by cp-worker (org admin there). The worker already holds the
narrower cp-provisioner key and the Coolify token, and the worker is the most privileged
process anyway; reducing the setup key’s reach means moving it to a project the worker cannot
read (open: only worth it once a second Infisical admin tier exists). ADR-023.
The Zitadel objects are resources of the base stack
With base:identityEnabled the platform’s Zitadel objects are Pulumi resources of the base
stack, not the result of a script (ADR-033): the four projects and their roles, the cockpit and
rustfs-console apps, the cp-provisioner machine user with its two administrator roles and its
key, the platform org’s login policy (MFA forced, no self-registration), and the instance default
login policy and login texts (login policy). The Zitadel provider
authenticates with the platform-setup key, held as the secret stack config base:identityAuth:
the credential that creates the objects is therefore not itself one of them. Three things stay
outside on purpose: that machine user, the first PAT and its revocation, and the human superadmin
grants (superadmin.sh).

Zitadel shows an OIDC client secret and a machine key once. An app adopted from an existing install therefore has no secret in the state; the cockpit’s and the RustFS console’s client secrets stay in stack config and the stack only reads their client ids. The provisioner key is created again by the stack (the old key stays valid until it is deleted by hand).
Customer SSO onboarding (self-service)
Tenant admin (console) → “Connect Entra ID / SAML” → control plane calls
Zitadel to add the IdP on the org, verifies the domain, stores the domain in
tenant_domains, and enables login routing. Failures are surfaced; the IdP is
only activated after a test login by the admin.
Custom domains
Decision (2026-11-27, ADR-032): one issuer, custom domains for products only.
The IdP stays at https://id.<platform-domain> for every tenant. A tenant may bring a domain for its
products (meet.acme.com, later chat.acme.com); it does not get its own login host (id.acme.com).
The login page is branded per org (logo, colours) so it still looks like the tenant’s.
Why this works with the model of this page:
- Login and silent SSO are full-page redirects. A top-level GET to
id.<platform-domain>carries Zitadel’s session cookie even when the product is on another registrable domain (SameSite=Lax allows it), soprompt=nonebetween a tenant’s products keeps working. Renewal through a hidden iframe would not (third-party cookies), and is not used. - The callback is a GET back to the product host, so the product’s own session cookie
(
__Host-sessionid; it holdsstate,nonceand the PKCE verifier) is sent. go-meet then moves the login to a new session id, so an id planted before the login is worthless (ADR-035, 13). Do not switch toresponse_mode=form_post(a cross-site POST would not carry a Lax cookie). - Issuer, audiences, the org check and back-channel logout do not depend on the product’s host.
Why not an IdP on the customer’s domain: Zitadel answers 404 (“Instance not found”) on a Host it does
not know, and never changes its issuer according to the request’s Host, X-Forwarded-Host or
Forwarded (spike T00 Q7). A login host on a customer domain would therefore have to be a registered
instance domain and would be another issuer that every product and the
control-plane API must trust; SSO sessions split per host (the cookie is per IdP host); each domain
needs its own certificate, router and Zitadel domain configuration; and it is not a tenant boundary
(the instance is shared, the org check stays the real control). It would also reverse the “single
issuer” fact at the top of this page. Keep it as a possible enterprise option.
What a verified custom product domain requires (not built; tracked with ADR-031’s open “custom domains”):
tenant_domains(control plane): record the domain once its ownership is verified (DNS TXT).- Zitadel: add the domain’s
redirectUris,postLogoutRedirectUrisandbackChannelLogoutUrito the tenant’s app (keep the<slug>.<platform-domain>ones; both work). A repeated grant or app update must be explicit: see the Zitadel quirks above. - go-meet stack: add the host to
CSRF_TRUSTED_ORIGINSand the redirect allow-list (OIDC_REDIRECT_ALLOWED_HOSTS), and renderEMAIL_APP_BASE_URLwith it. - Traefik: a router and a certificate for the domain on the tenant’s stack.
- Cookies: nothing to do (product cookies are host-only,
__Host-over https: ADR-035), but the login must always start at the product’s public host, never at the platform host. - Tenant admin experience: the domain flow lives in the console (
/tenant/v1), not in the cockpit.