Engineering guide · ICAM

OIDC Authorization Server

Status: implemented; PostgreSQL, Vault Transit, CIBA poll mode, and PKCS#11 interface paths Docker validatedReviewed: 2026-08-15Audience: application developers, API integrators, security engineers, platform operators
On this pageIssuer And DiscoveryGoverned ClientsAuthorization Code FlowClient CredentialsClient-Initiated Backchannel AuthenticationUserinfoSigning-Key LifecyclePKCS#11 deployment contractStorage And EvidenceProtocol Errors And CachingStandards ProfileVerification

Atlas exposes a tenant-scoped OpenID Provider for interactive applications and service clients. The supported profile includes authorization code, client credentials, rotating refresh tokens, RFC 8693 and ID-JAG token exchange, S256 PKCE, exact redirect matching, ES384 signatures, short-lived access tokens, governed scopes, and a bounded OpenID CIBA poll-mode profile. Implicit and password grants, unsigned tokens, symmetric token signatures, client_secret_post, and dynamic redirect URIs are not supported.

The refresh-family management API, transactional replay behavior, exchange connection control plane, and two-stage examples are documented at OAuth Grants, Refresh Tokens, And Token Exchange. The Okta-friendly multi-issuer management plane, scopes, safe claims, first-match policies and rules, per-server key rings, and independent lifecycle are documented at Custom Authorization Servers.

Issuer And Discovery

The issuer is exact and tenant-bound:

https://id.atlas.example/oauth2/{tenantId}

Discover its endpoints at either interoperable discovery path:

GET /oauth2/{tenantId}/.well-known/openid-configuration
GET /.well-known/openid-configuration/oauth2/{tenantId}

The returned issuer, authorization, token, userinfo, and JWKS URIs are derived from ATLAS_OIDC_ISSUER_BASE_URL. Atlas refuses to start the durable issuer outside a development-like environment unless the base URL, PostgreSQL identity store, and Vault Transit custody are available. Production issuer origins must use HTTPS.

Clients must compare the discovery issuer exactly and reject tokens from another tenant. Atlas includes the iss parameter in a successful authorization response to make mix-up detection available to clients.

Governed Clients

OIDC clients use the existing API-access catalog at /api/v1/oauth2/clients; there is no second, less-governed client registry. A client must be enabled, approved, assigned the requested grant, registered for every requested scope, and authorized by Atlas grant policy at issuance time. Authorization is reevaluated when a code is exchanged, so approval or entitlement removal takes effect before a token is signed.

Register confidential client credentials as a Vault reference such as:

vault://applications/mission-planning/oidc

The referenced Vault record stores the credential under key value. Atlas rejects reference traversal, user information, query strings, and fragments. It resolves the secret only during client authentication and compares a SHA-256 digest in constant time. The client catalog and OIDC database never store or return the raw secret.

Public clients use token endpoint authentication method none; confidential clients use client_secret_basic. Atlas deliberately rejects client_secret_post so a credential cannot enter form bodies or routine request logs.

Authorization Code Flow

Generate a verifier with 43 through 128 unreserved characters and send its base64url SHA-256 challenge:

GET /oauth2/{tenantId}/v1/authorize
  ?response_type=code
  &client_id=mission-web
  &redirect_uri=https%3A%2F%2Fmission.example%2Fcallback
  &scope=openid%20profile
  &state={unguessable-client-state}
  &nonce={unguessable-client-nonce}
  &code_challenge={base64url-sha256-verifier}
  &code_challenge_method=S256

The authorization endpoint requires an authenticated Atlas subject. response_type=code, 16-to-512-byte state and nonce values, an exact registered redirect URI, and S256 PKCE are mandatory. Atlas never performs wildcard, prefix, or case-folded redirect matching.

A successful request redirects only to the registered URI:

HTTP/1.1 302 Found
Location: https://mission.example/callback?code=...&state=...&iss=https%3A%2F%2Fid.atlas.example%2Foauth2%2F...
Cache-Control: no-store

