Engineering / Engineering journal

Enterprise SSO for SaaS: What to Plan

The company login button is one part of enterprise SSO. Protocols, tenant routing, provisioning, role mapping and removing access need just as much planning.

Sylantix Engineering Team6 min read
A company sign-in screen on a laptop with a physical security key.
Sylantix / Engineering journalSSO · SAML · OIDC
In this article 10 sections
TL;DR

Key takeaways

  • Split the request into authentication, provisioning and role assignment, and scope each separately.
  • Route logins to a tenant with an explicit connection and verified domains, and prefer SP-initiated flows.
  • Enforce SSO per tenant only after testing, with a break-glass admin and a plan for certificate rotation.
  • Define session lifetime and deprovisioning so a departing employee loses access within an agreed time.

What a customer means by "we need SSO"

A prospective customer asks whether employees can use their company accounts to sign in. That sounds like one login button. The next questions are usually about enforcing it, assigning access and removing someone who leaves.

Enterprise single sign-on brings the customer's identity provider (IdP) into your product, which acts as the service provider (SP). Before estimating, ask their IT team which IdP and protocol they use, who needs access and what happens to existing accounts. Those answers define a far better scope than "add SAML".

This article covers the decisions in the order they come up: protocol, login flow, tenant routing, provisioning, enforcement, roles, sessions and operations.

SAML or OIDC in practice

Both let an IdP vouch for a user. They differ in what customers ask for and how they fail.

  • SAML 2.0 exchanges signed XML assertions. It remains the default request in large enterprises and is supported by essentially every corporate IdP. It is also the harder one to implement safely: XML signature handling, clock skew and metadata exchange are common sources of bugs.
  • OpenID Connect (OIDC) is an identity layer on OAuth 2.0 with JSON tokens and a discovery document. It is simpler to build and debug, and many IdPs support it, though some customers will still insist on SAML.

Plan to support SAML first if your buyers are large organizations, and add OIDC when a customer needs it. Validate everything the protocol requires: signature, issuer, audience, expiry and, for OIDC, the nonce and state. Use a maintained library or a managed identity service instead of hand-rolling verification. Auth0's protocol overview describes the roles of OIDC, SAML and SCIM.

SP-initiated and IdP-initiated login

In an SP-initiated flow, the user starts at your product, you redirect to the IdP with a request and verify the response against it. In an IdP-initiated flow, the user clicks your app's tile in the company portal and the IdP posts an assertion with no preceding request from you.

Customers like the tile, but IdP-initiated login has weaker protection against forged or replayed responses, because there is no request to match. Support it only if a customer needs it, and then validate assertion IDs against replay and restrict it per tenant. SP-initiated should be the default.

Connect an organization, not just an email address

A consultant may belong to two customer workspaces. A large business may own several domains. Two organizations may share one IdP. An email address alone cannot resolve routing safely.

Give each customer organization its own connection configuration: IdP metadata or issuer, entity IDs and certificates. Give the sign-in flow a reliable way to select it, such as a tenant URL or a workspace step before redirecting. Auth0 documents several organization login flows that supply or discover this context.

Verify domains before using them for routing or auto-join. The customer proves control by publishing a DNS TXT record you generate. Without this, anyone could claim a competitor's domain and capture its users. Even with a verified domain, membership and tenant data isolation must still hold after authentication succeeds.

Provisioning: just-in-time or SCIM

  • Just-in-time (JIT): the account is created on first successful SSO login. It is cheap to build, but it cannot remove or update anyone who never logs in again, and inactive accounts linger.
  • SCIM 2.0: the IdP pushes create, update and deactivate events to your API. It is more work, and it is what security teams mean when they say deprovisioning.

Many first enterprise customers are satisfied with JIT; larger ones will ask for SCIM. Decide which your first release includes, and say so in the sales material.

Map groups to roles

Authentication says who the person is. Your product still decides what they may do. Typically the IdP sends a group claim, and the tenant admin maps IdP groups to your roles.

  • Default to the lowest role when no group matches.
  • Never let a claim create a role the tenant admin did not map.
  • Decide whether roles are re-evaluated at each login or only at creation.
  • Keep an owner role that does not depend on the IdP.

Enforce SSO per tenant, with a way back

Enforcement means password login is disabled for that organization. Do it per tenant, and only after a test pilot.

  • Link existing password accounts to the new identity through a deliberate verification step. Matching an email string alone is not enough to merge accounts.
  • Handle invitations sent before the change, and guest users from outside the company's domain.
  • Keep a break-glass administrator who can sign in without SSO under controlled conditions, so a broken IdP configuration does not lock the customer out. Log every use.
  • Warn admins before an expiring certificate breaks logins, and record who approved enforcement.

Sessions, logout and removing access

Disabling a person at the IdP prevents the next login, but your application session may still be live. Agree on three things with the customer: maximum session lifetime, when reauthentication is required, and what a SCIM deactivation does to active sessions (it should end them). API tokens, background jobs and objects owned by the account need an answer too, so deactivating someone does not orphan scheduled work.

Single logout is the weakest part of both protocols. SAML Single Logout is inconsistently supported, and OIDC has front-channel and back-channel logout options with uneven adoption. Do not promise instant global sign-out. Promise a bounded time, backed by short sessions or token revalidation, and test it. Ask for the customer's outcome in plain terms, such as "a departing employee loses access within one hour", and check the design achieves it. Audit logs for business software covers recording logins, role changes and enforcement events.

Certificates, metadata and test environments

SAML signing certificates expire, often every one to three years. Support loading a new certificate alongside the old one, prefer metadata URLs that update automatically where the customer allows it, and surface expiry dates in the admin screen. An expired certificate is a common cause of "SSO suddenly stopped working".

For testing, run a local OIDC or SAML IdP such as Keycloak during development, and use a free developer tenant from a major IdP vendor for realistic behavior. Test the unhappy paths: clock skew, a wrong audience, an expired assertion, a user without a group, a deactivated user and a broken configuration.

Buying versus building, and what to do first

A managed identity service can handle protocol work. Your team still owns tenant mapping, roles, onboarding screens, recovery and support. Compare options by the IdPs your customers use, connection limits, test environments, event visibility and the cost of leaving later. Confirm current features and commercial terms in the vendors' documentation.

For the first rollout, prepare an acceptance sheet with the customer's IT team: successful login, denied login, disabled user, expired session, changed role, certificate rotation and a broken connection. Each case needs an expected result and someone who verifies it. Our SaaS development service covers this product-side work alongside the identity integration.

Facing this in your own product?

Describe your situation in a few sentences. Our engineering team replies within 24-48 hours on business days, and the first 30-minute consultation is free.

Sylantix Engineering Team

Written by the senior engineers who build these systems for clients: backends, AI features, mobile apps and the infrastructure under them. Questions about your own case go straight to them.

About the team →