Z
Zirnay Documentation v2.4.1
System One Intelligence • AI Infrastructure for Decisions
Launch Playground ↗ Interactive API Explorer Strands Decider ↗
DOCS / ENTERPRISE SECURITY & IDENTITY / Enterprise SSO & Entity Onboarding

Enterprise SSO & Entity Onboarding

Zero-subdomain SAML 2.0 and OIDC federated identity setup, corporate email domain discovery, attribute mapping, and production cutover.

⏱ 6 min read • Zirnay v2.4.1 • Updated October 2026

🛡️ ENTERPRISE IDENTITY & ACCESS MANAGEMENT

Enterprise SSO & Entity Onboarding

Comprehensive architecture and operational guide for onboarding new enterprise organizations using SAML 2.0 and OIDC (OpenID Connect). Learn how Zirnay routes tenants without subdomain sprawl, how to configure Okta/Entra ID/Google Workspace, and how to safely enforce production authentication.

⚡ Core Architecture & Operational Quick Reference:
  • Do we need a subdomain for each entity? No. Zirnay uses zero-subdomain Corporate Email Domain Discovery (e.g. @acme.com → acme-financial). All users access via the unified portal https://app.zirnay.com. Optional vanity CNAMEs are supported for custom white-label branding, but are never an architectural requirement.
  • Why does the current SSO button log in automatically? In development and local sandbox environments, Zirnay enables a simulated mock bypass (ENABLE_MOCK_SSO=true) that signs in developers as a sandbox lead without needing live third-party SAML certificates.
  • How to turn it off for production? Set ENABLE_MOCK_SSO=false in the backend environment. In production mode (NODE_ENV=production), mock login is blocked with HTTP 403 MOCK_SSO_DISABLED, requiring authentic federated SAML/OIDC identity assertions.

1. How SSO Works in Zirnay: Zero-Subdomain Architecture

Zirnay decouples authentication across execution planes. While high-speed inference in the Data Plane uses sub-millisecond API keys and HMAC tokens, human operator access to the Control Plane (Web Dashboard, API Keys, Model Workbench) is secured via federated Enterprise SSO.

Federated Authentication Handshake Flow

  1. Initiation: User navigates to unified login at https://app.zirnay.com/auth/login and enters corporate email (e.g., sarah@acme.com) or tenant slug.
  2. Domain Discovery: Frontend queries POST /v1/auth/sso/discover. Control Plane resolves organizations.sso_domain = 'acme.com' and fetches the tenant IdP configuration.
  3. IdP Federation: The browser redirects to the customer's Identity Provider (Okta, Microsoft Entra ID, PingFederate, Google Workspace) with a signed SAML AuthNRequest or OIDC code authorization.
  4. Enterprise Policy Enforcement: The customer IdP authenticates the employee, enforcing corporate MFA, hardware keys, device posture, and conditional access policies.
  5. Assertion Consumer Service (ACS): IdP posts the cryptographic SAML Assertion to https://app.zirnay.com/v1/auth/sso/callback.
  6. Verification & JIT Provisioning: Zirnay validates the X.509 signature against the registered IdP cert, checks timestamp validity and audience URI, and uses Just-In-Time (JIT) provisioning to map roles.
  7. Session Issuance: Zirnay issues a cryptographically signed tenant-scoped JWT (RS256/HS256) granting access to authorized models and audit logs.
Why Subdomains Are Optional

Unlike legacy architectures that mandate individual subdomains (e.g. acme.zirnay.com), Zirnay uses dynamic email domain parsing. This eliminates DNS provisioning bottlenecks, wildcard TLS certificate re-issuance, and fragmented bookmarks.

Custom CNAME Support (White-Label)

For enterprises with strict security governance requiring custom corporate hostnames (e.g., decisions.bank.com), Zirnay supports edge CNAME delegation and automated Let's Encrypt TLS termination without modifying underlying SSO logic.

2. Production Hardening: Disabling Mock SSO

During local development, clicking "Sign In with Enterprise SSO" automatically grants access as a demo architect. In production, this bypass must be disabled to enforce real cryptographic SAML/OIDC verification.

