What is SAML (Security Assertion Markup Language)?
SAML (Security Assertion Markup Language) is an XML-based standard for exchanging authentication and authorization data between identity providers and service providers. SAML 2.0 enables Single Sign-On (SSO) by allowing users to authenticate once with an identity provider and access multiple service providers without re-entering credentials.
Salesforce supports SAML 2.0 for both inbound and outbound SSO scenarios, making it a critical component for enterprise identity management strategies.
How SAML 2.0 Works in Salesforce
SAML operates on a trust relationship between three key components:
- User: The person requesting access to resources
- Identity Provider (IdP): The system that authenticates the user
- Service Provider (SP): The application providing resources (like Salesforce)
The SAML flow follows these steps:
- User attempts to access Salesforce (Service Provider)
- Salesforce redirects user to configured Identity Provider
- Identity Provider authenticates user and generates SAML assertion
- SAML assertion is sent back to Salesforce
- Salesforce validates the assertion and grants access
SAML Assertion Components
A SAML assertion is an XML document that contains authentication and authorization statements. Every SAML assertion includes these critical elements:
- Digital Signature: Cryptographic proof from the Identity Provider ensuring assertion integrity
- Issuer: The Identity Provider that created the assertion
- Subject: The user being authenticated (mapped to Salesforce User ID or Federation ID)
- Conditions: Time validity and audience restrictions for the assertion
- Attribute Statements: User attributes like email, role, or profile information
Salesforce as SAML Identity Provider (IdP)
When Salesforce acts as the SAML Identity Provider, it authenticates users and provides SAML assertions to external service providers. This configuration is useful when:
- Salesforce is your primary identity source
- You want users to access third-party applications using Salesforce credentials
- You need centralized user management through Salesforce
Configuring Salesforce as IdP
To set up Salesforce as a SAML Identity Provider:
- Navigate to Setup → Identity → Identity Provider
- Enable Identity Provider
- Download the Identity Provider Certificate
- Configure Connected Apps for each Service Provider
- Define SAML assertion attributes and user mappings
Salesforce as SAML Service Provider (SP)
When Salesforce functions as a SAML Service Provider, external identity providers authenticate users before they access Salesforce. This is the most common enterprise SSO scenario.
SAML SSO Configuration Steps
- Obtain Identity Provider metadata or certificate
- Navigate to Setup → Single Sign-On Settings
- Create new SAML Single Sign-On Setting
- Configure Entity ID, Start URL, and Identity Provider settings
- Map SAML attributes to Salesforce user fields
- Test the SSO connection
- Enable SSO for specific profiles or permission sets
SAML Attribute Mapping
Proper attribute mapping ensures user data flows correctly between the Identity Provider and Salesforce. Common attribute mappings include:
| SAML Attribute | Salesforce Field | Purpose |
|---|---|---|
| NameID | Federation ID or Username | Unique user identifier |
| User email address | ||
| FirstName | FirstName | User’s first name |
| LastName | LastName | User’s last name |
| Department | Department | User’s department |
SAML Security Best Practices
Implementing SAML securely requires attention to these critical areas:
- Certificate Management: Use strong certificates (2048-bit RSA minimum) and rotate regularly
- Assertion Validation: Always validate digital signatures and assertion conditions
- Time Synchronization: Ensure IdP and SP clocks are synchronized to prevent replay attacks
- Audience Restriction: Configure audience restrictions to prevent assertion reuse
- Encrypted Assertions: Use assertion encryption for sensitive environments
Troubleshooting SAML Issues
Common SAML configuration problems and solutions:
Clock Skew Errors
SAML assertions have time validity windows. Clock differences between IdP and SP can cause authentication failures. Ensure time synchronization using NTP.
Certificate Validation Failures
Expired or mismatched certificates prevent successful SAML validation. Verify certificate validity and ensure the correct certificate is configured in both systems.
Attribute Mapping Issues
Incorrect attribute mapping can prevent user provisioning or cause login failures. Use SAML tracer tools to inspect assertion contents and verify attribute names match configuration.
SAML 2.0 vs Other SSO Methods
Understanding when to use SAML versus other authentication methods:
- SAML 2.0: Best for browser-based SSO, enterprise environments, complex attribute exchange
- OAuth 2.0/OpenID Connect: Better for mobile apps, API access, modern web applications
- Kerberos: Optimal for Windows domain environments, internal networks
Salesforce Identity Features
Salesforce provides comprehensive identity management capabilities:
- SAML Identity Provider: Authenticate users for external applications
- SAML Service Provider: Accept authentication from external IdPs
- OAuth Connected Apps: API access control and authorization
- Canvas Connected Apps: Embed external applications within Salesforce
- Community SSO: Single sign-on for Experience Cloud sites
- Social Sign-On: Authentication via social media providers
Frequently Asked Questions
What is the difference between SAML 1.1 and SAML 2.0?
SAML 2.0 provides improved security, better browser support, and enhanced attribute exchange capabilities compared to SAML 1.1. Salesforce supports SAML 2.0 exclusively for new implementations.
Can Salesforce act as both IdP and SP simultaneously?
Yes, Salesforce can function as both SAML Identity Provider and Service Provider in the same org. This allows users to authenticate to Salesforce via external IdP while using Salesforce to authenticate to other applications.
How do I test SAML SSO configuration before going live?
Use Salesforce’s built-in SAML Validator tool in Setup → Single Sign-On Settings. Test with a limited user group first, enable detailed debug logs, and use browser SAML tracer extensions to inspect assertion contents.
What happens if the Identity Provider is unavailable?
Users cannot access Salesforce through SSO when the IdP is down. Configure emergency access by maintaining local Salesforce passwords for critical users or implementing multiple IdP endpoints for redundancy.
How does SAML handle user provisioning in Salesforce?
SAML handles authentication but not automatic user provisioning. Use Just-in-Time (JIT) provisioning to create users automatically, or implement SCIM for comprehensive user lifecycle management alongside SAML authentication.