SCIM provisioning and federation
The runtime supports general SCIM Users and Groups with native SAML, upstream OIDC, or an optional broker. It owns canonical identity and organization access. Local accounts supply passwords, recovery, and TOTP when no external IdP is used. See native SAML for direct federation and local identity for built-in accounts.
Directory configuration
deployments/runtime.saml.yaml contains a complete development example:
oidc_connections:
- id: customer-saml
organization_ids: [org_saml]
issuer: https://broker.example/realms/customer
client_id: enterprise-runtime
client_secret_env: OIDC_CLIENT_SECRET
application_redirect_uris: [https://app.example/auth/callback]
directory_subject_claim: directory_subject
required_upstream_idp: customer-saml
directory_connections:
- id: customer-directory
organization_id: org_saml
connection_id: customer-saml
key_hash_env: CUSTOMER_DIRECTORY_KEY_SHA256
default_role: member
group_roles:
engineering: adminCreate the organization and recovery owner invitation with the bootstrap command before starting the directory-enabled runtime.
Use enterprise-runtime keygen for a separate directory credential.
Give the bearer value to the directory client and put its SHA-256 digest in key_hash_env.
Service credentials cannot call SCIM. A directory credential cannot call ordinary runtime APIs.
The SCIM base URL is https://runtime.example/scim/v2/customer-directory.
Each directory belongs to one organization and one permitted authentication connection.
Native SAML uses its pinned IdP entity ID and immutable signed attribute.
The verified issuer, connection, and immutable externalId establish identity continuity.
The signed claim named by directory_subject_claim must equal the SCIM externalId.
Email addresses and display names never establish this link.
SCIM email values do not verify a canonical email address.
Directory identity bindings cannot change under an existing directory ID.
Changing a default role updates only memberships owned by that directory.
Group mappings use immutable group externalId, or the server group ID when no external ID exists.
The runtime validates that mapped roles exist and are not owner.
Removing configuration does not delete persisted directory records or remove their access restrictions.
Retiring or migrating a directory requires an explicit operator migration with session revocation.
Supported SCIM profile
All endpoints require the directory bearer credential and return application/scim+json.
Use that media type for request bodies.
| Resource | Methods | Behavior |
|---|---|---|
/Users |
GET, POST | Filter, paginate, create |
/Users/{id} |
GET, PUT, PATCH, DELETE | Read, replace, update, deactivate, tombstone |
/Groups |
GET, POST | Filter, paginate, create |
/Groups/{id} |
GET, PUT, PATCH, DELETE | Read, replace, update membership, delete |
/ServiceProviderConfig |
GET | Capability and limit discovery |
/Schemas, /ResourceTypes |
GET | Lists and individual resource discovery |
Users require immutable externalId and mutable userName.
Core optional attributes include active, displayName, name, emails, nickName, profileUrl, title,
userType, preferredLanguage, locale, timezone, phoneNumbers, and addresses.
/Schemas publishes the precise subattributes and characteristics.
active defaults to true. Names support givenName, familyName, and formatted.
active also accepts the strings "True" and "False" in any letter case, which Microsoft Entra ID sends.
Email entries support value, type, and primary, with at most 20 entries and one primary.
Unsupported writable attributes return a SCIM error.
The server generates id and meta; writes cannot select a canonical user ID.
Groups require displayName and accept an optional immutable externalId.
Group members use SCIM user IDs from the same directory, with at most 50000 members.
A membership change writes only the added and removed member rows.
A Groups query with excludedAttributes=members doesn't load member lists, unless its filter names members.
A remove operation on members with a list of values removes only those members; without a value it removes them all.
Filters support eq, ne, co, sw, ew, gt, ge, lt, le, and pr where schema types permit them.
Use and, or, not, parentheses, and multi-valued value paths.
Attribute names and operators ignore ASCII case; literals follow schema type and caseExact.
Strings use Unicode lowercase comparison when case is not exact; full PRECIS normalization is not claimed.
Date-time comparisons use parsed RFC 3339 instants, and integer comparisons preserve signed 64-bit precision.
Unknown or protected attributes, invalid operand types, and malformed filters return invalidFilter.
A filter permits at most 4096 bytes, 256 tokens, and 12 parser levels.
sortBy and sortOrder select ascending or descending schema-backed sorting.
A multi-valued complex attribute uses its primary entry, then its first entry.
Stable resource IDs break ties.
attributes and excludedAttributes project supported paths; they cannot be combined.
Required envelope fields remain. Returned-never and write-only attributes cannot be disclosed or queried.
Projection lists permit at most 100 paths and 4096 bytes.
Pagination uses startIndex from 1 and count from 0 to 200; the default count is 100.
Zero returns the accurate total without resource bodies.
Each page uses one PostgreSQL snapshot for its total, records, and projection rules.
Directory writes, including deactivation, can proceed while the page is being read.
Equality filters on id, externalId, userName for users, and displayName for groups use indexed lookups.
Complex filters and custom sorts can examine up to 20,000 live candidates per request.
Above that limit, the server returns HTTP 400 with SCIM type tooMany.
Use an indexed equality lookup or page through the collection in its default ID order. Those operations work on larger directories.
Custom sorts use a private working table and require TEMPORARY on the database for the runtime role.
Pagination across separate requests can observe intervening commits.
PATCH supports add, replace, and remove, with 1 to 100 operations per atomic request.
A pathless add or replace uses an object of supported attributes.
User paths include active, userName, externalId, displayName, name, name.givenName, name.familyName, and emails.
Email updates also support emails[type eq "work"].value; removal supports emails[type eq "work"].
Group membership supports whole-array add, replace, remove, and filtered removal with members[value eq "user-id"].
Changing immutable identifiers returns mutability; unknown paths return invalidPath.
Any invalid operation rolls back the complete request.
PATCH also limits the memory it can spend expanding updates across matching values. Across one
request, the runtime counts JSON values, keys and string data as it copies them. The expansion
allowance is eight times server.max_body_bytes, up to 8 MiB. The documents processed across all
operations share a 64 MiB allowance. Each resulting document must also fit within 64 MiB,
including default fields that appear when the directory reads it back. An already oversized
resource can still be deactivated or reduced with one direct operation on a single attribute.
When a request exceeds a limit, the server returns HTTP 413 and preserves the resource and its version.
Duplicate POST requests return 409 uniqueness; clients can look up the existing resource by externalId.
Repeated identical PUT or PATCH requests preserve the resource ID and version.
DELETE hides the user from reads and retains the identity and denial records.
Deleted immutable user IDs remain reserved. Use active: false when later reactivation is required.
Deleted users are removed from group membership.
The profile supports the registered extension attributes in addition to the core paths.
Every directory also accepts the RFC 7643 enterprise User extension, urn:ietf:params:scim:schemas:extension:enterprise:2.0:User.
It holds employeeNumber, costCenter, organization, division, department and manager.
Complex PATCH values merge omitted subattributes; array replacement replaces the collection.
Selecting one primary entry clears the earlier primary.
An unmatched filtered replacement returns noTarget; removing an absent value succeeds unchanged.
Password changes remain on trusted account-security flows.
Responses carry ETags. If-None-Match supports conditional reads; If-Match gates PUT, PATCH, and DELETE.
Version checks happen under the same lock as the write. A stale condition returns HTTP 412 without partial mutation.
PATCH also fences its read/modify/write preparation when no caller condition is supplied.
Identical stored state retains its version.
/Bulk supports POST, PUT, PATCH, and DELETE for Users and Groups, with at most 100 operations.
Each operation commits independently and authenticates the current directory credential before it begins.
An already authenticated operation may finish after revocation; later and dependency-deferred operations must authenticate again.
Forward bulkId references are resolved before dependent operations run.
Failed or cyclic dependencies receive 424; failOnErrors stops remaining work after its error threshold.
Exceeding maxOperations or the advertised maxPayloadSize returns HTTP 413 and names the exceeded limit.
Operation responses are bounded to 1 MiB.
A revoked credential prevents subsequent operations, including work already waiting on a dependency.
Administrators register directory-owned schema URNs through the directory schemas API or React panel.
Schemas support primitive, complex, and multi-valued values with required fields, mutability, return rules, and server uniqueness.
Definitions are bounded to 200 attributes, 50 per level, and three nested complex levels.
Server uniqueness applies to single-valued primitive attributes outside multi-valued parents and retains tombstone reservations.
Schema changes require directories:write, an expected schema version, and validation of existing resource documents.
Schema changes validate up to 10,000 current documents. Writes with custom server-unique attributes check up to 10,000 other records, including reserved tombstones.
Schemas cannot redefine core IDs, machine identity, secrets, or protected engine fields.
Custom directory attributes never become trusted permission attributes without an explicit vendor mapping.
Discovery reports these boundaries; the implementation does not claim certification for every commercial SCIM client.
The interoperability matrix records coverage against draft profile revision 02.
It includes verified gaps and untested cases and does not establish full draft conformance.
Microsoft Entra ID
In the Entra enterprise application, set the provisioning Tenant URL to the directory's SCIM base URL and add ?aadOptscim062020 to the end:
https://runtime.example/scim/v2/{directory_id}?aadOptscim062020The flag turns on Entra's fixes for its known SCIM 2.0 compliance issues, most of which concern PATCH requests.
The runtime also accepts Entra's behavior without the flag: capitalized Add, Replace and Remove operations, "True" and "False" strings for active, and member removal with a value list.
Entra's default attribute mappings send department, employeeNumber and manager in the enterprise User extension, which every directory accepts.
Entra sends manager as the manager's SCIM user ID string; the runtime stores it as manager.value.
Map the user's immutable objectId, or another value that never changes, to externalId.
userPrincipalName and mail can change, so they belong in userName and emails.
Access and role ownership
Effective permissions are the union of the active base membership role and all mapped group roles. Removing one group removes only that source's grant.
A directory group can also join a team the application already has.
group_teams on the directory configuration maps the group's immutable externalId, or its server ID, to an existing team ID.
The team keeps its own members, roles and shares, and the directory group's members hold them too.
When someone leaves the directory group, or the directory deletes it, they lose what the team gave them.
Changing group_teams needs groups:write as well as directories:write, because it adds people to a team.
The runtime refuses a mapping to a team that doesn't exist, and ignores a mapping whose team was deleted later.
An existing local membership keeps its role and source when the directory adopts the same verified identity.
A membership created by provisioning keeps its directory-owned default role.
Local APIs can suspend it but cannot overwrite that role.
Local suspension or directory deactivation denies all effective grants for the organization. Deactivation and deletion revoke existing sessions and delete pending exchanges in the same transaction. Login, exchange, session validation, and authorization recheck this state. Reactivation requires a new verified login; old sessions and pending exchanges remain invalid. Other organizations retain their independent access.
Keep a recovery owner on an independent local or OIDC connection outside directory management. The runtime rejects provisioning of an existing owner and rejects promotion of a directory-managed user to owner. Directory mappings cannot grant ownership. Local membership changes retain the last-owner protection.
Optional brokered SAML interoperability fixture
docker compose -f compose.yaml -f deployments/compose.saml.yaml up --build --wait
npm run test:e2e:samlFor an existing development PostgreSQL volume, create these databases first:
docker compose exec postgres createdb -U enterprise enterprise_saml
docker compose exec postgres createdb -U enterprise enterprise_example_samlThe setup service creates dedicated realms oe-v02-idp and oe-v02-broker.
The first realm signs SAML assertions. The broker validates signatures against imported IdP certificates.
It maps the administrator-controlled directory_subject attribute into a signed OIDC claim.
A broker session-note mapper supplies the signed upstream_idp claim.
The runtime checks that claim against required_upstream_idp; the login hint alone provides no proof.
Production brokers must also prevent self-service account linking or attribute changes that could impersonate a provisioned identity.
The test provisions Alice and the engineering group before login.
Use username alice and password dev-only-saml-alice-password for interactive login after the test.
The directory bearer credential is dev-only-saml-directory-key-change-me.
These values are public development fixtures.
The recovery user is recovery, with password dev-only-recovery-owner-password.
Use connection recovery-oidc through the standard login API, then accept the bootstrap owner invitation.
The example application selects the customer connection by default; it does not provide an administration login selector.
The browser lifecycle verifies canonical identity continuity, group permissions, live-session denial, pending-exchange denial, repeated-login denial, and audit history.
The PostgreSQL suite additionally verifies organization isolation and concurrent deactivation.
For a production IdP, replace metadata and certificates, client credentials, redirect URIs, and immutable claim mappings. Configure all origins with HTTPS, rotate signing certificates through broker metadata, and run the lifecycle against the target IdP. Native SAML uses the separate direct SP profile. The optional fixture above tests the broker adapter.