## Phase 146: Sovereign Identity Provider — Okta / Auth0 / Azure AD (Entra ID) / AWS Cognito / Ping / OneLogin Replacement

Closes the identity-provider sovereignty gap. Phase 137 (platform identity) is
game-console focused. Phase 139.1.2.10 and Phase 145.12.10 consume SSO / SAML /
OIDC / SCIM — meaning every Oshun product is a relying party to a third-party
IdP. No phase currently delivers the IdP itself. Without it, every Oshun
deployment is hostage to Okta, Microsoft Entra ID (Azure AD), Auth0, AWS
Cognito, Ping Identity, OneLogin, JumpCloud, Duo, Google Workspace Identity,
ForgeRock, Keycloak (OSS reference), WSO2, or Authelia.

This phase ships a complete sovereign IdP (B2B workforce, B2C customer, machine
identity, federation, lifecycle, privileged access, compliance) so every Oshun
workspace, vendor, customer, and downstream SaaS can authenticate and authorize
against Oshun-owned identity infrastructure.

---

### 146.1 @neith/idp-core — Directory & Account Store

#### 146.1.1 Directory Schema

- [x] **146.1.1.1** User entity (id, external-id, emails, phones, attributes)
- [x] **146.1.1.2** Group / role / team entity
- [x] **146.1.1.3** Organization / tenant / sub-tenant hierarchy
- [x] **146.1.1.4** Organizational units / OU tree
- [x] **146.1.1.5** Service account / machine identity
- [x] **146.1.1.6** Device identity (managed endpoint)
- [x] **146.1.1.7** Workload identity (SPIFFE SVID-compatible)
- [x] **146.1.1.8** Application / relying-party entity
- [x] **146.1.1.9** Entitlement / license / seat tracking
- [x] **146.1.1.10** Custom-attribute schema per tenant

#### 146.1.2 Storage

- [x] **146.1.2.1** Postgres primary with logical replication
- [x] **146.1.2.2** Column-level encryption for PII
- [x] **146.1.2.3** Soft-delete with tombstone retention
- [x] **146.1.2.4** Audit-history per record
- [x] **146.1.2.5** Multi-region active-active option
- [x] **146.1.2.6** Per-tenant data-residency routing
- [x] **146.1.2.7** Key-rotation with re-encrypt pipeline
- [x] **146.1.2.8** Online schema migration
- [x] **146.1.2.9** Hot + cold backup with verified restore drills
- [x] **146.1.2.10** Horizontal shard by tenant-id

---

### 146.2 @neith/idp-authn — Authentication Protocols

#### 146.2.1 Credentials

- [x] **146.2.1.1** Password (Argon2id / bcrypt / scrypt)
- [x] **146.2.1.2** Breached-password check (Have I Been Pwned k-anon API +
      offline)
- [x] **146.2.1.3** Passkey / WebAuthn (FIDO2, resident keys, passkey sync)
- [x] **146.2.1.4** TOTP (RFC 6238) with enrolment QR
- [x] **146.2.1.5** Push MFA (out-of-band approve)
- [x] **146.2.1.6** SMS / voice OTP (fraud-aware, OTP spray defense)
- [x] **146.2.1.7** Email magic link
- [x] **146.2.1.8** Backup / recovery codes
- [x] **146.2.1.9** Hardware security key (YubiKey, TKey, sovereign)
- [x] **146.2.1.10** Smart-card / CAC / PIV
- [x] **146.2.1.11** Biometric (fingerprint, Face ID) attestation
- [x] **146.2.1.12** Risk-based step-up (impossible travel, new device)
- [x] **146.2.1.13** Adaptive MFA based on signal score
- [x] **146.2.1.14** Single-use bootstrap enrolment token
- [x] **146.2.1.15** mTLS client-cert authentication

#### 146.2.2 Protocol Endpoints

