Enterprise SSO & Entity Onboarding
Zero-subdomain SAML 2.0 and OIDC federated identity setup, corporate email domain discovery, attribute mapping, and production cutover.
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.
- 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 portalhttps://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=falsein the backend environment. In production mode (NODE_ENV=production), mock login is blocked withHTTP 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
- Initiation: User navigates to unified login at
https://app.zirnay.com/auth/loginand enters corporate email (e.g.,sarah@acme.com) or tenant slug. - Domain Discovery: Frontend queries
POST /v1/auth/sso/discover. Control Plane resolvesorganizations.sso_domain = 'acme.com'and fetches the tenant IdP configuration. - 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.
- Enterprise Policy Enforcement: The customer IdP authenticates the employee, enforcing corporate MFA, hardware keys, device posture, and conditional access policies.
- Assertion Consumer Service (ACS): IdP posts the cryptographic SAML Assertion to
https://app.zirnay.com/v1/auth/sso/callback. - 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.
- Session Issuance: Zirnay issues a cryptographically signed tenant-scoped JWT (RS256/HS256) granting access to authorized models and audit logs.
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.
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.
# 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
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:
To onboard an entity, invoke the Superadmin Entity Onboarding API: POST /v1/admin/sso/organizations (or /v1/admin/organizations).
- Strict Identity Enforcement: This endpoint is exclusively accessible by Superadmins. Callers must satisfy two concurrent security conditions: (1) an active
@zirnay.comcorporate email identity, AND (2) theSUPERADMINrole. - 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). |
# 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):
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';
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 |
Detailed instructions for common enterprise identity platforms:
- Admin Console → Applications → Create App Integration.
- Sign-in method: SAML 2.0.
- App name: Zirnay Decision Platform.
- Single Sign-On URL:
https://app.zirnay.com/v1/auth/sso/callback. - Audience URI:
urn:zirnay:sp:<org-slug>. - Name ID format:
EmailAddress. - Assign to enterprise groups or directory users.
- Entra Portal → Enterprise applications → New application → Create your own.
- Select Integrate non-gallery application.
- Single sign-on → SAML.
- Identifier (Entity ID):
urn:zirnay:sp:<org-slug>. - Reply URL (ACS):
https://app.zirnay.com/v1/auth/sso/callback. - Download SAML Certificate (Base64) or copy App Federation Metadata URL.
- Admin Console → Apps → Web and mobile apps → Add custom SAML app.
- ACS URL:
https://app.zirnay.com/v1/auth/sso/callback. - Entity ID:
urn:zirnay:sp:<org-slug>. - Name ID:
Basic Information > Primary email. - Turn Service status ON for everyone.
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:
|
Validate the integration using the Discovery API before announcing general availability to corporate users:
# 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"
# }
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.