Exchange the code:

curl --fail-with-body \
  --user "mission-web:${CLIENT_SECRET}" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -X POST "https://id.atlas.example/oauth2/${TENANT_ID}/v1/token" \
  --data-urlencode "grant_type=authorization_code" \
  --data-urlencode "code=${CODE}" \
  --data-urlencode "redirect_uri=https://mission.example/callback" \
  --data-urlencode "code_verifier=${VERIFIER}"

Authorization codes contain 256 bits of randomness, expire after five minutes by default, and are single-use. Only a tenant-domain-separated SHA-256 lookup value is stored in plaintext. Subject, redirect, PKCE, nonce, assurance, and remaining code state are protected by Vault Transit. The final client, redirect, verifier, expiry, and grant-policy checks occur before an atomic consume; only one concurrent exchange can succeed. Expired code rows are retained for a bounded 24-hour investigation window and then purged per tenant; database guards reject premature deletion.

The response is Cache-Control: no-store and contains a 15-minute ES384 access token with typ: at+jwt. An authorization-code response also contains an ES384 ID token bound to the issuer, audience, authorized party, nonce, subject, authentication time, tenant, and assurance.

Client Credentials

Use client credentials only for approved confidential service clients:

curl --fail-with-body \
  --user "mission-api:${CLIENT_SECRET}" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -X POST "https://id.atlas.example/oauth2/${TENANT_ID}/v1/token" \
  --data-urlencode "grant_type=client_credentials" \
  --data-urlencode "scope=service.read" \
  --data-urlencode "resource=https://receiving-agent.example.mil"

The access-token subject is the client identifier. sub_profile is service. When supplied, resource must be bounded and is included in both the resource claim and access-token audience. An agent may accept that token for exchange only when the URI is its active, readiness-current Atlas API-resource registration and an explicit delegation link authorizes the client. Atlas still executes the API-access grant decision before signing. It does not issue an ID token for this grant.

Client-Initiated Backchannel Authentication

Atlas implements a deliberately bounded OpenID CIBA profile for unattended or input-constrained initiating devices. It supports confidential clients, poll delivery, a current Universal Directory login_hint, and one mandatory binding_message. Ping delivery, signed CIBA request objects, login_hint_token, id_token_hint, and user_code are not advertised and are not accepted by this profile.

Begin the flow:

curl --fail-with-body \
  --user "mission-console:${CLIENT_SECRET}" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -X POST "https://id.atlas.example/oauth2/${TENANT_ID}/v1/backchannel-authentication" \
  --data-urlencode "scope=openid profile" \
  --data-urlencode "login_hint=admin@example.mil" \
  --data-urlencode "binding_message=Approve mission records access"

Atlas resolves the hint against the current tenant and accepts only an active subject. It opens an owner-scoped Atlas Authenticator context approval with purpose OIDC_CIBA; the enrolled device displays the client-bound binding message. The authorization response returns only auth_req_id, expires_in, and interval, without confirming user or device details.

Poll the token endpoint no faster than the returned interval:

curl --fail-with-body \
  --user "mission-console:${CLIENT_SECRET}" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -X POST "https://id.atlas.example/oauth2/${TENANT_ID}/v1/token" \
  --data-urlencode "grant_type=urn:openid:params:grant-type:ciba" \
  --data-urlencode "auth_req_id=${AUTH_REQ_ID}"

Pending, premature, expired, and denied polls return authorization_pending, slow_down, expired_token, and access_denied respectively. Every poll reservation is atomic and durable across restarts. Atlas resolves current group membership and reevaluates the authorization server policy and API-access grant immediately before signing. An approved device challenge and its CIBA transaction are each consumed exactly once before any token response is released.

Only a tenant-domain-separated SHA-256 lookup of auth_req_id is stored in a clear SQL column. Subject, scope, client/server binding, and the device challenge reference remain inside the Vault-protected runtime envelope. Login hints and binding messages are never persisted in the CIBA table. Database guards permit only poll reservation and final consumption, reject mutation and premature deletion, and retain expired evidence for 24 hours.

