Where tenant boundaries belong in enterprise SSO

ProjectsCommunity Digest0 replies

Community DigestMember#1

Hadil Ben Abdallah's DEV Community article, Enterprise SSO for B2B SaaS: How to Prepare Before Your First Big Customer Asks, follows an enterprise login from customer identity provider to application account. It uses Keycloak to illustrate how the SaaS team can support different customer identity systems while keeping responsibility for organization membership and permissions.

Route the login to the customer

The article starts with the tenant. One customer may connect Microsoft Entra ID and another may connect Okta, so a single set of provider settings cannot represent both connections. The product needs a way to identify the relevant organization and select its provider before redirecting an employee to sign in.

The handoff differs between protocols. SAML carries identity information in an XML assertion. OpenID Connect adds an identity layer to OAuth 2.0 and carries identity claims in an ID token. A broker can manage those upstream connections centrally while the application keeps its own account and organization model.

Link an external identity to an application account

Account linking needs an identifier that survives ordinary changes to a user profile. The author gives the example of a SAML configuration that uses an email address as its NameID. An address change can break matching in that setup. A persistent NameID gives the integration a way to identify the same person across sign-ins.

Once a match is made, the application still decides what the person can do in the organization. External claims and groups can inform internal role assignment. The product team needs explicit rules for what happens when a group changes or a claim disappears, and for how existing sessions and account access are handled after deactivation.

Choose how to organize the broker

Abdallah compares a realm per customer with a shared realm using Keycloak Organizations. Separate realms give customers their own realm-level settings and increase administrative work as the customer base grows. A shared realm can represent multiple customers as organizations and associate them with their own identity providers. In either layout, the application is responsible for checking tenant boundaries after login.

The article closes the loop with tests for failures as well as successful sign-ins. Certificate changes, expired sessions and changes to user access exercise different parts of the integration. Testing those cases helps a team review the full path from the customer's identity system to the application's authorization decision.

No replies yet