Production Environment (.env / Secret Manager)
# Set ENABLE_MOCK_SSO to false (or omit in production; defaults to false when NODE_ENV=production):
ENABLE_MOCK_SSO=false
NODE_ENV=production

# Base URL used for SAML SP Entity ID and ACS Callback:
PUBLIC_URL=https://app.zirnay.com

# Customer IdP SAML Metadata URL or Public Certificate:
SAML_IDP_METADATA_URL=https://your-corp.okta.com/app/exk.../sso/saml/metadata
🔒 Security Enforcement: When ENABLE_MOCK_SSO=false, any attempt to bypass federated authentication via POST /v1/auth/sso/login without a valid IdP assertion is rejected immediately with HTTP 403 Forbidden:
{
  "error": "MOCK_SSO_DISABLED",
  "message": "Simulated mock SSO is disabled in production. Set ENABLE_MOCK_SSO=true for sandbox testing, or initiate federated SAML 2.0 / OIDC login via your enterprise Identity Provider."
}

3. 5-Step Entity Onboarding Guide

Follow this operational checklist to onboard a new enterprise tenant for Single Sign-On:

1 Step 1: Register Organization & Associate Email Domain (Superadmin API)

To onboard an entity, invoke the Superadmin Entity Onboarding API: POST /v1/admin/sso/organizations (or /v1/admin/organizations).

👑 Superadmin Access Control & App-Wide Permissions:
  • Strict Identity Enforcement: This endpoint is exclusively accessible by Superadmins. Callers must satisfy two concurrent security conditions: (1) an active @zirnay.com corporate email identity, AND (2) the SUPERADMIN role.
  • App-Wide Scope: Superadmins possess universal, system-wide authority across all tenant organizations, models, telemetry, and billing configurations.
  • Enforcement Guard: Any request made by non-superadmins or external email domains is immediately rejected with HTTP 403 Forbidden (FORBIDDEN_SUPERADMIN_REQUIRED).
Field Type Requirement Description
name string Required Display name of the enterprise organization (e.g. Acme Global Technologies).
sso_domain string Required Corporate email domain used for discovery (e.g. acme.com).
slug string Optional Workspace URL slug (e.g. acme-global). Auto-generated from name if omitted.
tier string Optional Subscription tier: ENTERPRISE (default) or STANDARD.
admin_email string Optional Initial customer organization admin to provision (e.g. ciso@acme.com).
budget_ceiling_cents number Optional Monthly credit ceiling in cents (default: 500000 / $5,000).
Superadmin API Request (cURL)
# Invoke Step 1 Onboarding API with Superadmin credentials (@zirnay.com + SUPERADMIN role):
curl -X POST "https://app.zirnay.com/v1/admin/sso/organizations" \
  -H "Authorization: Bearer <SUPERADMIN_JWT>" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Acme Global Technologies",
    "slug": "acme-global",
    "sso_domain": "acme.com",
    "tier": "ENTERPRISE",
    "admin_email": "admin@acme.com",
    "admin_name": "Marcus Vance (CISO)"
  }'

# 201 Created Response:
# {
#   "success": true,
#   "message": "Organization \"Acme Global Technologies\" successfully onboarded for Enterprise SSO.",
#   "organization": {
#     "id": "da8629e6-db37-4d8f-85c0-ab663624b920",
#     "name": "Acme Global Technologies",
#     "slug": "acme-global",
#     "tier": "ENTERPRISE",
#     "sso_domain": "acme.com",
#     "budget_ceiling_cents": 500000
#   },
#   "sso_configuration": {
#     "entity_id": "urn:zirnay:sp:acme-global",
#     "acs_url": "https://app.zirnay.com/v1/auth/sso/callback",
#     "slo_url": "https://app.zirnay.com/v1/auth/sso/logout",
#     "metadata_url": "https://app.zirnay.com/v1/auth/sso/metadata/acme-global"
#   },
#   "onboarded_by": {
#     "superadmin_email": "admin@zirnay.com",
#     "role": "SUPERADMIN",
#     "app_wide_scope": true
#   }
# }

Direct Database Bootstrap (Alternative for cold-start migrations):

