Engineering guide · ICAM
Federation Account Linking
On this page
Security ModelCallback ResolutionCandidate RulesResource And LifecycleAPIsAtlas Governance SurfaceOkta-Friendly Identity Provider Users SurfaceInvalidation BoundaryPersistence And EvidenceError HandlingVerificationUpstream ReferencesAtlas federation account linking binds one cryptographically verified external OIDC or SAML principal to one active Universal Directory user. It provides the familiar Identity Provider Users API while adding a signed, versioned authority, collision quarantine, maker-checker approval, keyed subject privacy, and fail-closed token and session invalidation.
This page covers the account-link authority. See Federation for provider configuration and protocol verification, and Identity Provider Routing for first-match provider selection.
Security Model
Account linking occurs only after the OIDC or SAML verifier has validated the callback. The callback may report the observed issuer and subject, but it cannot choose the configured trust root, protocol, link policy, or JIT policy. The account-link service reloads those values from the enabled provider authority and rejects a mismatch.
Atlas never persists or returns the raw OIDC sub, SAML NameID, or assertion
subject.
Before any database state, replay receipt, event, response, or log object is
built, the service replaces the subject with a purpose-separated HMAC over:
tenant ID | provider ID | protocol | canonical issuer reference | verified subject
The HMAC prevents offline enumeration of low-entropy external identifiers. Issuer references use a SHA-256 digest because the configured issuer is public; external-principal references require the secret integrity key. Federated JIT usernames use a separate keyed derivation and therefore cannot be correlated by computing an unsalted subject hash.
Provider definitions are currently platform-managed. Link state, local-user lookup, JIT materialization, approvals, evidence, and invalidation remain tenant-scoped. The API and OpenAPI descriptions state this boundary explicitly.
Callback Resolution
For every verified callback Atlas:
-
reloads the enabled provider, exact protocol, canonical issuer or entity ID, account-link policy, and JIT policy;
-
derives the non-reversible external-principal reference;
-
resolves every exact active local candidate from verified identifiers;
-
materializes a tenant-local JIT identity only when policy permits and there are no existing candidates;
-
commits or reloads the signed account-link state;
-
refuses authentication until the link is
ACTIVE; -
resolves roles only through the Universal Directory membership-integrity boundary;
-
issues the Atlas session and tokens;
-
reloads provider trust, link generation, status, and user status after issuance; and
-
revokes the just-issued session if any of those values changed.
The post-issuance check closes the race between callback resolution and token return. Disabling a provider, rotating its trust root, unlinking or relinking the principal, changing the link generation, or deactivating the local user makes that check fail closed.
Candidate Rules
| Exact active candidates | Default result | Reason |
|---|---|---|
Zero, JIT disabled |
|
Atlas has no safe local subject. |
Zero, JIT allowed |
Materialize a keyed tenant-local user, then apply the provider approval policy |
A link never makes an unmaterialized identifier authoritative. |
One |
|
An existing account is never silently taken over by a mutable email or profile claim. |
More than one |
|
Ambiguity is retained for review; Atlas never selects the first match. |
OIDC email matching requires the signed email_verified claim.
Higher-assurance EDIPI matching is considered only when the provider assurance
mapping permits it.
SAML candidates come from attributes protected by the validated assertion, but
an existing local account still requires the configured approval path.
Authorization roles never come directly from external groups or roles
claims.
They come from tenant-scoped Universal Directory group reads that verify the
membership MAC.
Malformed or directly inserted membership rows are excluded rather than
becoming authorization grants.
Resource And Lifecycle
A link includes:
-
id,idpId,protocol, and the configured canonicalissuer; -
issuerSha256andexternalIdRef, never the raw external subject; -
the tenant-local
userIdand bounded candidate user UUIDs; -
approval mode, lifecycle status, and conflict reason;
-
a monotonically increasing
linkGeneration; -
a strong opaque
etagand revision; -
pending invalidation obligations and the truthful application-logout boundary;
-
the append-only evidence head; and
-
a P-384 state seal with signer and commit metadata.
Important states are:
| Status | Meaning |
|---|---|
|
Only the exact authenticated local user can approve with fresh phishing-resistant AAL2. |
|
A different fresh phishing-resistant AAL3 administrator must approve. |
|
No safe or unique local candidate exists. Authentication is denied. |
|
Approval is committed, but the link remains unusable until every configured session and token boundary is invalidated. |
|
The signed link, enabled provider, active user, and current generation may be used. |
|
The tombstone is committed and invalidation is incomplete. |
|
The binding is a retained tombstone. Physical deletion is forbidden. |
|
The prior binding is unusable while old subject state is revoked. A relink returns to the configured approval path. |
|
A signed rejected proposal is retained for evidence and collision history. |
Every mutation requires the current If-Match value, an Idempotency-Key,
and X-Atlas-Reason.
Replay receipts are bound to tenant, actor, operation, and canonical request.
Reusing a key for another actor or request returns a conflict.
Semantically equivalent JSON survives PostgreSQL JSONB normalization because
replay MACs sign canonical JSON rather than incidental byte layout.
APIs
All paths are present in the gateway OpenAPI document and Swagger UI.
Atlas Governance Surface
| Method and path | Purpose |
|---|---|
|
List signed tenant links; optionally filter by exact status. |
|
Propose a manual reviewed link. The raw |
|
Read one integrity-verified link. |
|
Commit an unlink tombstone and run invalidation. |
|
Independently approve an administrator-review link. |
|
Approve only the authenticated user’s own user-review link. |
|
Reject and retain the proposal. |
|
Propose a different active tenant user without changing the external-principal key. |
|
Verify and return the link’s contiguous evidence chain. |
Example proposal:
curl --request POST \
--url "$ATLAS/api/v1/federation/providers/partner-oidc/account-links" \
--header "Authorization: Bearer $TOKEN" \
--header "Content-Type: application/json" \
--header "Idempotency-Key: link-partner-user-20260726-01" \
--header 'X-Atlas-Reason: Approved partner account onboarding' \
--data '{
"externalId": "upstream-subject-is-write-only",
"userId": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa"
}'
The response contains externalIdRef; it never echoes the submitted
externalId.
Example independent approval:
curl --request POST \
--url "$ATLAS/api/v1/federation/providers/partner-oidc/account-links/$LINK_ID/approve" \
--header "Authorization: Bearer $AAL3_CHECKER_TOKEN" \
--header "If-Match: $LINK_ETAG" \
--header "Idempotency-Key: approve-partner-link-20260726-01" \
--header 'X-Atlas-Reason: Independent identity evidence review passed'
The approving actor cannot be the proposal’s maker.
Okta-Friendly Identity Provider Users Surface
| Method and path | Purpose |
|---|---|
|
List users linked to an identity provider. |
|
Propose a link for the path user. |
|
Read the compatibility resource. |
|
Unlink through the same signed tombstone and invalidation flow. |
|
List enabled identity providers linked to a tenant user. |
For compatibility the response field is named externalId, but its value is
the non-reversible externalIdRef.
Applications that require the raw upstream subject must keep it in their own
protocol session; Atlas does not provide a recovery endpoint for it.
Invalidation Boundary
Approval, unlink, and relink transitions that change effective binding state create a durable invalidation obligation. The worker must prove all Atlas-owned boundaries completed:
-
Atlas sessions are invalidated;
-
access-token JTIs are denied;
-
OAuth refresh-token families are revoked; and
-
application sessions are either logged out or truthfully reported as
NOT_CONFIGURED.
The link cannot become ACTIVE or finish its tombstone while an internal
boundary is missing.
Pending obligations are restart-recoverable and can be retried by the worker.
Application logout is never reported as complete merely because Atlas lacks a
connector.
Persistence And Evidence
federation_account_links is keyed by tenant, provider, and link ID.
It also has a unique tenant/provider/protocol/issuer/external-reference
constraint.
Local and invalidation user UUIDs are checked against users in the same tenant.
The database enforces:
-
immutable link identity fields and creation time;
-
revision increments of exactly one;
-
non-decreasing link generation;
-
one matching revision event for every current aggregate;
-
an event
state_refequal to the persisted signed state digest; -
a contiguous predecessor hash;
-
append-only events and replay receipts;
-
tombstones instead of physical deletion;
-
tenant-local user references;
-
bounded documents and candidate lists; and
-
structural absence of raw subject field names in state and replay JSON.
The application additionally verifies the P-384 state seal, opaque ETag, canonical replay MAC, event hashes, current evidence head, enabled provider, active local user, and link generation on every relevant read.
Error Handling
| HTTP status | Meaning |
|---|---|
|
Malformed, unbounded, unknown, or secret-bearing input. |
|
Capability, tenant, provider trust, subject, maker-checker, assurance, or freshness check failed. |
|
The tenant-scoped provider, user, or link was not found. |
|
ETag, uniqueness, collision, state, replay binding, or integrity conflict. |
|
The verified callback found a link that still requires user or administrator review. |
|
Provider, user, signing, persistence, evidence, invalidation, or application logout authority is unavailable. Atlas fails closed. |
Protocol callback errors never include the raw external subject. Logs use bounded references.
Verification
Run focused package and gateway checks:
Internal implementation checks are omitted from this public guide.
Run the bounded PostgreSQL proof:
ATLAS_ICAM_POSTGRES_TMPFS=true \
scripts/test/run-federation-account-link-docker-validation.sh
The Docker test applies the real embedded migrations and proves PostgreSQL CAS, maker-checker approval, exact replay after JSONB round-trip, collision quarantine, tenant separation, keyed subject safety, restart recovery, tombstone durability, predecessor enforcement, event and replay append-only guards, and rejection of direct aggregate tamper.
The 2026-07-26 run passed with a verified manifest at
artifacts/federation-account-link-validation/20260726T153016Z/manifest.sha256.