Documentation base URLs use placeholder https://{your-tenant}.sso.id. Log in to show your tenant or custom domain.
Log in for Your Tenant URL
Chapter 6 — B2B Customer Onboarding (Tier 3 Cascade)

B2B Customer Organizations & Policy Overrides

Selling a multi-tenant B2B SaaS product? Model each enterprise customer as an Organization ( /organizations) inside your Tenant. Give every customer their own co-branded login screen, dedicated SAML 2.0 / OIDC Identity Provider, custom JWT claims, password/session policies, and mandatory MFA rules — without spinning up separate infrastructure.

B2B Architecture Story: Onboarding Three Enterprise Customers with Conflicting Security Rules

How CloudPulse Serves Startup, Healthcare, and Banking Customers from One Codebase

CloudPulse runs a single multi-tenant SaaS application (app.cloudpulse.io), but their three largest B2B customers have wildly different contractual security mandates:

  • Customer A (TechStart Inc.): Wants employees to log in with Google OAuth 2.0 and stay signed in for 7 days.
  • Customer B (Apex Healthcare): Requires HIPAA compliance, Microsoft Entra ID OIDC login, 15-minute idle session timeout, and mandatory TOTP + Email MFA.
  • Customer C (GlobalBank Corp): Demands their own GlobalBank logo and navy-blue theme on the login screen, Okta SAML 2.0 federation hidden from all other customers (assignToOrganizationOnly), and FIDO2 Hardware Passkeys.
The SSO.ID v2 Solution: CloudPulse creates three Organizations in /organizations. Each Organization sits at Tier 3 of the Policy Inheritance Cascade (Tenant → Application → Organization → Organization Unit) and toggles only the overrides it needs (overrideBranding, overrideSecurity, overrideTokens, overrideMfa).

1. How the Tier-3 Organization Override Cascade Works

By default, a newly created Organization inherits 100% of its settings from the parent Application and Tenant. Flipping any of the five override switches inside the Organization Setting Dialog activates custom policies exclusively for users authenticating under that Organization:

Flow Diagram B2B Organization & Organization Unit Isolation Flow
flowchart TD T["Tenant Baseline (/settings)"] --> APP["Application (/applications)"] APP --> ORG1["Org A: Acme Corp (Default Policies)"] APP --> ORG2["Org B: GlobalBank (Custom Branding + Okta SAML + FIDO2)"] ORG2 --> OU1["OU: EU Branch (GDPR + Regional MFA)"] ORG2 --> OU2["OU: US Branch (SOC2 + Hardware Keys)"] OU1 --> TOK["Scoped OIDC/SAML Token (org_id + ou_id + roles)"] OU2 --> TOK
Each B2B customer Organization and sub-department OU inherits Tenant/App defaults and selectively overrides Branding, IdP Connections, Security, or MFA.
https://cloudpulse.us.beta.sso.id/organizations Click to zoom
B2B Organizations console at /organizations for managing Tier-3 customer overrides, co-branding, and home-realm discovery.
B2B Organizations console at /organizations for managing Tier-3 customer overrides, co-branding, and home-realm discovery.
Override Flag What You Can Customize Per B2B Customer Organization
overrideGeneral Organization display name, customer support email/URL, self-registration toggle, and default redirect behavior.
overrideBranding Customer logo, favicon, primary/accent hex colors, background gradient/image, login card alignment, and co-branded split-screen messaging.
overrideSecurity Customer-specific password complexity (e.g., 14+ chars, 90-day rotation), brute-force lockout threshold, session idle/absolute timeouts, and IP/Country allowlists.
overrideTokens Custom Access Token / ID Token / Refresh Token TTLs and organization-specific custom JWT claims (org_id, org_name, customer_tier).
overrideMfa Enforce MFA specifically for this customer, require Multi-Factor Step-Up (requireMultipleFactors), or mandate FIDO2 Passkeys (fido2PasskeysEnabled).

2. Managing Connections, Groups, MFA & Users in an Organization

1

Dedicated Identity Connections (GET / POST / DELETE /api/organizations/{id}/connections)

