Engineering guide · ICAM

Federation Account Linking

Status: implemented, unit-tested, race-tested, and PostgreSQL Docker validated on 2026-07-26Reviewed: 2026-07-26Audience: federation developers, identity architects, security engineers, platform operators
On this pageSecurity ModelCallback ResolutionCandidate RulesResource And LifecycleAPIsAtlas Governance SurfaceOkta-Friendly Identity Provider Users SurfaceInvalidation BoundaryPersistence And EvidenceError HandlingVerificationUpstream References

Atlas 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:

  1. reloads the enabled provider, exact protocol, canonical issuer or entity ID, account-link policy, and JIT policy;

  2. derives the non-reversible external-principal reference;

  3. resolves every exact active local candidate from verified identifiers;

  4. materializes a tenant-local JIT identity only when policy permits and there are no existing candidates;

  5. commits or reloads the signed account-link state;

  6. refuses authentication until the link is ACTIVE;

  7. resolves roles only through the Universal Directory membership-integrity boundary;

  8. issues the Atlas session and tokens;

  9. reloads provider trust, link generation, status, and user status after issuance; and

  10. 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

QUARANTINED

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

PENDING_USER_APPROVAL or PENDING_ADMIN_APPROVAL

An existing account is never silently taken over by a mutable email or profile claim.

More than one

QUARANTINED

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 canonical issuer;

  • issuerSha256 and externalIdRef, never the raw external subject;

  • the tenant-local userId and bounded candidate user UUIDs;

  • approval mode, lifecycle status, and conflict reason;

  • a monotonically increasing linkGeneration;

  • a strong opaque etag and 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

PENDING_USER_APPROVAL

Only the exact authenticated local user can approve with fresh phishing-resistant AAL2.

PENDING_ADMIN_APPROVAL

A different fresh phishing-resistant AAL3 administrator must approve.

QUARANTINED

No safe or unique local candidate exists. Authentication is denied.

ACTIVE_PENDING_INVALIDATION

Approval is committed, but the link remains unusable until every configured session and token boundary is invalidated.

ACTIVE

The signed link, enabled provider, active user, and current generation may be used.

UNLINKED_PENDING_INVALIDATION

The tombstone is committed and invalidation is incomplete.

UNLINKED

The binding is a retained tombstone. Physical deletion is forbidden.

RELINK_PENDING_INVALIDATION

The prior binding is unusable while old subject state is revoked. A relink returns to the configured approval path.

REJECTED

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

GET /api/v1/federation/providers/{providerId}/account-links

List signed tenant links; optionally filter by exact status.

POST /api/v1/federation/providers/{providerId}/account-links

Propose a manual reviewed link. The raw externalId is write-only.

GET /api/v1/federation/providers/{providerId}/account-links/{linkId}

Read one integrity-verified link.

DELETE /api/v1/federation/providers/{providerId}/account-links/{linkId}

Commit an unlink tombstone and run invalidation.

POST …​/{linkId}/approve

Independently approve an administrator-review link.

POST …​/{linkId}/self-approve

Approve only the authenticated user’s own user-review link.

POST …​/{linkId}/reject

Reject and retain the proposal.

POST …​/{linkId}/relink

Propose a different active tenant user without changing the external-principal key.

GET …​/{linkId}/evidence

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

GET /api/v1/idps/{idpId}/users

List users linked to an identity provider.

POST /api/v1/idps/{idpId}/users/{userId}

Propose a link for the path user.

GET /api/v1/idps/{idpId}/users/{userId}

Read the compatibility resource.

DELETE /api/v1/idps/{idpId}/users/{userId}

Unlink through the same signed tombstone and invalidation flow.

GET /api/v1/users/{userId}/idps

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_ref equal 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

400

Malformed, unbounded, unknown, or secret-bearing input.

403

Capability, tenant, provider trust, subject, maker-checker, assurance, or freshness check failed.

404

The tenant-scoped provider, user, or link was not found.

409

ETag, uniqueness, collision, state, replay binding, or integrity conflict.

428

The verified callback found a link that still requires user or administrator review.

503

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.