Skip to main content

Configure SAML federated IdP-Initiated Single Sign-On (SSO)

Cloud has the newest features. Some may not be in a release yet; the newest release is Identity & Access Management 7.3.0.

Single Sign On (SSO) is an authentication process which allows users to log in once and gain access to an organization's applications without having to authenticate to each individual application.

Federated IdP-initiated SSO extends this capability and enables a user belonging to an external organization to seamlessly access applications within your organization. In this scenario, your organization's Identity Provider (IdP) and the external organization's IdP establish a trust relationship. Therefore, external users can conveniently log in to their own IdP and access applications in another organization without having to create accounts in that organization.

This guide explains how you can implement federated IdP-initiated SSO using WSO2 Identity Platform.

Scenario​

The steps below implement the following example scenario.

  • Two WSO2 Identity Platform organizations represent the internal and external IdPs respectively.
  • The first organization (internal IdP) has an application called travelocity.
  • A user belonging to the second organization (external IdP) should be able to access travelocity without creating an account in the internal IdP.

Prerequisites​

Before you begin, set up two WSO2 Identity Platform organizations.

Create the application​

The travelocity.com application should reside in the internal IdP. Follow the steps below in the internal IdP to register it as an application.

  1. On the first WSO2 Identity Platform organization, go to Applications.
  1. Click on New Application and select Standard-Based Application.

  2. Configure the following:

    Nametravelocity.com
    ProtocolSAML
    Issuertravelocity.com
    Assertion consumer service URLshttp://localhost:8080/travelocity.com/home.jsp
  3. Click Create.

  4. Go to the Protocol tab of the created application and under Single Sign-On Profile, select the Enable IdP initiated SSO checkbox.

  5. Click Update to save the changes.

Configure the identity providers​

When performing federated IdP-initiated SSO, the two WSO2 Identity Platform organizations exhibit different behaviors as explained below.

  • The external IdP performs the actual user authentication since the user's account resides in it. Therefore, the external IdP acts as the identity provider and sends the SAML assertion of the authenticated user to the internal IdP.

  • The internal IdP delegates the authentication to the external IdP. Therefore, the internal IdP acts as a service provider and consumes the SAML assertion sent by the external IdP.

To establish this connection, we need to register the external IdP as an identity provider (connector) in the internal IdP and register the internal IdP as a service provider (application) in the external IdP.

Register the external IdP as a connector​

The external IdP needs to be registered as a connector in the internal IdP. This enables the external IdP to act as an identity provider and be used as a login option for the travelocity.com application.

To do so, follow the steps below in the internal IdP.

  1. Sign into the first WSO2 Identity Platform organization, and go to Connections.
  1. Click New Connection > Standard-Based IdP

  2. Provide External as the name and select SAML as the protocol.

  1. Click Next and enter the following details:
ParameterDescriptionValue
Service Provider Entity IDThe ID of the application that will consume the SAML assertion sent by this connector. This value should match the Issuer you configure when registering the internal IdP as an application (steps in the section below).Internal
Mode of configurationYou may either configure settings manually or use file/url-based configurations.Manual Configuration
Identity Provider Single Sign-On URLThe URL of the identity provider used for performing SSO.https://api.asgardeo.io/t/\{second-asgardeo-organization\}/samlsso
Identity Provider entity IDThe ID of the identity provider. In this instance, the external IdP is an WSO2 Identity Platform organization. Therefore, the ID should be api.asgardeo.io/t/{second-asgardeo-organization}.api.asgardeo.io/t/{second-asgardeo-organization}
  1. Click Next and upload the external IdP certificate.

  2. Click Finish to create the connection.

  3. On the WSO2 Identity Platform Console, return to Applications and select the travelocity.com application you registered in step 1.

  4. Go to the application's Login Flow tab, click Add Sign In Option for the first step of authentication and add the configured connection as a sign in option.

    Add external IdP as a sign-in option
  5. Click Update to save the changes.

Register the internal IdP as an application​

The internal IdP needs to be registered as an application in the external IdP. This enables the internal IdP to consume the SAML assertion sent by the external IdP after user authentication.

To do so, follow the steps below in the external IdP.

  1. On the second WSO2 Identity Platform organization's Console, go to Applications.
  1. Click on New Application and select Standard-Based Application.
  1. Configure the following:

    NameInternal
    ProtocolSAML
    IssuerInternal
    Assertion consumer service URLs

    https://api.asgardeo.io/t/

    <first-asgardeo-organization>/samlsso?spEntityID=travelocity.com

    Default Assertion Consumer URL

    https://api.asgardeo.io/t/

    <first-asgardeo-organization>/samlsso?spEntityID=travelocity.com

    note

    Add https://localhost:9443/commonauth endpoint to Assertion consumer service URLs support the SP initiated SSO flow as well.

  1. Click Create.

  2. Go to the Protocol tab of the created application and under Single Sign-On Profile, select the Enable IdP initiated SSO checkbox.

  3. Click Update to save the changes.

Try it out​

You have now made the application in your internal IdP accessible to the users belonging to the external IdP. Follow the steps below to try out logging into the internal application as an external user.

Deploy the application​

Follow the steps below to download and run the travelocity.com application:

Before you begin
  • Make sure you have Apache Tomcat 8.x.x. The webapps directory in the Tomcat installation will be referred to as <WEBAPPS>.

  • It is recommended to change the hostname to something other than localhost to avoid browser errors. Modify your machine's /etc/hosts entry to reflect this.

  1. Download the sample application

  2. Copy the travelocity.war file into <WEBAPPS>.

    note

    In order to be consistent with the configurations above,

    • Rename the travelocity.war file as travelocity.com.war.

    • Change the following configs in the <WEBAPPS>/travelocity.com/WEB-INF/classes/travelocity.properties.

      SAML2.EnableSLO=false
      SAML2.EnableResponseSigning=false
  3. Restart the Tomcat server.

Sign in with the Federated IdP-initiated flow​

Before your begin

Make sure you have created a user in the external IdP. Refer to manage users to learn more.

  1. Initiate IdP-initiated SSO using the following command. You will be redirected to the login screen of the travelocity.com application.

    https://api.asgardeo.io/t/{second-asgardeo-organization}/samlsso?spEntityID=<service_provider_entity_ID>
  1. Click Login with External. You will be redirected to the login screen of the external IdP.

  2. Enter the user's credentials to login. You will be redirected to the home page of travelocity.com

    note

    If you already have a user session in your browser, you will be redirected right into the application as an authenticated user.

Was this page helpful?