Appearance
Single Sign-On
102. What is Single Sign-On (SSO), and why do organizations use it?
The short answer
SSO means a user logs in once, at a central identity provider, and can then use many separate applications without logging in again to each. Organisations use it because it is more secure and cheaper to run. There is one place to enforce MFA, passkeys and login policies. There are fewer passwords for users to reuse or forget. Disabling one account removes access everywhere when someone leaves. And there are far fewer helpdesk calls about forgotten passwords. The risk is concentration: the IdP becomes critical, so it must be strongly protected and highly available.
| Without SSO | With SSO |
|---|---|
| A password per app; users reuse them | One strong login, with MFA |
| MFA set up app by app, if at all | MFA enforced centrally |
| A leaver must be removed from every app | Disable once at the IdP |
| Each app stores password hashes | Apps store no passwords |
| Login audit spread across apps | One audit log of every sign-in |
103. How does SSO work across multiple applications?
The short answer
Each application trusts the same identity provider. When you open the first app, it has no session for you, so it redirects you to the IdP. You log in, and the IdP sets its own session cookie on its domain, then sends the app a signed assertion or ID token. The app creates its own session. When you open a second app, it also redirects you to the IdP, but this time the IdP sees its session cookie, skips the login, and immediately sends the second app an assertion. You see only a quick redirect.
The insight interviewers want. SSO is not one shared cookie across all apps, which browsers would not allow across different domains. It is many separate app sessions, each created from a fresh assertion, all backed by one session at the IdP.
104. What happens when a user accesses an enterprise application for the first time?
The short answer
The app has no session, so it redirects the user to the company's IdP, usually after asking for their email to find the right company. The user logs in with password and MFA or a passkey, and Conditional Access rules may also check their device. The IdP checks the user is assigned to this app, then sends a signed assertion with their ID, email, name and groups. The app either finds an account already created by SCIM provisioning, or creates one on the spot from the assertion, which is called just-in-time provisioning. It maps the groups to roles, and starts a session.
The steps, in order:
- Home realm discovery. The app asks for the email, sees
@acme.example, and knows to use Acme's IdP. - Redirect to the IdP with a SAML request or an OIDC authorize request.
- Authentication at the IdP, with MFA, and device checks if policy requires them.
- Assignment check. If the user is not assigned to the app, the IdP shows an error instead of sending an assertion.
- Consent, only if the app asks for permissions that need it and an admin has not pre-approved them.
- The assertion arrives at the app's callback URL, for example the ACS URL in SAML (the ACS question).
- Account linking. The app finds a provisioned account, or creates one just in time (the JIT question).
- Roles are mapped from groups or role claims.
- The app's session starts, and the user lands on the page they asked for.
105. What happens when an SSO session expires?
The short answer
There are two sessions that expire separately. When the app's session expires, the app redirects to the IdP again. If the IdP's session is still alive, the user comes straight back with a new assertion and barely notices. If the IdP's session has also expired, the user must log in again, possibly with MFA. Apps must handle this gracefully: save unsaved work, use a redirect for page loads, and for API calls from a single-page app, return 401 so the front end can trigger a re-login instead of silently failing.
| App session | IdP session | What the user sees |
|---|---|---|
| Valid | Any | Nothing; the app works |
| Expired | Valid | A quick redirect, then back in |
| Expired | Expired | The login page, perhaps MFA |
| Valid | Ended by admin | Still in, until the app session ends, unless the app gets a logout signal |
The last row is a real gap. If an admin disables a user at the IdP, apps with long sessions keep them logged in. Fix it with short app sessions, back-channel logout (the OIDC logout question), SCIM deactivation, or continuous access evaluation, where the IdP pushes critical events to apps.
106. What are the common protocols used for SSO?
The short answer
SAML 2.0, from 2005, uses signed XML assertions passed through the browser; it is the workhorse of enterprise SaaS SSO. OpenID Connect, from 2014, uses signed JWTs on top of OAuth 2.0; it is the modern default for new apps, mobile and consumer login. Kerberos with Integrated Windows Authentication gives seamless SSO inside a Windows domain network. WS-Federation is an older Microsoft protocol still found with ADFS. OAuth 2.0 alone is not an SSO protocol, but it carries API access alongside OIDC.
| Protocol | Token | Typical use |
|---|---|---|
| SAML 2.0 | XML assertion | Enterprise SaaS: Salesforce, Workday, ServiceNow |
| OpenID Connect | JWT ID token | New web apps, mobile apps, consumer login |
| Kerberos | Kerberos tickets | Windows domain, intranet sites, file shares |
| WS-Federation | XML token | Older ADFS and SharePoint integrations |
| CAS | Service ticket | Universities |
107. What is the difference between SAML, OAuth 2.0, and OIDC?
The short answer
SAML is an authentication and attribute protocol that passes signed XML assertions through the browser; built for enterprise web SSO. OAuth 2.0 is an authorization framework that issues access tokens so apps can call APIs on a user's behalf; it does not, by itself, tell an app who the user is. OIDC is an authentication layer on OAuth 2.0 that adds a signed JWT ID token; it does SAML's job with JSON and web-friendly flows, and works well for mobile apps and APIs too.
| SAML 2.0 | OAuth 2.0 | OpenID Connect | |
|---|---|---|---|
| Purpose | Authentication, SSO | Delegated API access | Authentication, SSO |
| Format | XML | Any; often JWT | JSON, JWT |
| Signed with | XML Signature | Depends | JWS |
| Carries tokens through | Browser POST | Code, then back channel | Code, then back channel |
| Mobile and SPA friendly | Poor | Good | Good |
| API access | No | Yes | Yes, with the access token |
| Year | 2005 | 2012 | 2014 |
108. When should an enterprise prefer SAML, and when should it prefer OIDC?
The short answer
Prefer SAML when the application or the customer's identity provider only supports SAML, which is still common for established enterprise SaaS and older on-premises IdPs such as ADFS, or when a customer's security team has a SAML integration process they insist on. Prefer OIDC for anything new, for mobile apps and single-page apps, when you also need API access tokens, and when you want simpler libraries and JSON instead of XML signature handling. A B2B SaaS product usually needs to support both, because its customers choose.
| Situation | Choose |
|---|---|
| New app, your own IdP | OIDC |
| Mobile or SPA | OIDC |
| Need to call APIs as the user | OIDC, with OAuth access tokens |
| Customer's IdP is ADFS or an older system | SAML |
| Enterprise customer demands SAML | SAML |
| Selling to many enterprises | Both (question 130) |
A practical reason to like OIDC: SAML security depends on correct XML signature validation, which has produced many serious vulnerabilities, even in popular libraries. OIDC's JWT checks are simpler and harder to get wrong (SAML attacks).
109. What are SSO cookies, and how do they relate to application sessions?
The short answer
The SSO cookie is the identity provider's session cookie, set on the IdP's own domain such as login.acme.example. It records that the user authenticated there, when and how. Each application session is a separate cookie on that app's own domain, created after the app receives an assertion. Apps cannot see or read the IdP's cookie, and the IdP cannot see theirs. They are linked only through redirects. That is why logging out of one app does not log you out of the IdP or other apps, and why their lifetimes are configured separately.
| SSO (IdP) cookie | Application session cookie | |
|---|---|---|
| Domain | login.acme.example | expenses.acme.example, wiki.example |
| Set by | The IdP after login | The app after an assertion |
| Records | User authenticated, method, time | User is in this app; app's own state |
| Lifetime set by | IdP policy, such as 8 hours or "stay signed in" | Each app |
| Cleared by | IdP logout | App logout |
Choosing lifetimes together. A short app session with a long IdP session gives frequent invisible redirects but quick revocation. A long app session ignores IdP changes for a long time. A common pattern is an app idle timeout of 30 to 60 minutes, and an IdP session of a working day.
110. How does SSO logout work?
The short answer
There are three levels. Local logout ends only the current app's session; the user is still signed in at the IdP and in other apps, and clicking "log in" again works instantly. IdP logout also ends the IdP's session, so the next login asks for credentials, but other apps may still have their own sessions. Single logout ends the IdP session and tells every app to end theirs, through SAML SLO or OIDC front-channel or back-channel logout. Users usually expect the third, while most systems by default only do the first.
| Logout level | App session | IdP session | Other apps |
|---|---|---|---|
| Local | Ended | Still active | Still active |
| IdP | Ended | Ended | Still active |
| Single logout | Ended | Ended | Told to end |
Decide this explicitly. On a shared computer, local logout is dangerous: the next person clicks "log in" and is in as you. On a personal laptop, single logout can annoy users by signing them out of ten tabs. Many enterprises choose single logout plus short app sessions.
111. What is Single Logout (SLO)?
The short answer
Single logout is the protocol feature that, when a user logs out of one app or the IdP, ends their sessions in every app that signed in through the same IdP session. In SAML, the IdP sends a signed LogoutRequest to each app's SLO endpoint, through the browser or directly, and collects LogoutResponses. In OIDC, the same job is done by front-channel or back-channel logout. SLO is fragile in practice: one app that fails to respond, browsers blocking third-party cookies, or a closed tab can leave sessions behind.
How SAML SLO runs, using redirects through the browser:
- The user clicks logout in the expenses app. It sends a
LogoutRequestto the IdP. - The IdP ends its own session and looks up every app this session logged into.
- It redirects the browser to each app's SLO URL in turn, with a
LogoutRequest. - Each app ends its session and redirects back with a
LogoutResponse. - When all have answered, the IdP shows "you are logged out".
If one app's endpoint is broken, the chain stops, and the remaining apps stay logged in. That is why back-channel logout, which calls servers directly, is more reliable (the OIDC logout question).
What to say in the interview. "I would implement SLO, but not rely on it alone. App sessions stay short, deprovisioning through SCIM disables accounts in each app, and high-risk apps check with the IdP more often."