PostgreSQL Direct Query
INSERT INTO organizations (id, name, slug, tier, sso_domain)
VALUES (gen_random_uuid(), 'Acme Global Technologies', 'acme-global', 'ENTERPRISE', 'acme.com')
ON CONFLICT (slug) DO UPDATE SET sso_domain = EXCLUDED.sso_domain, tier = 'ENTERPRISE';
2 Step 2: Service Provider (SP) Metadata Exchange

Provide the enterprise identity administrator with Zirnay's Service Provider SAML 2.0 parameters or metadata endpoint:

SAML 2.0 Parameter Value Notes
Entity ID / Audience URI urn:zirnay:sp:<org-slug> e.g. urn:zirnay:sp:acme-global
ACS URL (Assertion Consumer Service) https://app.zirnay.com/v1/auth/sso/callback Binding: HTTP-POST
Single Logout URL (SLO) https://app.zirnay.com/v1/auth/sso/logout Optional Single Logout Binding
NameID Format urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress Must match corporate email
Default RelayState <org-slug> Directs user to their designated workspace
SP Metadata URL https://app.zirnay.com/v1/auth/sso/metadata/<org-slug> Live XML/JSON metadata endpoint
3 Step 3: Identity Provider Setup Instructions

Detailed instructions for common enterprise identity platforms:

🔵 Okta SAML 2.0 Integration
  1. Admin Console → Applications → Create App Integration.
  2. Sign-in method: SAML 2.0.
  3. App name: Zirnay Decision Platform.
  4. Single Sign-On URL: https://app.zirnay.com/v1/auth/sso/callback.
  5. Audience URI: urn:zirnay:sp:<org-slug>.
  6. Name ID format: EmailAddress.
  7. Assign to enterprise groups or directory users.
🔷 Microsoft Entra ID (Azure AD)
  1. Entra Portal → Enterprise applications → New application → Create your own.
  2. Select Integrate non-gallery application.
  3. Single sign-on → SAML.
  4. Identifier (Entity ID): urn:zirnay:sp:<org-slug>.
  5. Reply URL (ACS): https://app.zirnay.com/v1/auth/sso/callback.
  6. Download SAML Certificate (Base64) or copy App Federation Metadata URL.
🟢 Google Workspace SAML
  1. Admin Console → Apps → Web and mobile apps → Add custom SAML app.
  2. ACS URL: https://app.zirnay.com/v1/auth/sso/callback.
  3. Entity ID: urn:zirnay:sp:<org-slug>.
  4. Name ID: Basic Information > Primary email.
  5. Turn Service status ON for everyone.
4 Step 4: SAML Attribute Statements & RBAC Role Mapping

Ensure the IdP maps user claims to Zirnay's expected attribute schema:

SAML Attribute Name Alternative Claims Zirnay User Field Role Mapping / Behavior
email NameID, mail, upn users.email Required. Used for unique identity and tenant domain matching.
firstName givenName, given_name users.name Captured during Just-in-Time (JIT) provisioning.
lastName sn, surname, family_name users.name Concatenated to form full display name.
roles / groups memberOf, department users.role Mapped via group rules:
  • Zirnay-Admins → ORG_ADMIN
  • Zirnay-Engineers → ML_ENGINEER
  • Default → VIEWER
5 Step 5: Testing Discovery & Production Cutover

Validate the integration using the Discovery API before announcing general availability to corporate users:

Verification cURL
# Test domain discovery for the onboarded organization:
curl -X POST "https://app.zirnay.com/v1/auth/sso/discover" \
  -H "Content-Type: application/json" \
  -d '{"email": "alex@acme.com"}'

# Expected 200 OK Response:
# {
#   "sso_enabled": true,
#   "org_id": "00000000-0000-0000-0000-000000000001",
#   "org_name": "Acme Global Technologies",
#   "org_slug": "acme-global",
#   "sso_domain": "acme.com",
#   "provider": "Okta SAML 2.0 / Entra ID",
#   "mock_mode": false,
#   "idp_redirect_url": "https://identity.zirnay.com/sso/authorize?org=acme-global&response_type=code"
# }
🚀 Enforce SSO (Block Password Login): Once verified, enable sso_enforced = true in the organization record to prevent users from bypassing SSO with passwords, ensuring 100% compliance with your enterprise IdP's conditional access policies.