Sub topic 6
MFA when users sign in through single sign-on
This chapter assumes you can administer users, profiles, and permission sets, and that you can find your way around Setup. It also assumes you know that a username and password are login credentials. It builds on the earlier chapters about the Salesforce MFA requirement and about enabling MFA with permissions.
Why single sign-on changes the MFA picture
Single sign-on (SSO) lets users sign in to Salesforce with credentials managed somewhere else. That system is the identity provider (IdP). Examples include Microsoft Entra ID, Okta, and Ping. Salesforce is the service provider (SP), and it trusts the IdP's statement that the user has been authenticated.
This changes where MFA happens. When a user types a Salesforce username and password into the Salesforce login page, Salesforce checks the password and can then ask for a second factor. When a user signs in through SSO, Salesforce never sees the password. The IdP authenticates the person, and Salesforce receives a signed message (a SAML assertion or an OpenID Connect token) that says who the user is.
Salesforce's MFA requirement applies to every user who signs in to the user interface. It can be met in two ways:
- Salesforce MFA, for users who log in directly with a Salesforce username and password.
- MFA at the IdP, for users who log in through SSO.
For SSO users, you are responsible for making sure the IdP enforces MFA. Salesforce does not add its own second prompt on top of an SSO login in the standard setup. If the IdP only asks for a password, the user gets in with a single factor, even if your org has "enabled MFA".
How an SSO login flows
The sequence below shows a service provider-initiated SAML login. The user starts at a My Domain URL, is redirected to the IdP, passes MFA there, and returns with an assertion.
Salesforce does three things with the assertion:
- It checks the signature against the IdP certificate you uploaded.
- It matches the user, usually through the Federation ID or the username.
- It assigns a session security level, which is covered below.
Telling Salesforce that the IdP performed MFA
Salesforce can't see what happened at the IdP unless the IdP says so. The IdP can include an authentication method reference (AMR) in the assertion or token. Its purpose is to list the methods the user used to authenticate.
- In SAML, the IdP sends an attribute that lists the authentication methods. Microsoft Entra ID, for example, sends a claim containing
http://schemas.microsoft.com/claims/multipleauthnwhen MFA was used. - In OpenID Connect, the ID token can carry an
amrclaim whose values includemfa.
When Salesforce recognizes an MFA value in the AMR, it treats the login as having used MFA and can give the session a High Assurance security level. Without a recognized value, the session is Standard.
The exact attribute names and values depend on the IdP and the Salesforce release. Confirm them in both vendors' documentation before you rely on them.
Session security levels for SSO logins
Every session has a security level, either Standard or High Assurance. The level depends on how the user logged in. By default, a username-and-password login is Standard. A login where the user completed MFA is High Assurance. Under Session Settings you can change which login methods map to which level, and SSO methods such as SAML are among them.
This matters when you protect sensitive actions. You can require High Assurance for:
- Specific connected apps.
- Specific permission sets, using a session-based permission set.
- Profiles that must have a minimum session level at login.
If a user logs in through SSO and the IdP's MFA is not reflected in the session level, the user may be blocked from a resource that needs High Assurance, or asked to verify again. The usual fix is to make the IdP send the AMR and to set the SAML session level mapping so that the two agree.
| Situation | Typical session level | What to check |
|---|---|---|
| Username and password, no MFA | Standard | Enable Salesforce MFA for these users |
| Username and password, MFA completed | High Assurance | Registration of a verification method |
| SSO, IdP sends a recognized MFA AMR | High Assurance | AMR value matches what Salesforce expects |
| SSO, IdP does not send an AMR | Standard | Add the AMR, or map the SSO method to the level you need |
Setting up SSO so that MFA is enforceable
Configure these pieces in this order:
- Enable My Domain. SSO and login-page controls depend on it.
- Create the SSO configuration. In Setup, open Single Sign-On Settings for SAML. For OpenID Connect providers, use Auth. Providers.
- Choose the user identifier. The Federation ID is more stable than the username, because it does not change when the Salesforce username changes.
- Turn on MFA in the IdP. Apply the policy to the application that represents Salesforce, not just to some users.
- Send the AMR. Include the authentication method in the assertion or token.
- Set the authentication service on My Domain. Under Authentication Configuration, select the SSO service. Decide whether to keep the username and password form on the login page.
- Test with a pilot user. Check the session level after login.
You can verify the result with SOQL. The AuthSession object records the session security level and login type of each session.
SELECT UsersId, LoginType, SessionSecurityLevel, CreatedDate
FROM AuthSession
WHERE CreatedDate = LAST_N_DAYS:7
ORDER BY CreatedDate DESC
LIMIT 200The next query counts logins by type, so you can see how many users arrive through SSO and how many log in directly. Direct logins need Salesforce MFA.
SELECT LoginType, COUNT(Id) total
FROM LoginHistory
WHERE LoginTime = LAST_N_DAYS:30
GROUP BY LoginTypeLogin types that mention SAML or an authentication provider are SSO logins. Rows of type Application are direct logins with a password.
Removing the password path
An SSO setup only helps if users cannot skip it. If the Salesforce login form still accepts passwords, a user, or an attacker who has stolen a password, can go around the IdP and its MFA. There are three ways to close this gap:
- Hide the login form. In the My Domain Authentication Configuration, deselect the login form so the page offers only SSO buttons.
- Make MFA apply to the remaining direct logins. Keep the Salesforce MFA permission for anyone who can still use a password, such as emergency administrators.
- Restrict the password path by network. Use login IP ranges on profiles so that direct logins are possible only from known networks.
Delegated authentication and other cases
Not every external login is SAML.
- Delegated authentication sends the username and password to a web service that you operate, which approves or rejects them. Salesforce sees the password and the service checks it, so MFA must be handled in your service, or through Salesforce MFA if you also enable it. Users need the "Is Single Sign-On Enabled" permission to use it.
- Social and authentication providers such as Google use OpenID Connect or OAuth. MFA belongs to the provider's account policy.
- Experience Cloud sites can use the same SSO providers, and each site has its own login settings.
Common errors
- MFA is enabled at Salesforce but SSO users are never prompted. This is normal. MFA must be set up at the IdP.
- Users are asked to verify twice. The IdP did MFA, but Salesforce did not recognize it, so a High Assurance requirement triggers a second prompt. Fix the AMR or the session level mapping.
- Users cannot log in after a certificate change. The IdP certificate in Salesforce no longer matches the one used for signing. Upload the new certificate before the old one expires.
- "No matching user" errors. The Federation ID in the assertion does not match the Federation ID on the user record. Compare them character by character, including case.
- Some users bypass SSO. They still have a working password and the login form is visible. Hide the form or restrict by profile.
- Admins lock themselves out. The only admin account uses SSO and the IdP is down. Keep the direct-login admin described above.
Exercise
Your org uses SAML SSO with an IdP that enforces MFA. A security reviewer asks how you know that SSO users complete MFA, and also how password users are covered. Name two things you would check or configure to answer both questions.
Show answer
For SSO users, check that the IdP's sign-in policy requires MFA for the Salesforce application, and that the assertion carries an authentication method reference so Salesforce sets a High Assurance session. You can confirm this with the SessionSecurityLevel field in AuthSession. For password users, enable Salesforce MFA with a permission set or profile setting, hide the login form on My Domain if nobody needs it, and keep only a small, monitored group of admins with direct login.
Exercise
A user logs in through SSO and is then asked to verify again when opening a connected app that requires High Assurance. The IdP already asked for a second factor. What is the likely cause and fix?
Show answer
The IdP did not send a recognized AMR value in the assertion or token, so Salesforce gave the session a Standard level. Configure the IdP to include the MFA authentication method, or map the SSO login method to High Assurance under Session Settings. Then check AuthSession.SessionSecurityLevel for a new test login.