Link the customer's SAML 2.0 or OIDC connection to their Organization. When a connection has assignToOrganizationOnly: true, it is completely invisible on your public login screen and appears only when authenticating into this Organization.

2

Organization Users & Application Roles (GET / POST /api/organizations/{organizationId}/users)

Assign users to the Organization and grant them specific Application Roles scoped to that customer (DELETE /api/organizations/{organizationId}/users/{userId}/roles/{roleId}).

3

Groups & MFA Factors (/groups & /factors)

Attach cohorts via POST /api/organizations/{id}/groups and configure organization-level MFA factors via PUT /api/organizations/{id}/factors.

3. Triggering Organization-Scoped Login at Runtime

To authenticate a user into a specific B2B Organization, pass organizationId to the Auth.SSO.Id Authorization endpoint:

GET https://{your-tenant}.sso.id/auth/oauth/authorize (With B2B Organization Context)
https://{your-tenant}.sso.id/auth/oauth/authorize?
  client_id=vvzmXqvkLfnMDtUJPChKn
  &response_type=code
  &redirect_uri=https%3A%2F%2Fapp.cloudpulse.io%2Fcallback
  &scope=openid%20profile%20email%20roles%20offline_access
  &organizationId=6c4a8f12-9b30-4e11-8d2a-112233445566
  &code_challenge=E9Melhoa2OwvFrGMTJgu...
  &code_challenge_method=S256
  &state=xyz987

4. Organization REST API Reference & AI Prompt

Method Endpoint Description
GET / POST https://{your-tenant}.sso.id/api/organizations Lists all B2B organizations or creates a new organization (PUT / DELETE /api/organizations/{id}).
GET / POST / DELETE https://{your-tenant}.sso.id/api/organizations/{id}/connections Lists, links, or unlinks (DELETE .../connections/{connectionId}) identity connections for an organization.
GET / POST / DELETE https://{your-tenant}.sso.id/api/organizations/{id}/groups Lists, links, or unlinks (DELETE .../groups/{groupId}) user groups for an organization.
GET / PUT https://{your-tenant}.sso.id/api/organizations/{id}/factors Gets or updates MFA factors enforced for the organization (GET .../available-factors lists options).
GET / POST / DELETE https://{your-tenant}.sso.id/api/organizations/{organizationId}/users Manages organization members and their organization-scoped application roles.

Tier-3 B2B Organization Management API Specifications

Below is the complete parameter-level specification for every endpoint in this module. Tenant context is automatically resolved from the signed Bearer JWT token claims or the tenant domain URL (no custom tenant header is required).

GET https://{your-tenant}.sso.id/api/organizations
Bearer JWT

Lists all Tier-3 B2B Customer Organizations in the tenant workspace. To fetch a single organization by ID, call GET /api/organizations/{id}.

Request Parameters
Parameter Type Required Description & Constraints
Authorization Header string Required Bearer JWT access token (Bearer eyJhbG...). Tenant context is resolved automatically from the token claims or request domain URL.
Response Fields & Schema
Field Type Description
organizationId string (UUID) Unique Organization UUID.
name string B2B customer organization name.
logo string Co-branded logo URL or base64 data URI.
primaryColor string Hex primary brand color for the organization's login portal.
backgroundColor string Hex background color override.
status boolean Active/suspended status of the organization.
isDefaultAuthenticationEnabled boolean Whether standard password login is allowed alongside federated IdPs.
organizationSettings string (JSON) Serialized Tier-3 policy override configuration.
Sample Request
curl -X GET "https://{your-tenant}.sso.id/api/organizations" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..."
Expected Response 200 OK
[
  {
    "organizationId": "org_5512a-99b1-4c22-8d33-112233445566",
    "name": "Acme Global Logistics",
    "logo": "https://cdn.acmelogistics.com/logo.png",
    "primaryColor": "#0284c7",
    "backgroundColor": "#f8fafc",
    "status": true,
    "isDefaultAuthenticationEnabled": false
  }
]
POST https://{your-tenant}.sso.id/api/organizations
Bearer JWT

