This documentation is for WSO2 Identity Server 5.2.0 . View documentation for the latest release.
Skip to end of metadata
Go to start of metadata

This topic documents instructions on how to test the OpenID Connect session management feature with the WSO2 Playground sample application as the Relying Party (RP) with WSO2 Identity Server as the OpenID Connect Provider (OP). See Configuring OpenID Connect Single Logout for more information. 


  1. In order to test the OpenID Connect session management feature, you need to have a relying party (RP) implementation. You can use either of the following options for this:
    • The example pseudo-code for the RP iframe provided in the official specification 
    • The WSO2 Identity Server Playground sample application. Expand the section below to set up. 

       Setting up the sample

      Setting up the Sample Webapp
      To obtain and configure the Playground sample, follow the steps below.
      1. You can check out the repository of the OAuth 2.0 sample from GitHub. Follow the instructions here to check out the folder. <SAMPLE_HOME> is used to refer to the location of the modules/samples folder inside the folder where the product-is repository is checked out.

      2. In your command line, navigate to <SAMPLE_HOME>/oauth2/playground2 in the folder you checked out and build the sample using the following command. You must have Apache Maven installed to do this (see Installation Prerequisites for the appropriate version to use).

        mvn clean install
      3. After successfully building the sample, a .war file named playground2 can be found inside the <SAMPLE_HOME>/oauth2/playground2/target folder. Deploy this sample web app on a web container. To do this, use the Apache Tomcat server.

        Since this sample is written based on Servlet 3.0 it needs to be deployed on Tomcat 7.x.

        Use the following steps to deploy the web app in the web container:

        1. Stop the Apache Tomcat server if it is already running.
        2. Copy the playground2.war file to the <TOMCAT_HOME>/webapps folder.
        3. Start the Apache Tomcat server.
      4. Make sure to update param-value the following parameter in the WEB-INF/web.xml file with the server url of the Identity Server if required.


        Note that localhost is the server that hosts WSO2 Identity Server and 9443 is the default SSL port of it.

      5. Update param-value of below parameters with credentials of an admin user if required.

      6. Restart Apache Tomcat and access http://localhost:8080/playground2/ (assuming Tomcat is running on HTTP port 8080). You are directed to the landing page of the sample application. Click on Import Photos and the following page appears.

  2. Deploy two relying party applications. To do this, make a copy of the playground2.war file that was generated when you set up the sample webapp, and rename it as "playground3.war". 

    Navigate to the following URLs to check both were deployed properly. You will be able to see the following screen.

Registering the relying party applications

  1. Start the IS server and login to the management console.
  2. Add a new service provider named "playground2" and click Register.
  3. Expand the Inbound Authentication Configuration section and then the OAuth/OpenID Connect Configuration and click Configure.
    For more information, see Configuring OAuth2-OpenID Connect
  4. Enter http://localhost:8080/playground2/oauth2client as the callback URL and click Update.

    At this point, you will see the client key and client secret. Note these values as you will need them later in this process.

  5. Repeat steps 1-4 and register a service provider named as "playground3".

Testing session management with WSO2 Playground

  1. Access the following URL and click on Import Photos:http://localhost:8080/playground2/ 
  2. Enter the following values and click Authorize
  3. Login with the user credentials and click Approve Always at the consent page. 

    To avoid errors during execution, select the Approve Always option.

  4. Once it is successfully authenticated, the OP will redirect back to the client application with the authorization code and the session state. You can see this in the logs of the console, as seen below.
  5. Enter the following values and click Get Access Token to receive the ID token and access token. 
  6. You will receive the access token. You can also enter the UserInfo Endpoint as https://localhost:9443/oauth2/userinfo?schema=openid to use the received access token to obtain user claims if needed. 
  7. Access the following URL on a separate window of the browser, and click on Import Photos:http://localhost:8080/playground3/ 
  8. Repeat steps 7-9 to invoke the playground3 application.

  9. Once you receive the authorization code for the playground3 app, open the browser console of the playground2 app. You will see that the RP iframe of playground2 has initiated a passive authentication request as the session state changed. Since the response has been received, the app will update it’s session state value and keep polling the OP iframe again. 

  10. Go back to the browser window of the playground3 app, and click Logout. Click Approve when prompted for consent. 
  11. Go back to the browser window of the playground2 app. You will see that the home page has loaded. If you check the console logs, you will note that the the playground2 app’s RP iframe has initiated a passive authentication request and has received an error since the end user session has ended. This means the app has successfully handled this as a single logout scenario.
  • No labels