M2 task 2.1: /api/auth/idp/* signed-state OIDC surface (IDA-01/03/10) #131

Closed
opened 2026-11-09 14:54:59 +01:00 by amiryahaya · 1 comment
Owner

Dev plan task 2.1 (Phase 2, milestone M2): the Zitadel-first OIDC surface replacing the legacy per-provider /oidc/{provider}/* flows at decommission.

Contract (02-architecture §4, IDA-01/03/10):

  • GET /api/auth/idp/authorize?redirect_uri=&invite_token=&pairing_code= → 302 to IdP authorize (PKCE S256); state SIGNED with the server identity key (IKeyStore — IDA-10: single-use, TTL ≤ 10 min, binding nonce + redirect + invite/pairing payload); redirect_uri exact-match allowlist.
  • GET /api/auth/idp/callback?code&state → verify state (sig/TTL/nonce-replay), code exchange (PKCE verifier bound in the state; confidential client), id_token validation (provider 'idp'), email_verified != true rejected (IDA-09), find-by-sub → auto-link-by-verified-email → JIT open registration (IDA-04) or invite provisioning (state invite_token), ADR-012 amr-first admin gate, opaque session, JSON { session_token, user, mfa_required, totp_setup_required, requires }.
  • Feature flag Auth:IdpEnabled gates both endpoints (§16 rollout).
  • FakeIdpServer: email_verified claim parametrizable + amr/auth_time (already landed in PR #129).

Acceptance: forged/tampered/expired/replayed states rejected; unverified-email tokens rejected; passkey-at-IdP admin gets a full session; open registration lands no_workspace (requires org_state); invite-in-state lands in the tenant; auto-link does not duplicate accounts.

Dev plan task 2.1 (Phase 2, milestone M2): the Zitadel-first OIDC surface replacing the legacy per-provider /oidc/{provider}/* flows at decommission. **Contract (02-architecture §4, IDA-01/03/10):** - GET /api/auth/idp/authorize?redirect_uri=&invite_token=&pairing_code= → 302 to IdP authorize (PKCE S256); state SIGNED with the server identity key (IKeyStore — IDA-10: single-use, TTL ≤ 10 min, binding nonce + redirect + invite/pairing payload); redirect_uri exact-match allowlist. - GET /api/auth/idp/callback?code&state → verify state (sig/TTL/nonce-replay), code exchange (PKCE verifier bound in the state; confidential client), id_token validation (provider 'idp'), **email_verified != true rejected (IDA-09)**, find-by-sub → auto-link-by-verified-email → JIT open registration (IDA-04) or invite provisioning (state invite_token), ADR-012 amr-first admin gate, opaque session, JSON { session_token, user, mfa_required, totp_setup_required, requires }. - Feature flag Auth:IdpEnabled gates both endpoints (§16 rollout). - FakeIdpServer: email_verified claim parametrizable + amr/auth_time (already landed in PR #129). Acceptance: forged/tampered/expired/replayed states rejected; unverified-email tokens rejected; passkey-at-IdP admin gets a full session; open registration lands no_workspace (requires org_state); invite-in-state lands in the tenant; auto-link does not duplicate accounts.
Author
Owner

LANDED: PR #132 squash-merged (PR runs api-ci 12212 + security-ci 12213 green; suite 970/0/39, coverage 87.97%). Full surface: /api/auth/idp/authorize (exact-match redirect allowlist, PKCE S256, IDA-10 signed state via IKeyStore server-identity key — TTL 10 min, single-use nonces in idp_state_nonces, verifier bound in state) + /api/auth/idp/callback (fail-closed consume, exchange, IDA-09 email_verified enforcement + audit, sub-primary resolution: login → auto-link-by-verified-email → open registration no_workspace → invite provisioning via Org seam; ADR-012 amr gate; JSON response with requires[]). Flag Auth:IdpEnabled; SEC-04 registry + matrix rows; sanctioned Identity→Org seam entry in ModuleMap. Realm separation (platform-admins) remains task 2.8; Zitadel realm config lands with staging bring-up.

LANDED: PR #132 squash-merged (PR runs api-ci 12212 + security-ci 12213 green; suite 970/0/39, coverage 87.97%). Full surface: /api/auth/idp/authorize (exact-match redirect allowlist, PKCE S256, IDA-10 signed state via IKeyStore server-identity key — TTL 10 min, single-use nonces in idp_state_nonces, verifier bound in state) + /api/auth/idp/callback (fail-closed consume, exchange, IDA-09 email_verified enforcement + audit, sub-primary resolution: login → auto-link-by-verified-email → open registration no_workspace → invite provisioning via Org seam; ADR-012 amr gate; JSON response with requires[]). Flag Auth:IdpEnabled; SEC-04 registry + matrix rows; sanctioned Identity→Org seam entry in ModuleMap. Realm separation (platform-admins) remains task 2.8; Zitadel realm config lands with staging bring-up.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
primatekuntech/failsulit#131
No description provided.