The current profile issues AAL1 and IAL1 claims. The device-key approval proves purpose-bound holder participation but does not, by itself, claim the assurance of a separately authenticated approving session. High-assurance policies must deny AAL1 until a future profile binds and verifies stronger assurance. CIBA is published in discovery only when both durable storage and the authenticator authority are wired.

Userinfo

Call:

GET /oauth2/{tenantId}/v1/userinfo
Authorization: Bearer {access-token}

Atlas verifies the exact tenant issuer, ES384 algorithm, at+jwt type, audience, expiry, and key lifecycle state. It returns the minimum subject, client, tenant, AAL, and IAL claim set. Registering profile or email permits policy-governed scope issuance; it does not make directory attributes available through userinfo without an explicit disclosure policy.

Signing-Key Lifecycle

Key inspection requires icam.oidc.keys.read, AAL2, and authentication no older than 15 minutes. Rotation and retirement require icam.oidc.keys.manage, AAL3, and authentication no older than five minutes. The service enforces these assurance floors independently of gateway policy.

Bootstrap or rotate:

curl --fail-with-body \
  -H "Authorization: Bearer ${AAL3_TOKEN}" \
  -H "Idempotency-Key: oidc-rotation-2026-07-24-001" \
  -H "Content-Type: application/json" \
  -X POST https://id.atlas.example/api/v1/icam/oidc-keys/rotate \
  -d '{
    "expectedActiveKid": "current-key-id",
    "overlapSeconds": 3600,
    "reason": "scheduled cryptoperiod rollover"
  }'

Omit expectedActiveKid only for the first key. Every later rotation must name the active key, preventing an administrator from overwriting an unseen concurrent rotation. Idempotency-Key is required, is stored only as a tenant-domain-separated digest, and is bound to the actor and canonical request. An exact replay returns the original result; a changed request or actor returns 409 Conflict.

Atlas generates a P-384 key and derives its kid from the public JWK thumbprint. The selected custody provider is fixed at gateway startup and applies to the tenant issuer and custom authorization-server key rings:

  • vault-transit is the compatibility default. Atlas generates the key in the process and encrypts a tenant- and key-bound PKCS#8 envelope with Vault Transit key atlas-icam-oidc-server.

  • pkcs11 generates the P-384 pair inside one exact token. The private object is sensitive, always sensitive, non-extractable, never extractable, and signing-only. Atlas stores the public JWK plus an opaque random 20-byte CKA_ID reference. It does not store private ciphertext, the module path, token label, session handle, PIN, or private bytes in the key row.

The private key, Transit ciphertext, PKCS#11 object reference, and replay bindings never appear in API responses. Public key reads expose only the declared custody class so an operator can distinguish the two contracts.

PKCS#11 deployment contract

Configure the gateway or AIO with:

ATLAS_OIDC_SIGNING_KEY_PROVIDER=pkcs11
ATLAS_OIDC_PKCS11_LIBRARY_PATH=/opt/atlas/pkcs11/libvendor_pkcs11.so
ATLAS_OIDC_PKCS11_TOKEN_LABEL=atlas-oidc-production
ATLAS_OIDC_PKCS11_PIN_REF=vault://atlas/oidc/pkcs11-pin

The library path must be absolute and canonical, the token label must resolve to exactly one initialized token, and the Vault record must contain the token user PIN under value. ATLAS_OIDC_PKCS11_PIN is prohibited. A production deployment mounts its approved PKCS#11 library and vendor client configuration read-only; Atlas does not bundle a vendor library or a default production PIN.