Creates a new Tier-3 B2B Customer Organization with optional custom login branding and security policy overrides. To update an existing organization, call PUT /api/organizations/{id}; to delete, call DELETE /api/organizations/{id}.

Request Parameters
Parameter Type Required Description & Constraints
Authorization Header string Required Bearer JWT access token (Bearer eyJhbG...). Tenant context is resolved automatically from the token claims or request domain URL.
name Body string Required Customer organization display name (1-150 characters).
logo Body string Optional Organization logo URL or base64 image string.
primaryColor Body string Optional Hex accent color (e.g., #0284c7).
backgroundColor Body string Optional Hex background color for hosted login screen.
status Body boolean Optional Set to true (Active) or false (Suspended).
isDefaultAuthenticationEnabled Body boolean Optional Allow email/password authentication in addition to federated SAML/OIDC connections.
organizationSettings Body string (JSON) Optional Serialized JSON containing Tier-3 policy overrides (overrideBranding, overrideMfa, overrideSecurity, allowed IP CIDRs, session timeouts).
Response Fields & Schema
Field Type Description
organizationId string (UUID) Newly created Organization UUID (pass as &organizationId=... to /oauth/authorize for org-scoped login).
name string Organization name.
status boolean Organization active status.
createdOn string (ISO 8601) Creation timestamp.
Sample Request
curl -X POST "https://{your-tenant}.sso.id/api/organizations" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Stark Aerospace Corp",
    "logo": "https://cdn.starkaero.com/brand/shield.png",
    "primaryColor": "#dc2626",
    "backgroundColor": "#ffffff",
    "status": true,
    "isDefaultAuthenticationEnabled": false,
    "organizationSettings": "{\"overrideBranding\":true,\"overrideMfa\":true,\"requireMfa\":true}"
  }'
Expected Response 201 Created
{
  "organizationId": "org_778899aa-bbcc-4dde-9ff0-112233445566",
  "name": "Stark Aerospace Corp",
  "primaryColor": "#dc2626",
  "status": true,
  "createdOn": "2026-11-19T12:35:00Z"
}
POST https://{your-tenant}.sso.id/api/organizations/{id}/connections
Bearer JWT

Links an enterprise SAML 2.0, OIDC, or OAuth 2.0 Connection to a specific B2B Organization so that only members of this organization authenticate through that IdP. Use GET /api/organizations/{id}/connections to list linked connections, PUT /api/organizations/{id}/connections/{connectionId} to update JIT flags, and DELETE /api/organizations/{organizationId}/connections/{connectionId} to unlink.

Request Parameters
Parameter Type Required Description & Constraints
Authorization Header string Required Bearer JWT access token (Bearer eyJhbG...). Tenant context is resolved automatically from the token claims or request domain URL.
id Path string (UUID) Required Target Organization UUID.
organizationId Body string (UUID) Required Target Organization UUID.
connectionId Body string (UUID) Required Connection UUID to link to this organization.
enableAutoProvisioning Body boolean Optional When true, users logging in via this connection are automatically added as members of this Organization via JIT.
Response Fields & Schema
Field Type Description
organizationId string (UUID) Organization UUID.
connectionId string (UUID) Linked Connection UUID.
enableAutoProvisioning boolean JIT provisioning status.
Sample Request
curl -X POST "https://{your-tenant}.sso.id/api/organizations/org_778899aa/connections" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "organizationId": "org_778899aa",
    "connectionId": "con_88a12b34",
    "enableAutoProvisioning": true
  }'
Expected Response 200 OK
{
  "organizationId": "org_778899aa",
  "connectionId": "con_88a12b34",
  "enableAutoProvisioning": true,
  "createdOn": "2026-11-19T12:36:00Z"
}
POST https://{your-tenant}.sso.id/api/organizations/{organizationId}/users
Bearer JWT

Adds a directory User as a member of a B2B Organization. Use GET /api/organizations/{organizationId}/users to list members and DELETE /api/organizations/{organizationId}/users/{userId} to remove a member. Groups can similarly be linked via POST /api/organizations/{id}/groups.

