Add a SAML v2 IdP-Initiated IdP

On this page
Starter plan required

This feature requires at least a Starter plan.

Available since 1.26.0

Let users log in to an Application from a dashboard in a SAML v2 Identity Provider (IdP), such as a tile in Okta. The SAML v2 IdP Initiated Identity Provider accepts a SAML response that the IdP sends without a request from FusionAuth.

Caution

FusionAuth doesn't recommend IdP-initiated login. For the risks, see SAML v2 IdP-Initiated Login.

When the IdP also supports SP-initiated login, use a SAML v2 Identity Provider with Enable IdP initiated login instead. The SAML v2 Identity Provider supports both types of login with one configuration, in FusionAuth 1.43.0 and later.

For the steps with Okta, see Configure SAML v2 IdP-Initiated SSO for Okta.

Prerequisites#

  • A FusionAuth plan that includes IdP-initiated login.
  • Permission to create an application in the SAML v2 Identity Provider.
  • The EntityId and the signing certificate of the SAML v2 Identity Provider.
  • An Application in FusionAuth for users to log in to.

Import the Signing Certificate#

  1. In the Admin UI, navigate to Settings -> Key Master .

  2. At the top of the page, open the drop-down menu of key actions, and select Import certificate .

  3. Enter a Name, and paste the PEM encoded certificate into Certificate.

  4. Click Submit .

For more information, see Import Certificate.

Create the Identity Provider#

  1. Navigate to Settings -> Identity Providers . Click the arrow next to the add button, and select SAML v2 IdP Initiated .

  2. 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.

  3. Set Issuer to the EntityId of the SAML v2 Identity Provider.

  4. Add the imported certificate to Verification keys.

  5. On the Options tab, set Email claim to the name of the email attribute in the SAML response. When the NameID holds the email address, turn on Use NameId for email instead.

  6. On the Applications tab, turn on Enabled for each Application that users log in to from the IdP. To register new users for the Application, turn on Create registration.

  7. Click .

For a description of each field, see Form Fields.

Set the Redirect URL#

After login, FusionAuth sends the user to a URL in Authorized redirect URLs of the Application. To add the URL:

  1. Navigate to Applications , and click next to the Application.

  2. On the OAuth tab, add the URL that users land on after login to Authorized redirect URLs.

  3. Click .

Configure the SAML v2 Identity Provider#

  1. In the FusionAuth Admin UI, navigate to Settings -> Identity Providers , and click next to the Identity Provider.

    The Identity Providers list in the Admin UI, with the view action next to a SAML v2 IdP Initiated provider.
    The Identity Providers list in the Admin UI, with the view action next to a SAML v2 IdP Initiated provider.
  2. In the SAML v2 Integration details section, find the Application in IdP Initiated Callback URLs (ACS), and copy the URL.

    The SAML v2 Integration details section of a SAML v2 IdP Initiated Identity Provider in the Admin UI.
    The SAML v2 Integration details section of a SAML v2 IdP Initiated Identity Provider in the Admin UI.
  3. In the SAML v2 Identity Provider, set the ACS URL, sometimes called the single sign-on URL, to the copied URL. To get a refresh token, add ?scope=offline_access to the URL.

  4. In the SAML v2 Identity Provider, set the Audience, sometimes called the SP EntityId, to Issuer from the Integration Details.

  5. In the SAML v2 Identity Provider, set RelayState to the URL from Authorized redirect URLs. When you leave out RelayState, FusionAuth uses the first URL in Authorized redirect URLs.

For the rules that FusionAuth applies to the redirect URI and scope, see SAML v2 IdP-Initiated Login.

Configure CORS#

The Identity Provider sends the SAML response to FusionAuth in an HTTP POST request from the origin of the Identity Provider. When the CORSA browser security mechanism that lets a web page request restricted resources from another domain when the server allows the request. filter is enabled and doesn't allow both the origin and the POST method, FusionAuth rejects the request with a 403 status code. To allow the request:

  1. Navigate to Settings -> System -> CORS .

  2. Add the scheme and host of the Identity Provider, such as https://login.example.com, to Allowed origins.

  3. In Allowed methods, select POST.

  4. Click .

For more information, see the CORS Filter reference.

Test the Login#

Open a private browser window, log in to the SAML v2 Identity Provider, and open the FusionAuth application from the IdP dashboard. FusionAuth redirects you to the redirect URL with an authorization code. Your application then exchanges the code for tokens at the Token endpoint.

Troubleshooting#

To troubleshoot a SAML flow, turn on Enable debug logging on the Identity Provider, and complete the SAML flow. Then navigate to System -> Event Log , and review the entries for configuration issues. Turn off debug logging when you finish.

The following errors are common:

  • When the Event Log contains Invalid SAML v2.0 operation. The signature is invalid., the Identity Provider signed the response with a certificate that isn't in Verification keys. To find the certificate, turn on 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. Import the missing certificate, and add the certificate to Verification keys. For more information, see SAML v2 Signature Verification.
  • When the login page shows The SAML audience failed validation., the Audience in the Identity Provider doesn't match Issuer in the Integration Details. With debug logging on, the Event Log shows the expected Audience.
  • When the browser network console shows a 403 status code for the POST to the ACS URL, the CORS configuration doesn't allow the request. For the fix, see Configure CORS.
  • During an IdP-initiated login, an error page with invalid_redirect_uri means that RelayState doesn't match a URL in Authorized redirect URLs.
  • During an IdP-initiated login, the message The request origin could not be verified. means that FusionAuth didn't treat the request as an IdP-initiated login. Check that the ACS URL contains the Id of the Identity Provider and the Client Id of the Application. Check that the Identity Provider is enabled for the Application.