The gateway verifies P-384 key generation and ECDSA signing mechanisms before becoming ready. It opens a bounded session for each operation, resolves exactly one private EC object by CKA_ID, rechecks the non-exportable signing policy, signs the SHA-384 digest, and verifies the returned fixed-width ES384 signature against the persisted public JWK before releasing a token. Missing CGO support, an unavailable or ambiguous token, a changed key policy, a missing object, or a signing error fails issuance closed. Atlas never selects the encrypted-envelope provider as an outage fallback.

The AIO image compiles the gateway with PKCS#11 support but defaults to vault-transit. Use a deployment-owned Compose override for the vendor module, device or network client, and protected vendor configuration. SoftHSM is used only for portable interface validation; it is not physical-HSM certification.

Rotation atomically:

  1. creates the new active key;

  2. moves the expected key to retiring;

  3. sets an overlap no shorter than access-token lifetime plus clock skew;

  4. commits state-bound evidence events for both changes.

JWKS returns the active key and every unelapsed retiring key, allowing already-issued tokens to remain verifiable. Retirement is refused until the overlap and clock-skew window have elapsed:

curl --fail-with-body \
  -H "Authorization: Bearer ${AAL3_TOKEN}" \
  -H "Content-Type: application/json" \
  -X POST "https://id.atlas.example/api/v1/icam/oidc-keys/${KID}/retire" \
  -d '{
    "expectedVersion": 2,
    "reason": "verification overlap elapsed"
  }'

Inspect redacted state and independently verified evidence:

GET /api/v1/icam/oidc-keys
GET /api/v1/icam/oidc-keys/events
GET /oauth2/{tenantId}/v1/keys

Storage And Evidence

PostgreSQL tables are tenant-scoped. Database constraints allow one active key per tenant, only the P-384 and ES384 profile, immutable key identity, exact version transitions, and one-way authorization-code consumption. A serializable transaction couples rotation state and its events. Deferred constraints require every key transition to have the matching final evidence head before commit.

Key events are append-only. Each event binds the tenant, key, public state, version, actor, timestamp, previous hash, and event hash. The events API recomputes the chain and fails closed if any state hash, link, or version has changed.

Protocol Errors And Caching

The token endpoint returns minimal OAuth error identifiers and does not disclose whether the client identifier, secret, code, redirect, verifier, or policy decision failed. Atlas rejects duplicated, unrecognized, query/body-split, or ambiguously authenticated protocol parameters instead of choosing one value. Discovery is cacheable for five minutes and JWKS for one minute with revalidation. Authorization responses, token responses, and userinfo are no-store. Protocol request bodies are bounded to 64 KiB.

Standards Profile

The discovery document follows RFC 8414 and OpenID Connect Discovery. The authorization flow follows the authorization-code and S256 guidance in OAuth 2.0 Security Best Current Practice. Access tokens follow the signed JWT access-token profile in RFC 9068. The authorization response iss parameter follows RFC 9207.

The current conformance claim is the bounded profile described above. Atlas does not claim certification for unsupported optional endpoints or response modes.

Verification

Run unit, gateway, migration, and OpenAPI contract checks:

Internal implementation checks are omitted from this public guide.

Compile the Docker-tagged paths without starting containers:

Internal implementation checks are omitted from this public guide.

Run the bounded authorization-server custody and lifecycle gate:

ATLAS_ICAM_POSTGRES_TMPFS=true \
  scripts/test/run-authorization-server-docker-validation.sh

The bounded Docker scenario applies the real PostgreSQL migrations and uses real Vault. It exercises both the Vault Transit encrypted-envelope path and a Vault-reference-only PKCS#11 path against SoftHSM. The proof covers restart, issuance, overlap, immediate-predecessor rollback, replay, null private ciphertext for token-resident keys, opaque-reference immutability, signing-only and never-extractable attributes, no-fallback outage behavior, and direct-SQL forgery rejection. The runner hashes every retained result under artifacts/authorization-server-docker-validation/<run-id>/.

This proves Atlas’s PKCS#11 interface and custody invariants. It does not certify a particular physical HSM, vendor client, HA cluster, backup policy, operator ceremony, FIPS validation, or production acceptance.