Request Parameters
Parameter Type Required Description & Constraints
Authorization Header string Required Bearer JWT access token (Bearer eyJhbG...). Tenant context is resolved automatically from the token claims or request domain URL.
organizationId Path string (UUID) Required Target Organization UUID.
organizationId Body string (UUID) Required Target Organization UUID.
userId Body string (UUID) Required User UUID to assign to the organization.
Response Fields & Schema
Field Type Description
organizationId string (UUID) Organization UUID.
userId string (UUID) Assigned User UUID.
createdOn string (ISO 8601) Membership creation timestamp.
Sample Request
curl -X POST "https://{your-tenant}.sso.id/api/organizations/org_778899aa/users" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "organizationId": "org_778899aa",
    "userId": "usr_9f8e7d6c-5b4a-3c2d-1e0f-9a8b7c6d5e4f"
  }'
Expected Response 200 OK
{
  "organizationId": "org_778899aa",
  "userId": "usr_9f8e7d6c-5b4a-3c2d-1e0f-9a8b7c6d5e4f",
  "createdOn": "2026-11-19T12:37:00Z"
}
POST https://{your-tenant}.sso.id/api/organizations/{id}/factors
Bearer JWT

Enables an MFA factor override for a Tier-3 B2B Organization. Use GET /api/organizations/{id}/factors to list factors, PUT /api/organizations/{id}/factors/{factorId} to update, and DELETE /api/organizations/{organizationId}/factors/{factorId} to remove.

Request Parameters
Parameter Type Required Description & Constraints
Authorization Header string Required Bearer JWT access token (Bearer eyJhbG...). Tenant context is resolved automatically from the token claims or request domain URL.
id Path string (UUID) Required Target Organization UUID.
organizationId Body string (UUID) Required Target Organization UUID.
factorId Body integer (int64) Required MFA Factor ID (e.g., 1 = TOTP, 2 = Passkey, 3 = Email OTP, 4 = SMS OTP).
factorType Body string Required Factor type identifier (TOTP, PASSKEY, EMAIL, SMS).
isUserCanManage Body boolean Optional Whether end users in this organization can self-manage enrollment for this factor.
Response Fields & Schema
Field Type Description
organizationId string (UUID) Organization UUID.
factorId integer (int64) Enabled Factor ID.
factorType string Factor type.
Sample Request
curl -X POST "https://{your-tenant}.sso.id/api/organizations/org_778899aa/factors" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "organizationId": "org_778899aa",
    "factorId": 2,
    "factorType": "PASSKEY",
    "isUserCanManage": true
  }'
Expected Response 200 OK
{
  "organizationId": "org_778899aa",
  "factorId": 2,
  "factorType": "PASSKEY",
  "isUserCanManage": true
}
AI Agent Prompt Implement Automated B2B Customer Organization Onboarding & Subdomain/Org Login Routing
You are a multi-tenant B2B SaaS architect. Implement **Automated B2B Customer Organization Provisioning and Login Routing** using **SSO.ID v2** (`https://{your-tenant}.sso.id/api` and `https://{your-tenant}.sso.id/auth`).

### 1. Backend Onboarding Provisioner (`createEnterpriseCustomerWorkspace`)
When a new B2B customer signs up in our SaaS billing flow:
1. Call `POST https://{your-tenant}.sso.id/api/organizations` with their company name, custom branding (`overrideBranding: true`, logo, primary color), and security policies.
2. Link the new `organizationId` to our SaaS Application via `POST https://{your-tenant}.sso.id/api/applications/{appId}/organizations`.
3. Invite the customer's initial IT Admin via `POST https://{your-tenant}.sso.id/api/users/invite` and assign them to the Organization via `POST https://{your-tenant}.sso.id/api/organizations/{organizationId}/users`.

### 2. Frontend Subdomain / Workspace Login Router
When a user visits `https://{customer-slug}.ourapp.com/login`:
1. Resolve `{customer-slug}` to their SSO.ID `organizationId`.
2. Redirect to `GET https://{your-tenant}.sso.id/auth/oauth/authorize` with PKCE (`S256`) and `&organizationId=${organizationId}` so SSO.ID renders that customer's co-branded login screen and dedicated SAML/OIDC Identity Provider.