- [x] **146.2.2.1** OpenID Connect 1.0 (core + discovery + dynamic registration)
- [x] **146.2.2.2** OAuth 2.1 authorization server (PKCE mandatory)
- [x] **146.2.2.3** OAuth 2 device-authorization-grant
- [x] **146.2.2.4** OAuth 2 token-exchange (RFC 8693)
- [x] **146.2.2.5** OAuth 2 refresh-token rotation + reuse detection
- [x] **146.2.2.6** DPoP / mutual-TLS sender-constrained tokens
- [x] **146.2.2.7** SAML 2.0 IdP (SP-init + IdP-init)
- [x] **146.2.2.8** SAML 2.0 SP (for federated IdP consumption)
- [x] **146.2.2.9** WS-Federation / WS-Trust
- [x] **146.2.2.10** CAS 3.0
- [x] **146.2.2.11** Kerberos / SPNEGO integrated Windows auth
- [x] **146.2.2.12** LDAP / LDAPS server compatible with AD schema
- [x] **146.2.2.13** RADIUS server for VPN / WiFi auth
- [x] **146.2.2.14** Sign-in-with-Apple / Google / Microsoft social IdP
- [x] **146.2.2.15** Passkey auto-fill with CTAP2 / ClientToAuthenticator

---

### 146.3 @neith/idp-authz — Authorization, RBAC & ABAC

#### 146.3.1 Policy Model

- [x] **146.3.1.1** Roles (basic, scoped, hierarchical, inherited)
- [x] **146.3.1.2** Permissions catalog per application
- [x] **146.3.1.3** Resource-scoped assignment (org / group / project /
      resource)
- [x] **146.3.1.4** ABAC policy with CEL / Cedar / Rego
- [x] **146.3.1.5** Conditional-access policy (device, geo, time, risk)
- [x] **146.3.1.6** Relationship-based access (ReBAC / Zanzibar-style)
- [x] **146.3.1.7** Attribute propagation (user → group → role → policy)
- [x] **146.3.1.8** Temporal access (just-in-time privilege)
- [x] **146.3.1.9** Emergency break-glass role
- [x] **146.3.1.10** Separation-of-duty (SoD) rule enforcement

#### 146.3.2 Decision Runtime

- [x] **146.3.2.1** Policy-decision point (PDP) with sub-millisecond latency
- [x] **146.3.2.2** Policy-information point (PIP) for dynamic attributes
- [x] **146.3.2.3** Policy-enforcement-point (PEP) SDK
- [x] **146.3.2.4** Policy-administration-point (PAP) console
- [x] **146.3.2.5** Policy simulation (who-can-do-what)
- [x] **146.3.2.6** Policy coverage / gap detector
- [x] **146.3.2.7** Deny-by-default vs. allow-by-default mode
- [x] **146.3.2.8** Policy versioning + rollback
- [x] **146.3.2.9** Policy-testing DSL (unit + integration)
- [x] **146.3.2.10** Per-tenant policy isolation

---

### 146.4 @neith/idp-federation — External IdP Federation

- [x] **146.4.1** Social login (Google, Apple, Microsoft, GitHub, Facebook,
      LinkedIn, X, Discord)
- [x] **146.4.2** Enterprise federation (Okta, Azure AD, Google Workspace,
      Auth0, Ping, OneLogin, ADFS)
- [x] **146.4.3** Generic SAML 2.0 SP-init consumption
- [x] **146.4.4** Generic OIDC federation
- [x] **146.4.5** JIT provisioning on first federated login
- [x] **146.4.6** Attribute mapping DSL per federation
- [x] **146.4.7** Home-realm discovery by email domain
- [x] **146.4.8** Identity-hub pattern (IdP-in-front-of-IdP)
- [x] **146.4.9** Cross-tenant sharing (B2B) with guest-user model
- [x] **146.4.10** External-user expiry and re-verification

---

### 146.5 @neith/idp-scim — Lifecycle & Provisioning

#### 146.5.1 SCIM 2.0

- [x] **146.5.1.1** SCIM 2.0 server endpoints (Users, Groups, Schemas,
      ResourceTypes)
- [x] **146.5.1.2** PATCH with path / replace / remove / add
- [x] **146.5.1.3** Bulk operations
- [x] **146.5.1.4** Search filter expression (eq, ne, co, sw, ew, pr, gt, ge,
      lt, le)
- [x] **146.5.1.5** SCIM discovery
- [x] **146.5.1.6** Custom extension schemas per tenant
- [x] **146.5.1.7** SCIM client to provision downstream SaaS
- [x] **146.5.1.8** Replay-safe provisioning with idempotency keys
- [x] **146.5.1.9** Just-in-time vs. ahead-of-time provisioning
- [x] **146.5.1.10** SCIM API conformance test suite

