Enterprise SSO: SAML 2.0 and OIDC Integration
Fast recall
Quick revision
Core answer
spring-boot-starter-oauth2-client) — modern JSON-based, mobile-friendly — and SAML 2.0 (spring-security-saml2-service-provider) — XML-based, required by many enterprise IdPs. Both follow the same conceptual flow: redirect to IdP -> authenticate -> signed assertion/token returned -> app validates and creates local session. Configuration involves registering with the IdP (client ID/secret for OIDC; metadata XML + signing keys for SAML), mapping IdP claims/attributes to roles, JIT user provisioning, and Single Logout (SLO). Common pitfalls: redirect URI mismatch, signature validation, clock skew, claim mapping, cert rotation. Modern B2B default: OIDC primary, SAML fallback for enterprise mandate.Understanding of enterprise SSO flows, SAML vs OIDC trade-offs, JIT provisioning, SLO
Treating SSO as one protocol; missing signature/cert validation; not handling cert rotation
Discuss multi-tenant SSO, dynamic registration, JIT provisioning, SLO complexity, Azure AD / Okta specifics
Interview-ready guide
Interview answer
OIDC vs SAML quick framing
- OIDC: modern JSON-based, mobile-friendly, primary choice for new integrations
- SAML: XML-based, enterprise-required (banks, gov, healthcare); fallback for B2B
- Both: redirect to IdP -> auth -> signed response -> local session
OIDC in Spring Boot
spring-boot-starter-oauth2-clientapplication.yml:spring.security.oauth2.client.registration.+provider..issuer-uri oauth2Login(...)DSL,userInfoEndpoint.userAuthoritiesMapperfor role mappingOidcClientInitiatedLogoutSuccessHandlerfor SLO@AuthenticationPrincipal OidcUserin controllers- PKCE automatic with
client-authentication-method=none
SAML 2.0 in Spring Boot
spring-security-saml2-service-providerspring.security.saml2.relyingparty.registration.withassertingparty.metadata-urisaml2Login()andsaml2Logout()DSLOpenSaml4AuthenticationProviderwithsetResponseAuthenticationConverterfor attribute mapping- Cert rotation via multiple
verification.credentials
Multi-tenant
- Resolve tenant from subdomain or email domain
- Custom repository sourced from DB
JIT provisioning
- First login -> create local user from IdP attributes
- Use federated ID (issuer + subject), not just email
Common pitfalls
- Redirect URI mismatch (exact match required)
- Clock skew on assertion validity
- Cert rotation breaking auth
- Claim mapping silently dropping roles
- SameSite=Strict breaking callback POST
- Logout only local without SLO -> one-click re-login
2026 default
- OIDC primary, SAML on enterprise request
- Use IdP aggregator (Auth0, WorkOS) for many customer IdPs
Enterprise SSO: SAML 2.0 and OIDC Integration
Direct Answer
For SSO in Spring Boot you pick between OIDC (spring-boot-starter-oauth2-client) — modern JSON-based, mobile-friendly — and SAML 2.0 (spring-security-saml2-service-provider) — XML-based, required by many enterprise IdPs. Both follow the same conceptual flow: redirect to IdP -> authenticate -> signed assertion/token returned -> app validates and creates local session. Configuration involves registering with the IdP (client ID/secret for OIDC; metadata XML + signing keys for SAML), mapping IdP claims/attributes to roles, JIT user provisioning, and Single Logout (SLO). Common pitfalls: redirect URI mismatch, signature validation, clock skew, claim mapping, cert rotation. Modern B2B default: OIDC primary, SAML fallback for enterprise mandate.
Common Mistakes & Pitfalls
Treating SSO as one protocol; missing signature/cert validation; not handling cert rotation
Check your understanding
Answer these without looking back at the article.
- How do you handle certificate rotation for 100 customer SAML integrations?
- What is Just-in-Time provisioning and how do you implement it?
- Walk through implementing Single Logout for OIDC and SAML
- How do you support multi-tenant SSO where each customer has their own IdP?
Related interview prep categories
2Looking for a structured roadmap?
Every module on this page is also part of the full Java backend interview track.