Single sign-on with SAML
Salesforce as a SAML service provider: SP- vs IdP-initiated login, assertions and certificates, Federation ID, My Domain login configuration, just-in-time provisioning, and single logout.
Simple explanation
SAML 2.0 lets users log in to Salesforce with their corporate identity provider (IdP) such as Microsoft Entra ID, Okta or Ping. Salesforce is the service provider (SP).
How a login works (SP-initiated)
- The user opens the org's My Domain URL (or a deep link).
- Salesforce redirects the browser to the IdP with a SAML request.
- The user authenticates at the IdP (with the IdP's MFA).
- The IdP posts a signed SAML assertion to Salesforce's Assertion Consumer Service (ACS) URL.
- Salesforce validates the signature (IdP certificate), the audience and timing, finds the user by Federation ID (or username) and starts a session.
IdP-initiated login starts at the IdP portal and posts an assertion directly.
Configuration on Salesforce: SAML Single Sign-On Settings (issuer, IdP certificate, user identity location, entity ID, ACS URL), plus My Domain β Authentication Configuration to show the IdP button or redirect automatically.
Provisioning: create users in advance (or through SCIM from the IdP), or use just-in-time (JIT) provisioning, where the assertion's attributes create or update the user at first login (standard JIT, or a custom Auth.SamlJitHandler Apex class for complex mapping).
Single logout (SLO) ends sessions at both ends where configured.
Real-world analogy
SAML SSO is a company ID badge accepted at a partner building. You prove who you are once at your own office (the IdP). The partner building (Salesforce) trusts badges signed by your company's security office (the certificate) and lets you in as the person named on the badge (Federation ID), without a separate password.
Worked example
Global company, 20,000 employees on Microsoft Entra ID:
- Salesforce SAML SSO configured with Entra as IdP; users identified by Federation ID = employee ID.
- My Domain login page redirects to Entra automatically; admins keep a break-glass login with MFA.
- JIT provisioning with a custom handler creates users at first login, sets locale and role from assertion attributes, and assigns permission set groups by department.
- Deprovisioning: disabling the user in Entra blocks new logins; a SCIM or scheduled sync deactivates the Salesforce user (licence freed), because JIT alone never deactivates anyone.
- IdP certificate rotation is on the calendar, with the new certificate uploaded before the switch.
Diagram
Key points
- Salesforce as service provider, corporate IdP authenticates.
- SP-initiated (starts at My Domain) vs IdP-initiated (starts at the IdP portal).
- Signed assertion to the ACS URL; user matched by Federation ID (or username).
- My Domain authentication configuration controls the login page and redirects.
- JIT provisioning creates and updates users; deprovisioning needs SCIM or a sync.
- Plan certificate rotation, break-glass access and SLO.
Limits and gotchas
- Clock skew between IdP and Salesforce makes assertions fail; keep IdP time accurate.
- JIT doesn't deactivate users who leave; licences and access linger without a deprovisioning process.
- Several IdPs (for example after an acquisition) need multiple SAML configurations and a login page that routes users correctly.
- Experience Cloud sites have their own login settings and can use different IdPs from the internal org.
- The mobile app and API access also need consideration: SSO for browsers doesn't automatically cover integrations.
π€ How to say this in an interview
Draw the SP-initiated sequence, name Federation ID, ACS URL and certificate, and raise deprovisioning and break-glass without being asked. Those two points separate architects from implementers.
Common follow-ups
What's the difference between SP-initiated and IdP-initiated SSO?
SP-initiated starts at Salesforce, which redirects to the IdP and validates the response to its own request (supports deep links). IdP-initiated starts at the IdP portal, which sends an unsolicited assertion. SP-initiated is generally preferred.
How do you assign permissions to JIT-provisioned users?
Map assertion attributes (department, role, country) to permission set groups and roles in a custom JIT handler, or let the IdP send attributes that standard JIT maps to user fields, then assign permissions with automation.