#### 146.5.2 Lifecycle Automation

- [x] **146.5.2.1** HR-system-of-record connector (Workday, BambooHR, Rippling,
      sovereign)
- [x] **146.5.2.2** Joiner flow (onboarding automation, hardware provisioning
      trigger)
- [x] **146.5.2.3** Mover flow (transfer / role-change)
- [x] **146.5.2.4** Leaver flow (immediate deprovisioning, data preservation)
- [x] **146.5.2.5** Contractor / intern time-boxed access
- [x] **146.5.2.6** Birthright-entitlement assignment
- [x] **146.5.2.7** Dynamic group based on attribute
- [x] **146.5.2.8** Delegated-admin access-request approvals
- [x] **146.5.2.9** Access-certification / attestation campaigns
- [x] **146.5.2.10** Dormant account detection + auto-disable

Verification (2026-07-13): package-scoped TypeScript and ESLint gates pass; the
SCIM and lifecycle Vitest suite passes 18 tests across two files, including
tenant isolation, ETags, bulk references, extension validation, replay safety,
connector boundaries, access-source reconciliation, certification, and expiry.

---

### 146.6 @neith/idp-mfa — Strong Authentication Stack

- [x] **146.6.1** FIDO2 / WebAuthn (platform + roaming)
- [x] **146.6.2** Passkey sync with iCloud / Google / sovereign
- [x] **146.6.3** TOTP / HOTP
- [x] **146.6.4** Push approve (out-of-band via Neith Mobile app)
- [x] **146.6.5** Number-matching push (block push-spray)
- [x] **146.6.6** Hardware OTP tokens (RSA-compatible seed import)
- [x] **146.6.7** Smart card / PIV / CAC
- [x] **146.6.8** Biometric-only step-up
- [x] **146.6.9** Risk-based / adaptive MFA
- [x] **146.6.10** Geo-velocity / impossible-travel
- [x] **146.6.11** Device-trust posture (EDR / MDM signal)
- [x] **146.6.12** Phishing-resistant policy enforcement
- [x] **146.6.13** MFA reset workflow with identity proofing
- [x] **146.6.14** Recovery factor rotation
- [x] **146.6.15** Emergency break-glass codes printed + sealed

Verification (2026-07-13): strict TypeScript and ESLint gates pass for both the
MFA orchestrator and its authentication-primitives dependency. Vitest passes 13
MFA orchestration tests and 27 underlying authentication tests, covering
platform and roaming WebAuthn, all sync providers, OTP replay defense, mobile
number matching, encrypted atomic seed import, signed PIV and biometric proof,
posture and geo-risk decisions, proofed reset, recovery rotation, and sealed
dual-custodian break-glass use.

---

### 146.7 @neith/idp-b2c — Customer Identity (CIAM)

- [x] **146.7.1** Self-service sign-up with progressive profile
- [x] **146.7.2** Passwordless-first default
- [x] **146.7.3** Social-login with account-linking on email match
- [x] **146.7.4** Email / phone verification
- [x] **146.7.5** Pre-registration flags (consent, marketing opt-in)
- [x] **146.7.6** Profile self-service + preferences
- [x] **146.7.7** Account-deletion (GDPR) workflow
- [x] **146.7.8** Anonymous-to-authenticated merge (Phase 142.2)
- [x] **146.7.9** Family / parental-consent flows
- [x] **146.7.10** Age-gate / KYC / e-ID verification (eIDAS, VOICE, etc.)
- [x] **146.7.11** Fraud signal (velocity, device, proxy, disposable email)
- [x] **146.7.12** Bot-defense (challenge, hCaptcha-class, turnstile)
- [x] **146.7.13** Login-throttle / lock-out
- [x] **146.7.14** Progressive MFA (opt-in → nudge → require)
- [x] **146.7.15** Per-brand / per-region UI theming

Verification (2026-07-13): strict TypeScript and ESLint gates pass, and the CIAM
Vitest suite passes 10 tests. Coverage includes passwordless ordering,
progressive profile and consent history, verified social linking, one-time
email/phone verification, anonymous merge, deletion erasure, guardian and e-ID
proof, fraud/bot defenses, distributed lockout, progressive MFA, and regional
theme fallback with cardless composition, restrained/reduced motion, and WCAG AA
color validation.

