Add an External SAML v2 IdP
On this page
Add a login button that lets users authenticate through an external SAML v2 Identity Provider (IdP). FusionAuth acts as the SAML service provider.
To use FusionAuth as a SAML v2 Identity Provider for other applications instead, see Host a SAML v2 Identity Provider.
Some SAML providers need specific configuration. The following guides cover those providers:
- Configure SAML v2 for Active Directory Federation Services (ADFS)
- Configure SAML v2 for Azure AD
- Configure SAML v2 for Okta
After you configure the Identity Provider, you can enable the SAML v2 login button for your applications. The following login page shows a button for the PiedPiper SAML v2 Identity Provider:

Add a SAML v2 Identity Provider#
To enable SAML v2 for an Application or CIMD domain:
-
In the Admin UI, navigate to Settings -> Identity Providers .
-
Click the arrow next to the add button, and select SAML v2 .
-
Select the Tenant for the Identity Provider, or select
Global identity provider. You can't change the scope later. For more information, see Identity Provider Scope. -
Fill out the form. Your identity provider supplies most of the values. For a description of each field, see Form Fields.
-
On the Applications tab, turn on Enabled for each Application or CIMD domain that uses the Identity Provider.
-
To register new users for the Application with the Application's default roles, turn on Create registration. When Create registration is off, a user needs a registration for the Application before the user can log in through the Identity Provider.
-
Click .
The login page of each enabled Application then shows a login button for the Identity Provider. An Identity Provider with managed domains asks for the user's email address instead of showing a button.

Form Fields#
EnabledWhether this SAML v2 Identity Provider is enabled.
IdAn optional UUID. When you leave out the Id, FusionAuth generates a unique Id.
SourceThe source of this Identity Provider.
FusionAuth sets the source only when you create the Identity Provider. FusionAuth ignores a new value on update and keeps the existing value.
The maximum length is 191 characters.
TenantThe Tenant that this Identity Provider belongs to. The field appears only when you select a specific Tenant on the previous page. When you select Global identity provider on the previous page, the field doesn't appear.
NameA unique name for the Identity Provider. FusionAuth uses the name for display only, and you can change the name later.
IdP endpointThe URL of the login page of the SAML Identity Provider.
NameID formatThe NameIDThe element of a SAML assertion that identifies the user, such as by email address or a persistent Id. format to send to the SAML v2 Identity Provider in the AuthN request.
Verification keysThe keys in Key MasterThe FusionAuth subsystem for managing cryptographic keys. that verify the signature on SAML responses from the Identity Provider. Import every signing certificate that the Identity Provider publishes, and add all of them. The key marked Default verifies responses whose signature doesn't include a certificate. For more information, see Signature Verification.
Button textThe text of the button on the login form. The default value is Login with SAML.
Button imageThe image on the button on the login form. When you leave out the image, the button shows a default SAML icon.
Enable IdP initiated loginAllows IdP-initiated login requests for this configuration. IdP-initiated login requires a valid license.
IdP-initiated login doesn't support CIMD clients. When you enable IdP-initiated login, you can't enable the Identity Provider for a CIMD domain. Available since 1.70.0
In general FusionAuth does not recommend you utilize this type of login due to the inherent risks of accepting an unsolicited authentication response from a third-party identity provider.
In a service provider initiated login, the SAML Authentication Response is returned to the service provider (FusionAuth) in response to an authentication request. This means FusionAuth can validate certain parameters and only accept a response for a request that FusionAuth initiated. In contrast, during an identity provider initiated login, the third-party identity provider sends FusionAuth a SAML Authentication Response indicating a user has been authenticated without any context. The problem is that FusionAuth did not initiate this so it is unexpected, and this limits what can be verified and requires FusionAuth to allow a cross site request from this third party.
If you must enable this feature to support a legacy integration or because the user experience is of the highest concern, then you may proceed.
IssuerThe service provider EntityIdA unique identifier, usually a URL, that names a SAML Identity Provider or Service Provider. The SAML entity Id is unrelated to FusionAuth Entities. that FusionAuth uses for this SAML v2 Identity Provider.
When you leave out the issuer, FusionAuth uses <base_url>/samlv2/sp/<identityProviderId>.
Expected IssuerThe expected EntityId (unique identifier) of the external SAML v2 Identity Provider.
This field is required when Enable IdP initiated login is enabled.
Linking strategyThe linking strategy for the SAML v2 Identity Provider. For more information, see Linking Strategies.
Available since 1.65.0 You can only change this value when the identity provider is disabled. To change the linking strategy for an identity provider that is already enabled, disable the provider, change the value, and then re-enable the provider.
Reconcile lambdaA lambda that maps custom claims from the SAML response to the FusionAuth User or Registration.
To create or configure a lambda, navigate to Customizations -> Lambdas . For more information, see Lambdas.
Enable debug loggingSome Identity Providers don't comply with the SAML and XML signing specifications, which makes the integration harder.
When you enable debug logging, FusionAuth writes debugging information to the Event Log during a SAML login. To view the Event Log, navigate to System -> Event Log .
Tenants#
The Tenants tab limits the number of links that each user in a Tenant can have to this Identity Provider. Links to other Identity Providers don't count toward the limit. On a global Identity Provider, the tab starts empty. To set a limit for a Tenant, click Add tenant configuration . On a tenant-scoped Identity Provider, the tab lists only the Identity Provider's Tenant.
Limit links per userWhen turned on, FusionAuth enforces Maximum link count for users in the Tenant.
Maximum link countThe maximum number of links that a user can have to this Identity Provider. When a user reaches the limit, FusionAuth rejects a new link. The Link API returns a 400, and the hosted login pages show an error.
For more information, see Identity Providers and Tenants.
Options#

