SamlSsoConfig defines a Security Assertion Markup Language (SAML) single sign-on configuration. Single sign-on (SSO) lets users authenticate through an identity provider rather than enter separate credentials for each application. This metadata controls identity-provider trust, user identity mapping, request signing, logout behavior, and optional Just-in-Time (JIT) user provisioning, which creates users when they first log in.
These settings define how Salesforce and the identity provider exchange and validate authentication messages. They are not merely login-page presentation settings. The configuration's metadata name, its runtime record ID, and the certificate references it contains also have different roles and are not interchangeable.
Key Elements
| Element | What the Element Controls |
|---|---|
issuer |
Identifies the identity provider. |
samlEntityId |
Identifies Salesforce in outbound SAML requests and specifies the expected audience of inbound SAML responses. Salesforce recommends the My Domain login URL. |
samlVersion |
Selects SAML1_1 or SAML2_0. Several endpoint and identity-format settings apply only to SAML2_0. |
identityLocation |
Specifies where the assertion contains the user's identity: SubjectNameId uses the Subject statement; Attribute uses an AttributeValue inside an Attribute. |
identityMapping |
Specifies what the supplied identity represents: Username, FederationId, or UserId. JIT provisioning requires FederationId. |
userProvisioning |
When true, enables JIT creation of users on their first login. |
samlJitHandlerId |
Names an existing Apex class implementing Auth.SamlJitHandler. Despite the suffix, this value is a class name, not an Apex class record ID. |
executionUserId |
Specifies the user who runs the JIT handler. Required when a handler is specified; the user must have Manage Users permission. |
validationCert |
Contains the identity provider's certificate for validation. This is certificate content, not a local Certificate component name. |
requestSigningCertId |
References the certificate used to sign SAML requests sent to the identity provider, using its 18-character record ID. |
decryptionCertificate |
Names the certificate in Certificate and Key Management used to decrypt incoming SAML assertions. |
requestSignatureMethod |
Selects the request-signing method: RSA-SHA1 or RSA-SHA256. |
useConfigRequestMethod |
Controls single-logout signing. When true, uses the selected request signature method; when false, uses RSA-SHA1. |
useSameDigestAlgoForSigning |
When true, selects the digest algorithm based on the request signature method. When false, uses SHA-1 regardless of that method. |
singleLogoutUrl |
Specifies the protocol endpoint where Salesforce sends LogoutRequest or LogoutResponse messages. It is not the post-logout destination. |
Behavior and Constraints
Access to this metadata type requires View Setup and Configuration permission, or both Customize Application and Modify All Data.
Identity mapping and provisioning
identityLocation and identityMapping answer separate questions: where Salesforce reads the identity, and what that identity means. Choosing SubjectNameId, for example, does not by itself specify whether the value is a username, federation ID, or Salesforce user ID.
When userProvisioning is true, identityMapping must be FederationId. A configuration using Username or UserId is therefore not equivalent to a provisioning-enabled configuration. Custom JIT processing also depends on the named Apex handler and its execution user; the execution user must have Manage Users permission.
attributeNameIdFormat applies only when samlVersion is SAML2_0 and identityLocation is Attribute. It accepts legal SAML 2.0 Name Identifier Format Identifiers, including unspecified, emailAddress, and persistent. The attributeName field holds the identity provider's application name, obtained from that provider.
Certificates, signatures, and digests
The three certificate fields serve different purposes. validationCert supplies the identity provider's certificate content. requestSigningCertId selects a local certificate by record ID for outbound request signing. decryptionCertificate selects a local certificate by name for inbound assertion decryption.
Selecting RSA-SHA256 in requestSignatureMethod does not, by itself, establish that every single-logout signature and digest uses SHA-256. Two additional settings matter:
-
useConfigRequestMethodmust betruefor single logout to use the selected request signature method. When it isfalse, single logout usesRSA-SHA1. -
useSameDigestAlgoForSigningcontrols the digest separately. Whentrue, the digest follows the selected signature method, such as SHA-256 forRSA-SHA256. Whenfalse, it uses SHA-1 regardless of the signature method.
Newly created configurations default useSameDigestAlgoForSigning to true. This field is editable only on legacy configurations.
Login endpoints and bindings
loginUrl is the identity-provider endpoint where Salesforce sends a SAML request to begin login. salesforceLoginUrl is the Salesforce URL associated with the web SSO flow. When encryption is enabled, salesforceLoginUrl includes sc=samlSsoConfigId; the parameter contains the configuration's record ID, not its metadata name.
loginUrl, logoutUrl, and oauthTokenEndpoint apply to SAML2_0. The oauthTokenEndpoint field supplies the assertion consumer service (ACS) URL for the web SSO OAuth assertion flow when Salesforce is enabled as an identity provider. It is not the ordinary identity-provider login endpoint.
redirectBinding selects the binding, or HTTP transport format, for SAML messages. When true, it uses HTTP Redirect with base64-encoded and URL-encoded messages in URL parameters. When false, it uses HTTP POST with base64-encoded messages in HTML forms.
errorUrl can be absolute or relative, but it must be publicly accessible because Salesforce uses it when login fails. A page that requires authentication does not meet this requirement.
Logout destinations and protocol messages
logoutUrl directs users after they click Logout and defaults to https://salesforce.com, the Salesforce home page. By contrast, singleLogoutUrl receives protocol messages: Salesforce sends LogoutRequest messages when Salesforce initiates logout and LogoutResponse messages when the identity provider initiates logout.
Single logout has its own binding setting, singleLogoutBinding, separate from redirectBinding:
-
RedirectBindingputs the base64-encoded, deflated message in the query string. -
PostBindingputs the base64-encoded message in the POST body without deflation.
Deployment and Retrieval
In Metadata API file format, SamlSsoConfig components use the .samlssoconfig suffix and reside in the samlssoconfigs folder. The type supports the * wildcard in package.xml. To retrieve all configurations, use a manifest type entry containing <members>*</members> and <name>SamlSsoConfig</name>. See the Salesforce metadata reference.
The type inherits fullName from Metadata. Its separate name field is the unique name used by the API and managed packages. That name must begin with a letter, contain only alphanumeric characters and underscores, and neither end with an underscore nor contain consecutive underscores.
Cross-org deployment must account for the different certificate representations. A matching certificate name can satisfy the name-based decryptionCertificate reference, but matching a name does not by itself resolve the record ID stored in requestSigningCertId in another org. Do not replace validationCert with either kind of local certificate reference; it contains the identity provider's certificate content.
A configuration with custom JIT processing requires an existing Apex class named by samlJitHandlerId that implements Auth.SamlJitHandler. It also requires executionUserId and the execution user's Manage Users permission. These are configuration dependencies, not additional settings supplied by the handler name.
Record-ID-bearing login URLs also need separate treatment from metadata names. In an encrypted configuration, the sc parameter in salesforceLoginUrl identifies the runtime configuration record. A developer name is not a substitute for that record ID.
Relationships
The explicit metadata references connect this configuration to local certificates and, for custom JIT provisioning, executable Apex code. The certificate references use different representations. The identity-provider certificate in validationCert is embedded content rather than a reference to a Certificate component.
References
-
Certificate:decryptionCertificatereferences a certificate by name;requestSigningCertIdreferences one by record ID. -
ApexClass:samlJitHandlerIdreferences the name of an existing class implementingAuth.SamlJitHandler.
Reported Issues
-
Certificate serialization can affect automated setup. A 2019 report recommends supplying
validationCertas the base64 body of an X.509 PEM certificate: remove theBEGINandENDmarker lines and join the remaining content into one string. The same answer describesdecryptionCertificateas a record ID, which conflicts with the Metadata API definition specifying a certificate name. Preserve the documented distinction:decryptionCertificateis name-based, whilerequestSigningCertIdis ID-based. Certificate automation discussion. -
A custom site login button may need the configuration record ID, not its metadata name. A 2021 example queries the runtime
SamlSsoConfigobject byDeveloperName, reads itsId, and passes that ID with the site URL and start URL toAuth.AuthConfiguration.getSamlSsoUrl. This constructs a runtime login URL; it does not introduce another metadata element. Custom SAML login URL example. - A second identity-provider prompt does not necessarily mean identity mapping is wrong. In a 2019 Login Discovery report, entering a federation ID selected the SSO route but did not establish an identity-provider session. The response described prompt bypass as dependent on the identity provider and conditional on the user having already authenticated with it. Login Discovery prompt discussion.
Common Questions
How do I retrieve SAML single sign-on settings with Metadata API?
Use SamlSsoConfig as the type name in package.xml. The type supports * to retrieve all configurations. Metadata API files use the .samlssoconfig suffix in the samlssoconfigs folder.
Does SamlSsoConfig use certificate names or certificate IDs?
It uses both, for different fields. decryptionCertificate takes a certificate name, requestSigningCertId takes an 18-character certificate record ID, and validationCert contains the identity provider's certificate content. A matching name alone does not resolve a signing-certificate ID across orgs.
Why does SAML JIT provisioning require FederationId?
Enabling userProvisioning requires identityMapping to be FederationId. If you specify a custom JIT handler, the named class must implement Auth.SamlJitHandler, and an execution user with Manage Users permission is required.
Why is single logout still using SHA-1 after I select RSA-SHA256?
requestSignatureMethod is only part of the configuration. If useConfigRequestMethod is false, single logout uses RSA-SHA1. If useSameDigestAlgoForSigning is false, the digest uses SHA-1 regardless of the selected signature method.
Should getSamlSsoUrl receive the SSO developer name or record ID?
The reported custom-site example passes the configuration's record ID. It first queries SamlSsoConfig by DeveloperName, then passes its Id, the site URL, and the start URL to Auth.AuthConfiguration.getSamlSsoUrl.