---

### 146.8 @neith/idp-workload — Machine & Service Identity

- [x] **146.8.1** SPIFFE ID / SVID (x509 + JWT) issuance
- [x] **146.8.2** SPIRE-compatible node + workload attestation
- [x] **146.8.3** Short-lived workload tokens with automatic rotation
- [x] **146.8.4** Mutual-TLS PKI integrated
- [x] **146.8.5** Kubernetes projected service-account token (TokenRequest)
- [x] **146.8.6** Cloud-metadata-IMDS compatibility layer
- [x] **146.8.7** GitHub-Actions / GitLab / Neith CI OIDC federation (Phase
      145.6.5)
- [x] **146.8.8** Secret-less deploy via OIDC to AWS / GCP / Azure
- [x] **146.8.9** HashiCorp Vault agent sidecar compatibility
- [x] **146.8.10** Cert-manager / cert-bot integration

Verification (2026-07-13): strict TypeScript and ESLint gates pass, and the
workload identity Vitest suite passes 11 tests. Coverage includes node and
workload attestation, bounded X.509 and JWT SVID issuance and rotation, mTLS
authorization, projected Kubernetes service-account token exchange, hop-limited
IMDS adapters, replay-resistant GitHub/GitLab/Neith CI federation, temporary
AWS/GCP/Azure deployment credentials, Vault agent injection, and rotating
cert-manager/certbot plans.

---

### 146.9 @neith/idp-priv — Privileged-Access Management (PAM)

- [x] **146.9.1** Just-in-time privileged elevation
- [x] **146.9.2** Approval-required elevation flow
- [x] **146.9.3** Session recording (kbd / pty / display)
- [x] **146.9.4** Credential vaulting for shared accounts
- [x] **146.9.5** Ephemeral-credential injection (SSH cert, DB cert)
- [x] **146.9.6** Bastion / jump-host with zero-trust
- [x] **146.9.7** Break-glass with dual-control
- [x] **146.9.8** Privileged-task auditor
- [x] **146.9.9** Dormant-privileged-account flagger
- [x] **146.9.10** Integration with Neith CI/CD deploy gates (Phase 145.7)

Verification (2026-07-13): strict TypeScript and ESLint gates pass, and the PAM
Vitest suite passes 10 tests. Coverage includes independent hardware-MFA JIT
approval, automatic expiry, dual-control break-glass, tamper-evident keyboard,
PTY, and display recording with redaction, envelope-vaulted shared accounts,
bounded SSH/database certificates, zero-trust bastion routing, privileged-task
audit integrity, dormant account detection, and production deployment gates.

---

### 146.10 @neith/idp-monitor — Audit, Risk & Detection

- [x] **146.10.1** Immutable audit log (hash-chained)
- [x] **146.10.2** SIEM export (syslog, CEF, OCSF, OTEL)
- [x] **146.10.3** Per-user activity timeline
- [x] **146.10.4** Risk-score engine (geo, device, velocity, anomaly)
- [x] **146.10.5** Compromised-credential alerts
- [x] **146.10.6** Phishing-campaign detector
- [x] **146.10.7** Honey-credential / honey-token seeding
- [x] **146.10.8** Identity-threat detection response (ITDR) playbooks
- [x] **146.10.9** UEBA (user + entity behaviour analytics) baseline
- [x] **146.10.10** Insider-threat dashboard
- [x] **146.10.11** MFA bypass / fatigue detector
- [x] **146.10.12** Token-theft / replay detector (DPoP-aware)
- [x] **146.10.13** Brute-force / credential-stuffing defense
- [x] **146.10.14** Regulator-export report (SOX, HIPAA, SOC2, ISO27001,
      FedRAMP)
- [x] **146.10.15** Integration with Neith Metron (Phase 142) for admin
      analytics

Verification (2026-07-13): strict TypeScript and ESLint gates pass, and the
identity-monitoring Vitest suite passes 14 tests. Coverage includes hash-chain
integrity, per-user timelines, syslog/CEF/OCSF/OTEL exports, regulator evidence,
Metron metrics, multi-signal risk, UEBA and insider ranking, compromised and
phishing alerts, honey credentials and allowlisted ITDR actions, MFA fatigue,
DPoP replay, and successful credential-stuffing detection.