Form Fields#
Unique Id claimThe name of the claim in the SAML response that contains the unique Id of the user. When you leave out the claim, FusionAuth uses the NameID.
Use NameId for emailWhen enabled, FusionAuth reads the email address of the user from the NameID in the SAML response.
Email claimThe name of the email claim in the SAML response.
When Use NameId for email is enabled, the Admin UI hides this field, and the field isn't required.
Username claimThe name of the username claim in the SAML response. FusionAuth never uses the NameID as the username. When you leave out the claim, the user has no username unless the reconcile lambda sets one. Set the claim when the Linking strategy links by username.
Use POST methodWhen enabled, FusionAuth sends the authentication request with the HTTP POST binding. Otherwise, FusionAuth uses the default Redirect binding, which uses the HTTP GET method.
Sign requestsWhen enabled, FusionAuth signs the authentication requests that FusionAuth sends to the Identity Provider.
Request signing keyThe key that signs the SAML request. This field is required when Sign requests is enabled. To create, manage, or import a key, navigate to Settings -> Key Master .
Canonicalization methodThe XML signature canonicalization method that FusionAuth uses to digest and sign the SAML request. This field is required when Use POST method and Sign requests are enabled.
Enable login hintWhen enabled and the AuthN request uses HTTP redirect bindings, FusionAuth sends the username or email address to the IdP as a login hint, when available.
Login hint parameter nameThe name of the parameter that passes the username or email address to the IdP as a login hint. FusionAuth sends the parameter when the AuthN request uses HTTP redirect bindings. This field is required when Enable login hint is enabled.
Destination assertion policyThe policy for the destination assertion on the SAML login request. The possible values are:
Enabled: FusionAuth verifies that the Destination attribute in the SAML response equals the FusionAuth ACSThe service provider endpoint that receives SAML responses from an identity provider. When FusionAuth acts as a service provider, the endpoint is/samlv2/acs. (Assertion Consumer Service) URL.Enabledis the default and the recommended setting.Disabled: FusionAuth doesn't validate the Destination attribute. FusionAuth doesn't recommend this setting.Allow alternates: FusionAuth verifies that the Destination attribute is either the FusionAuth ACS or one of the Alternate destinations. Use this setting with caution, to help migrate from a third-party IdP.
Alternate destinationsThe URLs that FusionAuth accepts as SAML login destinations when Destination assertion policy is Allow alternates.
Require encrypted assertionsWhen enabled, FusionAuth requires encrypted assertions in SAML responses from the Identity Provider. FusionAuth rejects a SAML response that contains an unencrypted assertion.
Assertion decryption keyThe key that decrypts SAML responses. This field is required when Require encrypted assertions is enabled. To create, manage, or import a key, navigate to Settings -> Key Master .
The key must contain an RSA private key. Give the matching public key or certificate to the SAML Identity Provider, which uses the public key to encrypt assertions.
Managed Domains#

