Architecture
The runtime separates portable contracts, HTTP orchestration, and capability implementations. Core models contain no SQLx, Keycloak, or Dex types. Compiled providers implement async Rust traits behind trait objects.
- Application backend
- Rust runtime
- PostgreSQL
Full component diagram (Mermaid source)
flowchart LR
Browser --> App[Application backend / SDK]
App --> Runtime[Axum runtime]
Runtime --> Identity[Identity / organizations]
Runtime --> RBAC[Authorization]
Runtime --> Audit[Audit]
Runtime --> Sessions[Sessions]
Runtime --> OIDC[Generic OIDC]
Runtime --> Local[Local accounts]
Local --> PG
Local --> SMTP[SMTP relay]
Directory[Customer directory] --> SCIM[SCIM adapter]
SCIM --> Runtime
Transmitter[SSF transmitter] --> Signals[SET receiver / durable inbox]
Signals --> PG
Signals --> Sessions
Identity --> PG[(PostgreSQL)]
RBAC --> PG
RBAC --> Native[Native portable evaluator]
RBAC -. optional .-> AuthZEN[AuthZEN adapter]
AuthZEN --> PDP[Reference PDP]
PDP --> OPA[OPA policy engine]
PG --> Sync[Durable synchronization log]
Sync --> AuthZEN
Audit --> PG
Sessions --> PG
OIDC --> IdP[Keycloak / Dex / compatible IdP]
Runtime --> NativeSAML[Native SAML SP]
NativeSAML --> SAML[Customer SAML IdP]An organization is the tenant boundary. Each service credential explicitly lists permitted organization IDs and operation scopes. A user session binds one canonical user to one organization. The runtime compares this context with the requested organization before each protected operation.
Canonical mapping uses (connection ID, verified issuer, verified subject).
A local account is one more mapping: the local connection ID, the issuer urn:open-enterprise:local-accounts, and the account ID as subject.
The database serializes concurrent resolution of the same mapping.
Matching email addresses never merge users.
The runtime retains an email address only after upstream verification, or after the address owner opens a local verification link.
Organization creation and initial role definitions share a transaction. Invitation acceptance and membership creation share another transaction. Membership writes lock the organization before changes. This lock prevents concurrent operations from removing all active owners.
Roles contain explicit permission strings.
Only the literal * grants all permissions.
Strings such as project:* have no special meaning.
Missing membership, suspended membership, and unknown permissions deny access.
Database errors return errors instead of permission grants.
The audit provider has no foreign keys to canonical users or organizations. This separation permits audit-only adoption. Credential scope still controls each external organization identifier.
The provider registry validates configured capabilities before database connections or OIDC discovery. Provider selection occurs at startup. The system does not load dynamic libraries or implement remote plugins.
The runtime emits structured tracing logs without request query strings or credentials.
An optional OTLP exporter sends request spans when OTEL_EXPORTER_OTLP_ENDPOINT is present.
Request spans contain the HTTP method and route template.
The local fixture uses a single PostgreSQL administrator for convenience. Production deployments use separate database roles for the runtime, application, and migrations. The example database stores application data and encrypted backend session tokens.
Provisioning adds an immutable upstream identifier beside the verified login subject. The directory record stores its own resource ID and canonical user ID separately. Local memberships retain their source when group grants change. Effective authorization uses the union of active base and mapped group roles, gated by directory status.
An organization lock serializes provisioning, local mutations, login resolution, exchange, and event acceptance. A durable CAEP denial record protects requests even while the cleanup worker is stopped. Upstream session IDs match exact revocations; user-scoped events use verified authentication times.
Advanced permissions
The PermissionStore contract owns roles, assignments, groups, resources, grants, relationships, attributes, and versioned bundles.
The AdvancedAuthorizationProvider contract owns evaluation, batch evaluation, searches, synchronization, and translation comparison.
The PostgreSQL implementation writes each mutation, revision, synchronization entry, and audit record atomically.
The AuthZEN adapter sends canonical context to a separate decision process backed by OPA. It synchronizes immutable snapshots and rechecks the live database revision after every remote result. No decision cache or stale allow fallback exists. The native provider evaluates the same compiled model in the runtime. It checks live revisions before and after single decisions, batches, and searches. Management checks run under the organization lock; stale authority cannot commit a change. A recovery owner retains local control-plane access during a PDP outage.
Business state remains in the application database. Applications register authoritative resource values and check access inside their own business operation. The example locks invoice data before registering the amount and requesting approval. The permissions guide defines inheritance, trusted attributes, consistency, capacities, and rollback boundaries.
Enterprise administration
The AdministrationStore contract owns scoped portal sessions, configuration versions, DNS proofs, directory keys, people, and audit metadata.
The IdentityAdministrationProvider contract inspects metadata and stages isolated identity configurations.
The Keycloak adapter owns its REST types and uses realm-scoped client credentials.
The application backend creates a one-use entry for a verified administrator. The engine exchanges it for a short-lived HttpOnly browser cookie. An optional vendor backend bridge stores the child credential in encrypted PostgreSQL session storage. Both render the same React package and panels. The runtime checks parent session, organization, current authority, and bound operation scope on each request.
PostgreSQL stores activation intent, worker leases, encrypted customer secrets, and the authoritative active pointer. Provider changes precede pointer activation and preserve a separate recovery connection. The administration guide defines configuration precedence, migration, restart, and recovery.
Events and application integrations
Deferred PostgreSQL capture commits lifecycle facts and resource versions with canonical state changes. An organization counter serializes publication positions through commit. The event publisher atomically moves pending facts into the retained feed and matching webhook deliveries. The HTTP delivery provider uses a separate attempt log, durable leases, bounded retries, and egress validation.
The Events API and webhook provider expose the same versioned lifecycle contracts. Signed cursors bind organization and filters. A consistent, paginated resource snapshot provides a checkpoint after retention expires.
The application owns its audit outbox, consumer inbox, checkpoints, processed-event ledger, and cleanup transaction. An unavailable integration cannot weaken the existing access gates. The events guide defines ordering, overlap, acknowledgment, retention, and recovery.
Local accounts
provider-local-auth holds the parts that need no database: Argon2id hashing with a concurrency limit, the password policy and blocklist, TOTP and recovery codes, AES-256-GCM sealing with a versioned keyring, mail templates, and the SMTP mailer.
The LocalIdentityStore contract in enterprise-core owns accounts, single-use challenges, factors, account-page sessions, throttles, login policy, onboarding, and identity migrations; PostgreSQL implements it, one transaction per method.
The runtime module local serves the HTML pages and the onboarding, account-entry, login-policy, and operator APIs.
Challenges store only token hashes. Consuming one is a single conditional update, so two requests cannot both succeed. Messages are written to an outbox in the same transaction as their challenge, and a worker on each replica delivers them under a lease.
A SQL function, login_method_allowed, decides whether a login origin may act in an organization.
Grant creation, exchange, and session verification all call it, under the organization lock where one is held.
Organization locks use FOR NO KEY UPDATE, so the foreign-key checks of account-wide revocation, which touch several organizations, cannot deadlock with them.
Machine principals
Service accounts belong to an organization and persist independently of their human creators. Their API keys and OAuth bindings cap current roles and resource grants. Credential epochs, account state, client policy, and resource policy gate each live check. Machines have their own principal type and never receive human authentication assurance.
Native federation and provisioning
The native SAML provider validates pinned metadata and signed assertions through saml-rs and its XML security backend. PostgreSQL stores request correlation, sealed POST handoffs, and assertion replay claims. SCIM schema registration, typed queries, conditional writes, and each bulk operation preserve the organization lock and source boundaries.