Choose SAML
For legacy enterprise apps, established B2B partnerships, and when compliance specifically requires it. SAML Guide →
| Feature | SAML 2.0 | OAuth 2.0 | OpenID Connect |
|---|---|---|---|
| Year Released | 2005 | 2012 | 2014 |
| Primary Purpose | SSO / Authentication | Authorization | Authentication + Authorization |
| Data Format | XML | JSON | JSON (JWT) |
| Token Type | SAML Assertion | Access Token | ID Token + Access Token |
| Transport | HTTP POST / Redirect | HTTP Headers (Bearer) | HTTP Headers (Bearer) |
| Signature Algorithm | XML DSig (RSA-SHA256) | JWT Signature (RS256/HS256) | JWT Signature (RS256/HS256) |
| Mobile Support | ❌ Poor (XML parsing) | ✅ Excellent | ✅ Excellent |
| API Integration | ❌ Not designed for APIs | ✅ Primary use case | ✅ Excellent |
| Enterprise Adoption | ✅ Dominant | ✅ Growing | ✅ Rapidly growing |
| Learning Curve | Steep | Moderate | Moderate |
Security Assertion Markup Language (SAML) 2.0 has been the enterprise SSO standard for nearly 20 years. It was designed before mobile apps and REST APIs existed.
User tries to access Salesforce (the SP). Salesforce doesn’t have the user’s session.
Salesforce generates a SAML Request (AuthnRequest) and redirects user to Okta (the IdP).
Okta challenges the user (password, MFA). Once verified, Okta creates a SAML Assertion.
The signed SAML Assertion (XML) is POSTed back to Salesforce via the user’s browser.
Salesforce validates the signature, checks conditions, and creates a local session for the user.
A SAML Assertion contains three key sections:
<saml:Assertion> <!-- 1. Subject: WHO is this user? --> <saml:Subject> <saml:NameID>jane.doe@company.com</saml:NameID> </saml:Subject>
<!-- 2. Conditions: WHEN is this valid? --> <saml:Conditions NotBefore="2024-01-15T10:00:00Z" NotOnOrAfter="2024-01-15T10:05:00Z"> <saml:AudienceRestriction> <saml:Audience>https://salesforce.com</saml:Audience> </saml:AudienceRestriction> </saml:Conditions>
<!-- 3. Attributes: WHAT do we know about them? --> <saml:AttributeStatement> <saml:Attribute Name="firstName"> <saml:AttributeValue>Jane</saml:AttributeValue> </saml:Attribute> <saml:Attribute Name="department"> <saml:AttributeValue>Engineering</saml:AttributeValue> </saml:Attribute> </saml:AttributeStatement></saml:Assertion>✅ Use SAML when:
❌ Avoid SAML when:
OAuth 2.0 solved a different problem: delegated authorization. It allows apps to access resources on behalf of users without sharing passwords.
This is the most common misconception:
| ❌ What OAuth 2.0 Tells You | ✅ What OAuth 2.0 Actually Does |
|---|---|
| "Bearer of this token can read photos" | |
| "Access is authorized for scope X" | |
| "Token expires in 3600 seconds” |
| Flow | Use Case | Security Level |
|---|---|---|
| Authorization Code | Web apps with backend | ✅ High |
| Authorization Code + PKCE | Mobile apps, SPAs | ✅ High |
| Client Credentials | Machine-to-machine | ✅ High |
| Device Code | Smart TVs, CLI tools | ✅ Moderate |
| ❌ Deprecated | ❌ Insecure | |
| ❌ Deprecated | ❌ Insecure |
✅ Use OAuth 2.0 when:
❌ Avoid using OAuth 2.0 alone when:
OpenID Connect (OIDC) is an identity layer on top of OAuth 2.0. It answers: “Who is this user?”
| OAuth 2.0 Only | OIDC Adds |
|---|---|
| Access Token | ID Token (JWT with user identity) |
| resource scopes | openid, profile, email scopes |
| Token endpoint | UserInfo endpoint |
| - | Discovery (.well-known/openid-configuration) |
| - | Standard claims (sub, name, email) |
The ID Token is a signed JWT proving user identity:
{ "iss": "https://idp.example.com", "sub": "user-12345", "aud": "your-client-id", "exp": 1735142400, "iat": 1735138800, "auth_time": 1735138795, "nonce": "abc123", "name": "Jane Doe", "email": "jane@example.com", "email_verified": true}✅ Use OIDC when:
SAML Assertion (XML):
<saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"> <saml:Subject> <saml:NameID>jane@company.com</saml:NameID> </saml:Subject> <ds:Signature>...</ds:Signature></saml:Assertion>OIDC ID Token (JWT):
eyJhbGciOiJSUzI1NiJ9.eyJzdWIiOiJ1c2VyLTEyMyIsIm5hbWUiOiJKYW5lIn0.signature...SAML Metadata:
OIDC Discovery:
GET https://idp.example.com/.well-known/openid-configurationSAML Single Logout (SLO):
OIDC Logout:
| Scenario | Recommended Protocol | Reason |
|---|---|---|
| New web/mobile app login | OIDC | Modern, lightweight, excellent tooling |
| Enterprise SSO to legacy apps | SAML | Legacy apps often only support SAML |
| API authorization | OAuth 2.0 | Designed specifically for API access |
| ”Login with Google” | OIDC | Social providers use OIDC |
| B2B partner federation | SAML or OIDC | Depends on partner capabilities |
| Machine-to-machine | OAuth 2.0 (Client Credentials) | No user involved |
| IoT device authentication | OAuth 2.0 (Device Code) | Designed for limited-input devices |
| Replacing SAML | OIDC | Modern equivalent with better developer experience |
Many organizations are migrating from SAML to OIDC. Here’s the strategic approach:
Inventory SAML Applications
Configure IdP for Both Protocols
Migrate Apps in Phases
Update Attribute Mappings
NameID → sub claimTest Single Logout
| SAML Attribute | OIDC Standard Claim |
|---|---|
NameID | sub |
firstName | given_name |
lastName | family_name |
email | email |
groups | groups (custom claim) |
department | Custom claim in ID token |
Major identity platforms support all three protocols:
Full support for SAML, OAuth 2.0, and OIDC. Enterprise app gallery with pre-configured SSO.
Native support for all protocols. Extensive app catalog with SAML and OIDC templates.
OIDC-first with SAML support. Developer-friendly SDKs for modern apps.
Open-source with protocol adapters. Can act as broker between SAML and OIDC.
Choose SAML
For legacy enterprise apps, established B2B partnerships, and when compliance specifically requires it. SAML Guide →
Choose OAuth 2.0
For API authorization, third-party integrations, and machine-to-machine communication. OAuth 2.0 Guide →
Choose OIDC
For new user-facing applications, modern SSO, and replacing SAML in greenfield projects. OIDC Guide →
Use Multiple
Most enterprise IdPs support all protocols. Use the right protocol for each application’s needs. SSO Patterns →