Form Fields#
Managed domainsThe email domains that this Identity Provider manages, one domain on each line. For example, to use the SAML v2 Identity Provider only for employees, add the company domain, such as piedpiper.com.
With managed domains, the login page doesn't show a button for this Identity Provider. Instead, the login page first asks the user for an email address. When the email address matches a managed domain, FusionAuth redirects the user to this Identity Provider to authenticate. Otherwise, the login page asks for a password, and FusionAuth authenticates the user.
The Lookup API also uses managed domains. For more information, see Managed Domains.
Signature Verification#
FusionAuth verifies the signature on every SAML response from the Identity Provider. FusionAuth trusts only the keys in Verification keys. A certificate in Key Master that isn't in Verification keys can't verify a response.
FusionAuth chooses the verification key as follows:
- When the signature includes an X.509 certificate in the
KeyInfoelement, FusionAuth computes the SHA-1 thumbprint of the certificate. FusionAuth then verifies the signature with the key in Verification keys whose certificate has the same thumbprint. The order of the keys doesn't matter. When no key matches, FusionAuth rejects the response. - When the signature doesn't include a certificate, FusionAuth verifies the signature with the default key. The default key is the key marked Default in the Admin UI, and the first key in
verificationKeyIdsin the API.
FusionAuth chooses the key that verifies the signature on a SAML response from an external Identity Provider.
A verification key that contains only a public key, without a certificate, never matches the certificate in KeyInfo. A public key can verify a response only as the default key, and only when the signature doesn't include a certificate. When the Identity Provider gives you a certificate, import the certificate.
Rotate Identity Provider Certificates#
Many Identity Providers publish more than one signing certificate in their metadata. The extra certificates let service providers trust a new certificate before the Identity Provider starts to sign with the new certificate. To keep logins working during a certificate rotation:
- Import each signing certificate from the metadata of the Identity Provider into Key Master. Navigate to Settings -> Key Master , and click Import Certificate .
- Add each imported certificate to Verification keys on the Identity Provider.
- Mark the certificate that the Identity Provider currently signs with as Default.
- When the Identity Provider stops signing with the old certificate, remove the old certificate from Verification keys.
For more information, see Key Master.
Integration Details#
After you configure the Identity Provider, FusionAuth displays the values that your SAML v2 Identity Provider needs to trust FusionAuth as a relying partyAn application that depends on another system to authenticate users. In OpenID Connect, the relying party is the client application. In WebAuthn, the relying party is the website that registers and verifies passkeys.. To view the values, navigate to Settings -> Identity Providers , open the action menu next to your SAML provider, and click View .

Scroll to the SAML v2 Integration details section. The section contains the values you need to configure the integration with the SAML v2 IdP.
FusionAuth resolves the service provider EntityId from the Issuer value in the section. When you don't configure identityProvider.issuer, FusionAuth uses <base_url>/samlv2/sp/<identityProviderId>. When you configure identityProvider.issuer, FusionAuth uses your value.
FusionAuth expects the Audience value in the SAML assertionA signed XML statement from an identity provider that tells a service provider who the user is and which attributes the user has. to match the same EntityId.

Fields#
Callback URL (ACS)An Assertion Consumer Service (or ACS) is the location at a service provider that accepts messages to establish a session based on the assertion.
By default the redirect URI will be the first Authorized redirect URI found in the FusionAuth Application OAuth configuration. To specify a redirect URI send the authorized URI in the RelayState parameter. Support for using the RelayState in this manner is supported in FusionAuth version greater than or equal to 1.41.0. In prior versions, append a query parameter named redirect_uri to the ACS in the IdP configuration.
Note: For IdP initiated logins in order to receive a refresh token the query parameter ?scope=offline_access will need to be appended to the url. When logging into the FusionAuth Admin application this parameter is included by default and does not need to be supplied.
IssuerThe service provider EntityId.
By default this value is {'<base_url>/samlv2/sp/<identityProviderId>'}. You can override it using identityProvider.issuer.
FusionAuth expects the Audience value in the SAML assertion to match this value.
Metadata URLThe URL where the service provider metadata resides.
CORS Configuration#
To complete the login request, the SAML v2 Identity Provider sends an HTTP POST request to the callback URL in FusionAuth. To let the request through the CORSA browser security mechanism that lets a web page request restricted resources from another domain when the server allows the request. filter, navigate to Settings -> System -> CORS . Then add the origin of the SAML IdP as an Allowed Origin in the CORS configuration.
When your CORS configuration doesn't yet allow the login request, FusionAuth shows the following warning after you save the SAML v2 Identity Provider. For more information, see the CORS Filter reference.

