||
Skip to end of metadata
Go to start of metadata

Introduction

This sample uses two Web applications, which have their own login pages to authenticate a user. Once these Web applications are published through the App Manager, it will authenticate the user and return a JWT token created with user claims, which are taken from the user profile, and send them to the backend Web application. Web applications are written in a way to process the JWT token and authenticate the user. If JWT header is not available in the request, it will redirect the Web application to its login page.

Prerequisites

  • Download WSO2 App Manager, and start the server. 

  • Start the Web server (e.g. Apache Tomcat)

Building the sample

Follow the steps below to build the apps for this sample.

Building the Plan Your Trip app

Follow the steps below to build the Plan Your Trip app.

  1. Download the Plan Your Trip sample app (plan-your-trip.war file).
  2. Copy the plan-your-trip.war file to <TOMCAT_HOME>/webapps/ directory, to host the file in the Web server.
  3. Restart the Web server. You can access the Plan Your Trip Web app from your Web browser using the following URL: http://<IP_ADDRESS>:8080/plan-your-trip/

Building from source

Alternatively, you can build the sample app by building the product source. Follow the steps below to download the source and build the app.

  1. Download the source code of the product using the following command.
    $ git clone https://github.com/wso2/product-app-manager/
  2. Navigate to product-app-manager/web_apps/plan-your-trip/ directory from the CLI, and build the source using the command: mvn clean install
  3. Copy the plan-your-trip/target/plan-your-trip.war file to <TOMCAT_HOME>/webapps/ directory, to host the file in the Web server.
  4. Restart the Web server. You can access the Plan Your Trip Web app from your Web browser using the following URL: http://<IP_ADDRESS>:8080/plan-your-trip/

Building the Travel Booking app

Follow the steps below to build the Travel booking app.

  1. Download the TravelBooking sample app ( travel-booking-1.0.war file).
  2. Copy the travel-booking-1.0.war file to <TOMCAT_HOME>/webapps/ directory, to host the file in the Web server.
  3. Restart the Web server. You can access the TravelBooking web app from your web browser using the following URL: http://<IP_ADDRESS>:8080/travel-booking-1.0/

Building from source

Alternatively, you can build the app by building the product source. Follow the steps below to download the source and build the app.

  1. Download the source code of the product using the following command.
    $ git clone https://github.com/wso2/product-app-manager/
  2. Navigate to <travel-booking>/Travel/ directory from the CLI, and build the source using the command: mvn clean install
  3. Copy the <travel-booking>/Travel/target/ travel-booking-1.0.war file to <TOMCAT_HOME>/webapps/ directory, to host the file in the Web server.
  4. Restart the Web server. You can access the TravelBooking web app from your web browser using the following URL: http://<IP_ADDRESS>:8080/travel-booking-1.0/

Executing the sample

Follow the below steps to execute the sample.

When setting up the two Web apps for the sample using the instructions given below, do not access it from the Web browser using the Gateway Endpoint URL.

  1. Set up the Plan Your Trip Web app using the App Publisher. For instructions on how to setup, publish and subscribe to the Plan Your Trip Web app, see Demonstrating JSON Web Token (JWT) Usage - Plan Your Trip App.
  2. Set up the Travel Booking app using the App Publisher. For instructions on how to setup, publish and subscribe to the Travel Booking Web app, see Demonstrating JSON Web Token (JWT) Usage - Travel Booking App

Testing SSO

You can access any number of applications through the same Web browser using a single login through SSO. Follow the below steps to test single sign-on after setting the two Web apps.

  1. Access one Web application by entering the endpoint gateway URL as shown below. 
    Plan Your Trip Web app
    This will redirect you to the IDP login page, since still we are not logged in. Once you provide the correct credentials, it will redirect you to the Web application.
  2. Access the second Web application also by entering the endpoint gateway URL of it as shown below in the same browser. 
    Published Travel Booking appThis will directly redirect you to the Web application without giving the IDP login page. This is because you are already authenticated to one application using SAML SSO. 
  • No labels