3.5. Installing sample code to secure the application

The final procedure is to make this application secure by installing some sample code from the https://github.com/redhat-developer/redhat-sso-quickstarts repository. The quickstarts work with the most recent Red Hat Single Sign-On release.

The sample code is the app-profile-jee-vanilla quickstart. It demonstrates how to change a JavaEE application that is secured with basic authentication without changing the WAR. The Red Hat Single Sign-On client adapter subsystem changes the authentication method and injects the configuration.

Prerequisites

You have the following installed on your machine and available in your PATH.

  • Java JDK 8
  • Apache Maven 3.1.1 or higher
  • Git

You have a keycloak.json file.

Procedure

  1. Make sure your JBoss EAP application server is started.
  2. Download the code and change directories using the following commands.

    $ git clone https://github.com/redhat-developer/redhat-sso-quickstarts
    $ cd redhat-sso-quickstarts/app-profile-jee-vanilla/config
  3. Copy the keycloak.json file to the current directory.
  4. Move one level up to the app-profile-jee-vanilla directory.
  5. Install the code using the following command.

    $ mvn clean wildfly:deploy
  6. Confirm that the application installationt succeeded. Go to http://localhost:8080/vanilla where a login page is displayed.

    Login page confirming success

    Login page confirming success

  7. Log in using the account that you created in the demo realm.

    Login page to demo realm

    Login page to demo realm

    A message appears indicating you have completed a successful use of Red Hat Single Sign-On to protect a sample JBoss EAP application. Congratulations!

    Complete success

    Complete success