Redirects#
After a user logs in to the SAML IdP and returns to FusionAuth, FusionAuth can redirect the user to another URL. To set the redirect URL:
- Choose the URL where the user arrives after login, such as
https://example.com/welcome. - Add
https://example.com/welcometo the Authorized Redirect URLs field in the Application configuration. - URL encode the URL.
https://example.com/welcomebecomeshttps%3A%2F%2Fexample.com%2Fwelcome. - Append the encoded URL to the ACS URL that you enter in the IdP as the
RelayStateparameter, such ashttps://local.fusionauth.io/samlv2/acs?RelayState=https%3A%2F%2Fexample.com%2Fwelcome.
When the request has no RelayState parameter, FusionAuth redirects the user to the first Authorized redirect URIThe URL where the authorization server sends the browser after login, with an authorization code or an error. in the OAuth configuration of the FusionAuth Application.
For more information, see Integration Details.
Redirects And Lambdas#
A lambda that runs when a user logs in to FusionAuth with SAML can't change where FusionAuth sends the user. The lambda reads the SAML response and adds, modifies, or removes attributes on the User or Registration.
Troubleshooting#
A common pattern is to set up SAML as the login method for the FusionAuth application. This lets you keep all your users in the SAML system, and have FusionAuth delegate auth decisions to it. However, if your Identity Provider isn't configured correctly, you can end up in a dead end, unable to log in. This might happen if the following occurs:
- You set up SAML as the authentication method for your FusionAuth admin application.
- You set the Managed domains to your domain. For example,
example.com. - All added users have the same
example.comdomain. - You accidentally misconfigure SAML and break authentication.
- Then you log out of the FusionAuth Admin UI.
You won't be able to log in to the FusionAuth admin application to correct the misconfiguration. You've locked down the FusionAuth admin application so that only users with example.com email domains can access it, but because of the misconfiguration, there is no account with a valid SAML login.

This is a problem, but not an insurmountable one. Your options depend on when you discover the issue. If you are beginning your SAML configuration, you can avoid this scenario. Follow these steps:
- Don't set any value of Managed domains before you have tested the SAML configuration.
- Test authentication in a different or incognito browser window, ensuring that an admin user account is always accessible to modify configuration.
- Add an admin user account with a domain not in the Managed domains setting. Ensure this user is registered with the FusionAuth admin application and has the
adminrole. - Set up an API key. Navigate to Settings -> API Keys to do so and make sure it has privileges to create users and registrations. This will open up options in the future to reset settings without using the Admin UI.
If you are currently locked out of your FusionAuth application, you have fewer options:
- If you have a known username and password that are not delegated to SAML (perhaps the initial account created when you set up FusionAuth) proceed to the FusionAuth admin login page. Append
&showPasswordField=trueto the end of the login URL. This will force the UI to show the password field. - If you have an API key with appropriate privileges, you can modify the configuration without using the Admin UI. Add an admin user with a different email domain and sign into the Admin UI to correct your SAML configuration. Here's how you might do so (
3c219e58-ed0e-4b18-ad48-f4f92793ae32is the FusionAuth application Id):
$ curl -XPOST -H "Authorization: $API_KEY" -H "Content-Type: application/json" \
-d '{
"user": {
"email": "user@differentdomain.com",
"password": "password"
},
"registration": {
"applicationId": "3c219e58-ed0e-4b18-ad48-f4f92793ae32",
"roles": ["admin"]
}
}' \
https://login.piedpiper.com/api/user/registration
If you have neither an API key nor a known user, you can restore from a database backup, modify the database directly if you have access, or re-install FusionAuth.
Troubleshooting SAML Flows#
To troubleshoot a SAML flow, enable Enable debug logging, and complete the SAML flow. Then navigate to System -> Event Log , and review the entries for configuration issues.
Invalid Signature Errors#
When FusionAuth can't verify the signature on a SAML response, the Event Log contains an error with the following message:
Invalid SAML v2.0 operation. The signature is invalid.
The error doesn't say which certificate the Identity Provider used. To find the certificate, enable Enable debug logging, and repeat the login. The debug entry in the Event Log contains the raw SAML response. Compare the X509Certificate value in the response with the certificates in Verification keys. When the certificate isn't in Verification keys, import the certificate and add the certificate to Verification keys. For more information, see Signature Verification.
Limitations#
FusionAuth supports SAML both as a SAML Identity Provider (IdP) and as a Service Provider (SP). The SP implementation has certain limitations.
Version 2.0 is supported; other SAML versions are unsupported.
FusionAuth supports the following NameID format values by default:
urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddressurn:oasis:names:tc:SAML:2.0:nameid-format:persistent
You may also provide your own format name. To determine the correct value, please examine the supported values of the software package for which you are configuring FusionAuth as the SP.
Map between SAML claims and user claims using a reconcile lambda or FusionAuth SAMLv2 Identity Provider configuration.
Prior to version 1.28.0, FusionAuth only supported using the name Id for the user's email address.
FusionAuth supports the following SAMLv2 bindings:
- HTTP Redirect
- HTTP POST
Other bindings are not supported.
Related
Learn how to configure Azure AD (Microsoft Entra ID) as a SAML v2 Identity Provider for FusionAuth.
Learn how to let users log in to a third-party application, such as a SaaS product, with their FusionAuth accounts over OpenID Connect or SAML v2.
Learn how managed domains connect email domains to an Identity Provider.
Learn about the APIs for creating, retrieving, updating and deleting identity providers.