Enterprise administration
The engine serves a static React console and provider-neutral APIs. Customer administrators can configure SSO, directories, people, permissions, and audit access without deployment file edits. The operator prepares the runtime, PostgreSQL, HTTPS origin, and secret references. Select native permissions for the compact installation. AuthZEN and identity brokers remain optional. See compact startup and React embedding.
Optional broker interoperability deployment
Run
npm ci.Run
npm run build.Start the deployment:
docker compose -f compose.yaml -f deployments/compose.administration.yaml up -d --build --waitOpen the application.
Select Recovery owner sign-in.
Enter
recoveryanddev-only-recovery-owner-password.Select Open administration.
The portal uses port 3010.
Its direct URL requires a session created through the application.
The fixture creates dedicated oe-v04-idp and oe-v04-broker realms.
All fixture credentials are public development values.
Passwords and MFA stay in the identity provider.
Existing PostgreSQL volumes require three additional databases:
docker compose exec postgres createdb -U enterprise enterprise_administration
docker compose exec postgres createdb -U enterprise enterprise_example_administration
docker compose exec postgres createdb -U enterprise enterprise_portalConnect a customer SAML provider
- Open Single sign-on.
- Paste the customer's IdP metadata into SAML metadata XML.
- Enter its administrator-controlled immutable subject attribute.
- Select Create SAML draft.
- Register the service provider with the customer IdP. Copy the entity ID and ACS URL from the page, or give the IdP the metadata URL.
- Select Validate for the draft.
- Examine the entity ID, signing certificate fingerprints, and validity dates.
- Select Test login.
- Select Continue to identity provider.
- If another account is signed in, open the link in a private browser window.
- Sign in with a customer account.
- Return to the original portal window.
- Verify that the configuration history shows tested and verified identity mapping. If the test failed, the history shows the reason; see diagnose failed sign-ins.
- Select Activate.
For the reference IdP, obtain metadata from its descriptor.
Use directory_subject, username alice, and password dev-only-saml-alice-password.
The fixture's upstream identity attribute contains employee-alice.
SCIM externalId must contain that same immutable value.
Matching email addresses do not merge identities.
A login test proves signed identity claims but does not provision a membership or replace the administrator's session.
Native drafts keep isolated SP request state and pinned IdP metadata. The optional broker adapter gives each draft a separate alias. Draft validation and testing cannot overwrite the working alias. The adapter requires signed assertions and signature validation. It rejects DTDs, oversized metadata, expired certificates, and mutable identity attributes. Encryption-only certificates do not become signing keys.
For certificate renewal, create another draft with the updated metadata. Complete its login test, then activate it against the current version. During the transition, publish overlapping valid signing certificates at the upstream IdP. Keep old upstream keys available until required rollback and in-flight login windows end.
Configure OIDC
Use the OIDC form to supply the issuer, client ID, client secret, and immutable subject claim. Register both runtime callback URLs at the provider, with the organization ID as the last path segment:
https://runtime.example/v1/auth/callback/{organization_id}
https://runtime.example/v1/administration/callback/{organization_id}The Single sign-on page shows both URLs for the organization, ready to copy.
Each organization has its own callback URLs, so an authorization response from one customer's issuer cannot complete a login started for another issuer.
The runtime rejects a response on the wrong callback URL before it sends the code to a token endpoint.
Native SAML uses /saml/{organization_id}/acs and the stable metadata identifier /saml/{organization_id}/metadata.
The optional broker adapter retains its OIDC callback URLs.
The runtime verifies discovery, issuer, signatures, audience, nonce, PKCE, authentication time, and the configured identity claim. Each discovery document, signing key set and token response may be at most 1 MiB, including when the provider sends it in chunks. Customer-controlled discovery and endpoints require public HTTPS addresses outside development mode. The network adapter rejects private and link-local destinations at connection time. Deployment-owned issuers remain explicit infrastructure trust decisions.
Verify a domain and enforce SSO
- Open Domains.
- Enter the DNS domain.
- Select Create DNS challenge.
- Publish the exact TXT name and value in authoritative DNS.
- Select Verify DNS.
- Create a connection draft with that routing domain and SSO enforcement selected.
- Complete its login test.
- Sign in through the independent recovery connection as an active local owner.
- Activate the tested draft.
A challenge expires after seven days.
Successful verification grants a 30-day routing lease.
Keep the TXT record published: in the last seven days of the lease, the runtime looks the record up again and extends the lease by 30 days while it still matches.
A failed check is retried every six hours until the lease ends, and the portal shows why it failed next to the domain.
Each renewal is audited as administration.domain.renewed with the actor system:runtime.
Removing the TXT record therefore ends routing when the current lease runs out; delete the domain in the portal to end it at once.
The runtime performs a real DNS TXT lookup; portal input alone cannot establish ownership.
Domain routing requires both an unexpired proof and the active configuration's matching domain.
The application uses routing through POST /v1/administration/login-route, or by sending people to the runtime's email page (sign in with a work email).
Removing or replacing the proof immediately removes routing eligibility.
Enforcement ends older customer sessions and pending exchanges. The independent recovery owner retains access. Other recovery-connection users cannot bypass enforcement. A pending owner invitation permits recovery authentication, but grants no membership until normal invitation acceptance.
The recovery connection can be the deployment's local account connection.
Set the tenant's recovery_connection_id to local_authentication.connection_id; recovery owners then sign in with a local password, and two-step verification if the organization requires it, while everyone else uses the customer connection.
Local sign-in policy
Sign-in policy shows whether members may use local passwords, whether local sign-in needs two-step verification, and how many members have linked the customer connection.
Administrators with sso:write change the policy there.
Turning local passwords off ends local sessions at once, so first check that the members who need access have linked, or ask an operator to run a bulk migration.
The provider-migration runbook describes each step.
The local test uses an authoritative DNS fixture at port 8085. Only its protected development API publishes records. This fixture is separate from the production validation path.
Connect SCIM
- Open Directories.
- Create a directory for the active customer connection.
- Create a named credential.
- Copy the displayed credential into the SCIM client.
- Copy the directory's displayed endpoint into that client.
- Provision users and groups.
- Select Edit directory on its row. Review the saved default role and both sets of group mappings. Map immutable upstream group IDs to roles or existing teams, then select Save directory.
- Examine the directory's latest success or error and request ID.
A credential belongs to one directory and organization.
Each credential appears once; storage contains its hash.
A credential can expire after 90 days or one year, or you can leave it without an expiry.
Through the API, expires_in_days takes 1 to 730.
An expired credential gets 401 like a revoked one, and the directory's last error says to update the SCIM client credential.
Selecting immediate rotation revokes all previous credentials, including the deployment credential.
Revocation takes effect at the next credential check.
A restart preserves portal-managed keys and mappings.
A deployment YAML mapping no longer overwrites that directory.
Only administrators who hold the required role permissions can change a delegated mapping.
The API returns configuration.version in the directory list. Send that version with the full directory configuration on update. Omit the version or send zero to create a new directory.
A concurrent mapping change returns HTTP 409. Reload the directory and reapply the intended edit to the latest mappings.
Directory identity connection and issuer cannot change after registration.
A directory ID in the deployment configuration belongs to the organization configured for it.
Another organization cannot create a portal-managed directory with that ID.
If one already manages it, startup fails and names both organizations.
Identity migration requires a separate connection and an explicit migration procedure.
Operate people and permissions
People and sessions shows memberships, pending invitations, provisioning sources, and authorized session metadata.
Local membership roles use the existing owner and delegation protections.
Directory-owned fields remain read-only.
Inviting, reissuing and cancelling require both invitations:write and members:write. The People form offers the roles the current administrator can delegate, including custom roles. Reissue a pending or recently expired invitation to rotate its link while keeping the recipient and role. Set local_authentication.invitation_accept_url for a copyable application link and optional SMTP delivery.
Suspend locally revokes sessions and pending exchanges atomically.
A subsequent SCIM active: true update cannot clear that suspension.
Resuming local access does not reactivate an upstream-deactivated identity.
Session revocation can target one session or all access for a person.
Connected applications appears when the deployment runs the OAuth issuer.
It lists the applications that people in the organization authorized, with their active grants, the resource and scopes of each grant, and the connection the person signed in with.
Administrators with applications:write can revoke one grant or every grant of an application, and can block an application for this organization.
A block revokes the application's grants here and refuses new authorizations here; other organizations keep their own choice.
Operators register, disable, and delete applications for the whole deployment through the operator API.
Use Roles and groups and Resources and sharing in the administration portal. Their forms carry the current permissions revision.
For policy versions, open /permissions in the Fastify example with ENTERPRISE_PERMISSIONS=true. Under Policy versions, download the current bundle, import the edited bundle, select Compare decisions, review the current and candidate decisions, and select Activate validated version.
Applications can expose this workflow through the policy version SDK. After a conflicting change, export the current bundle again and review the new draft.
Trusted application attributes remain owned by the application backend.
Access diagnostics shows role and grant paths, inherited relationships, policy conditions, and synchronization state. Supply a target session ID to inspect that user's current authentication context. Without a target session, authentication-dependent conditions remain missing. The diagnostic never borrows the administrator's MFA state or returns attribute values.
Integrate an application
The backend needs portal:entry for the allowed organizations.
The portal service needs a separate key with only portal:exchange.
A service key alone cannot create administrator authority.
const entry = await enterprise.administration.portal.create({
organizationId: verifiedSession.organization_id,
sessionToken: serverHeldRuntimeToken,
operations: [
"administration:access",
"administration:read",
"domains:write",
],
});
// Redirect from a CSRF-protected backend operation.
response.redirect(303, entry.entry_url);An empty operation list requests all currently permitted portal operations.
The entry code expires after 60 seconds and permits one exchange.
The administration session expires when its configured lifetime or its parent session ends, whichever comes first.
The deployment operator can set administration.session_ttl_seconds in the runtime configuration.
It defaults to 1800 (30 minutes) and accepts 1 to 86400 seconds.
The runtime applies the setting to new sessions after restart.
The console displays the expiry of its administration session in the browser's time zone.
Current membership, session, permission, organization, and operation checks apply to every request.
Later permissions do not expand the child credential's original operation scope.
Closing the portal ends only its child credential.
The reference app requires ENTERPRISE_ADMINISTRATION=true and ENTERPRISE_ADMIN_PORTAL_ORIGIN when administration is enabled.
Its form policy permits the configured portal redirect.
The portal uses an opaque HttpOnly, SameSite=Lax cookie and encrypted server-side token storage.
Set HTTPS origins for Secure cookies.
The portal's forms require an exact Origin and a session-bound CSRF token.
Entry responses suppress referrers and remove the code from subsequent URLs.
The portal serves plain HTTP, so an HTTPS origin needs a TLS-terminating proxy in front of it.
Set PORTAL_TRUST_PROXY so the portal accepts X-Forwarded-Proto from that proxy.
Without it, the portal does not send its Secure session cookie, and every entry ends on the Open administration page.
PORTAL_TRUST_PROXY is unset by default, and the portal then ignores forwarded headers.
It accepts these values:
- A hop count, such as
1for a single proxy. - A comma-separated list of proxy addresses or subnets, such as
10.0.0.5,10.1.0.0/16. The namesloopback,linklocal, anduniquelocalalso work. true, which trusts every hop. Use it only when clients can reach the portal through the proxy alone.
The portal logs a warning at startup when PORTAL_ORIGIN uses HTTPS and PORTAL_TRUST_PROXY is not set.
An invalid value stops startup.
Applications with their own interface can use enterprise.administration directly from their backend.
The generated OpenAPI contract includes all administration routes.
The API remains independent of the portal's HTML and Keycloak's REST representations.
Turn on administration for a customer
The deployment file's administration.tenants lists the organizations it administers.
An operator can also turn administration on for an existing organization, without editing the file or restarting:
curl -X PUT "$RUNTIME/v1/operator/organizations/org_acme/administration" \
-H "authorization: Bearer $OPERATOR_KEY" \
-H 'content-type: application/json' \
-d '{}'The request needs the organizations:manage operator scope.
Every field in the body is optional:
customer_connection_iddefaults tocustomer-<organization ID>. From then on it belongs to this organization.recovery_connection_iddefaults to the local account connection when local accounts serve the organization. Otherwise, name an OIDC connection that lists the organization.infrastructurenames an identity broker profile. Without one, the runtime serves SAML itself.
The runtime applies the same checks as for a tenant in the file.
The replica that takes the request applies it at once, and the others pick it up within a second.
DELETE on the same path turns administration off.
SSO enforcement stops and the portal sign-in link stops working.
The organization's SSO configuration and connection reservations stay, ready for when you turn it on again.
A tenant in the deployment file can only be removed there, so the API answers 409 Conflict for it.
GET /v1/operator/organizations lists organizations with their member count and administration state.
search matches part of the ID, name or slug, and after takes the previous page's next_after.
GET /v1/operator/organizations/{org} adds the SSO configuration, the last successful and refused sign-ins, the signing certificate expiry, and each SCIM directory's last sync and last error.
Both need the organizations:read scope.
The operator console's Organizations panel shows the same data and turns administration on and off.
Send administrators the portal link
While administration is on, the organization detail includes portal_sign_in_url, which is <public URL>/admin/sign-in?organization=<ID>.
Send it to the customer's administrators.
The page offers the organization's SSO connection once its configuration is active, and its recovery connection.
After sign-in, the runtime checks that the person may open the admin portal and sends them in with the operations they hold.
Anyone else sees a refusal, and the session from their sign-in ends at once.
The link is not a secret, because only people who can sign in to the organization and administer it get through.
Administrators can use this sign-in directly on the runtime.
The same administration.session_ttl_seconds setting applies to both entry methods.
Configuration precedence and activation
Deployment files define providers, service scopes, allowed origins, recovery connections, and infrastructure credentials. Each customer connection ID belongs to one organization. A configured OIDC base for that customer must serve only that organization. Customer IDs cannot overlap local, recovery, or other customers' connections. Startup records these trust namespaces in PostgreSQL before serving requests. Reservations persist after configuration removal and cannot change owners. Use a new connection ID when moving between deployment-controlled and customer-controlled authentication. A persistent active organization version overrides only its designated customer connection and SSO routing behavior. Without an active override, deployment defaults apply. Custom roles and portal-managed directory definitions also persist in PostgreSQL. For an existing organization, rerun the bootstrap command to apply reviewed changes to deployment-owned built-in roles. Bootstrap does not overwrite persisted custom roles.
Import deployment configuration creates a persistent copy of the current connection and protects its client secret. Migration preserves the deployment's existing upstream restriction and does not enable enforcement. Its history records migration separately from a successful customer login test. Create and test a new draft before introducing enforcement.
Activation requires the expected current version, a successful test within 24 hours, and live independent recovery access. The runtime stores activation intent before contacting identity infrastructure. A database claim coordinates concurrent workers and expires after 120 seconds. The maintenance worker resumes interrupted intent after the lease expires. A worker with an expired or replaced claim cannot move the active pointer. The commit rechecks the administrator, current version, and recovery path.
A provider failure keeps the previous active pointer and records a failed attempt. Correct the provider, repeat the test when required, and select Activate again. A failed or interrupted operation can leave an unused staged broker alias. These aliases do not select the active configuration. Retain aliases needed for rollback; remove unused aliases through infrastructure maintenance.
A prior version can be restored after its validation and test requirements pass again. Restore recovery configuration is owner-only and disables enforcement while restoring deployment defaults. This operation does not restore passwords or change the external provider's user database. Already-running application operations follow the consistency boundaries in the permissions guide.
Protect secrets and recovery
Generate ADMINISTRATION_SECRET_KEY from 32 random bytes encoded as unpadded base64url.
Keep this key outside the database and preserve it in protected deployment backups.
Stored customer client secrets use AES-256-GCM and are bound to the organization, secret reference, exact issuer
identifier, and client ID. A draft can reuse a reference for the same issuer and client.
Supply a new client secret to change either value.
Re-enter the client secret in a new draft if the existing credential predates recipient binding.
SAML private keys stay in the external identity infrastructure.
The portal's infrastructure service key and session secret stay on its server.
To rotate the master key, set secret_key_env to the new key and add the old key's variable to previous_secret_key_envs.
The runtime encrypts new values with the new key and decrypts stored values with either key.
For a rolling deployment, first add the new key as a previous key on every replica, then make it current.
Then run enterprise-runtime reencrypt to seal every stored customer secret with the new key, and remove the old key.
See rotate master keys.
SCIM keys use the portal's credential rotation operation.
The reference Keycloak adapter needs manage-identity-providers and view-identity-providers in the selected realm.
The pinned Keycloak version also requires its kc-admin-api scope and Admin API audience mapper.
The fixture attaches that optional scope and the adapter requests it during client-credentials exchange.
The adapter does not require master-realm credentials or user/password management authority.
Keycloak's built-in "first broker login" flow offers to link a new broker identity to an existing account with the same email.
A customer IdP can assert any email, so production brokers should use a flow that never links accounts.
Create a top-level flow in the broker realm with a single required "Create User If Unique" step, and name it in first_broker_login_flow:
administration:
infrastructure:
production-keycloak:
origin: https://broker.example.com
realm: customers
client_id: enterprise-administration
client_secret_env: IDENTITY_ADMIN_CLIENT_SECRET
first_broker_login_flow: oe-isolated-first-loginWith that flow, a first login whose username or email already exists fails instead of offering to link.
The adapter's service account cannot create flows, because that needs manage-realm.
Without the setting, the adapter uses the built-in flow and the runtime logs a warning at startup outside development.
The development fixtures create the flow with scripts/lib/keycloak-flows.mjs.
See the Keycloak administration API source for its scope and audience checks.
Audit and verification
The audit explorer filters actor, action, resource type, resource ID, and time.
JSON pages and downloads preserve organization scope and retention.
The SDK export iterator pins its end time on the first page.
Export requires separate audit:export authority and records an audit event.
Sensitive key names are redacted; provider credentials and session tokens never enter administrative event payloads.
Each download contains one bounded page and its continuation cursor.
The SDK iterator follows pages with the same end time for a complete export.
Run the compact React journey with EMBEDDED_FIXTURE=1 npm run test:e2e:administration after starting the disposable compact fixture.
Run npm run test:e2e:embedded:all for native SAML, general SCIM, OAuth/MCP, package embedding, two cloud tenants, self-hosting, and recovery.
The driver preserves fresh fixture databases and sanitized evidence.
The compact guide documents startup, restart and teardown.
bash scripts/test.sh includes configuration activation leases, real DNS proofs, ownership and delegation, directory credential rotation, stale exchanges, diagnostics, audit pagination, and optional backend bridge integration.
Optional provider suites continue to test Keycloak, Dex, brokered SAML and AuthZEN.
Delegating customer workspaces to resellers
Give each reseller backend its own service key. The service's explicit organization_ids are its delegated workspaces. Grant auth:login to start sign-in and portal:entry to open the administration console for an authenticated customer admin. Portal entry also checks the customer's current session, organization membership and permitted operations. Give a partner employee an appropriate role in each client workspace they administer. Removing the membership withdraws that employee's access.
Configure a separate partner profile under local_authentication.resellers for each service. Register that application's callback in application_redirect_uris.
resellers:
- service_id: north-partner
domain_owner: org_north
entry_domain: login.north.example
login_url: https://app.north.example/login
branding:
product_name: North Workspace
primary_color: "#185453"Have the domain owner verify the exact entry hostname in Verified domains. Terminate TLS for that host at the site's proxy and forward only GET /auth/partner/{organization} with the original Host. OE checks the live DNS ownership lease and workspace delegation before redirecting to the configured partner application. The application starts the login with its service key on the canonical runtime origin. OE renders its sign-in, registration, and factor pages using the brand bound to that server-side login transaction. The canonical runtime origin continues to issue cookies and OAuth responses. Link recovery and enrollment opened independently of a tenant login use the deployment brand.