---

### 146.11 @neith/idp-console — Admin & User Experience

- [x] **146.11.1** Admin console (multi-tenant)
- [x] **146.11.2** Delegated-admin UI (per-OU)
- [x] **146.11.3** Bulk import / export
- [x] **146.11.4** Dry-run policy change with impact preview
- [x] **146.11.5** Self-service end-user portal
- [x] **146.11.6** Access-request / approval chat flow
- [x] **146.11.7** Access-review (attestation) UI
- [x] **146.11.8** Access-certification campaign runner
- [x] **146.11.9** Recovery / account-unlock UI
- [x] **146.11.10** Configurable-branded login
- [x] **146.11.11** Mobile authenticator app (iOS + Android)
- [x] **146.11.12** Desktop companion app (push + hardware-key helper)
- [x] **146.11.13** Chrome / Safari / Firefox / Neith Browser extension
- [x] **146.11.14** Terminal CLI (`neith-idp login`, `neith-idp impersonate`)
- [x] **146.11.15** Accessibility (WCAG 2.2 AA) on every flow

Verification (2026-07-13): strict TypeScript and ESLint gates pass, 10 console
domain tests pass, and three Playwright tests pass. Browser coverage exercises
keyboard-operated policy, approval, review, and recovery flows, a 390 px mobile
layout, and automated WCAG 2.2 AA checks with no serious or critical axe
violations. Domain coverage includes tenant/OU isolation, bulk dry runs,
self-service, certification, biometric number-match push, hardware-key helpers,
cross-browser extension policy, and audited CLI impersonation.

---

### 146.12 @neith/idp-sdk — Relying-Party SDKs

- [x] **146.12.1** TypeScript / JavaScript SDK (browser + Node)
- [x] **146.12.2** React / Vue / Svelte helpers
- [x] **146.12.3** Swift (iOS / macOS / visionOS / watchOS / tvOS)
- [x] **146.12.4** Kotlin / Java (Android / JVM server)
- [x] **146.12.5** Rust / Go / Python / Ruby / PHP / .NET server
- [x] **146.12.6** Neith Engine / Unity / Unreal session helper
- [x] **146.12.7** WASM-based universal client
- [x] **146.12.8** CLI SDK for automation
- [x] **146.12.9** Keyrock-compatible Kubernetes operator
- [x] **146.12.10** Terraform / Pulumi provider
- [x] **146.12.11** REST + gRPC + GraphQL API parity
- [x] **146.12.12** Webhooks (signed) for downstream consumers
- [x] **146.12.13** Event stream (Kafka / NATS) for identity events
- [x] **146.12.14** Mock-IdP test harness
- [x] **146.12.15** Sample apps per language

Verification (2026-07-13): strict TypeScript and ESLint gates pass, and the
relying-party SDK Vitest suite passes 9 tests. Coverage includes the universal
client and mock IdP, React/Vue/Svelte and CLI bindings, all requested native and
server language plans, engine and WASM ABIs, Keyrock and infrastructure
providers, transport parity, replay-bounded webhooks, Kafka/NATS fanout, and
issuer/audience-validating sample applications.

---

### 146.13 Migration & Interop

- [x] **146.13.1** Okta tenant import (users, groups, apps, policies)
- [x] **146.13.2** Auth0 tenant import
- [x] **146.13.3** Entra ID / Azure AD tenant import (Graph API)
- [x] **146.13.4** AWS Cognito user pool import
- [x] **146.13.5** Keycloak realm export/import
- [x] **146.13.6** JumpCloud / Ping / OneLogin import
- [x] **146.13.7** LDAP / AD bulk sync
- [x] **146.13.8** Password-hash migration (salt-rehash on first login)
- [x] **146.13.9** Zero-downtime cutover checklist
- [x] **146.13.10** Dual-issuance period (old + new) with fallback

Verification (2026-07-13): strict TypeScript and ESLint gates pass, and the
identity-migration Vitest suite passes 12 tests. Coverage includes normalized
users, groups, applications, and policies for every listed SaaS provider, paged
LDAP/AD cursors, legacy-hash verification and first-login replacement,
evidence-backed cutover readiness, bounded dual issuance, legacy outage
tolerance, and automatic fallback shutdown.
