
[id="installing-sample-code_{context}"]
= Installing sample code to secure the application

The final procedure is to make this application secure by installing some sample code from the {quickstartRepo_link} repository. The quickstarts work with the most recent {project_name} 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 {project_name} 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

. Make sure your {appserver_name} application server is started.
. Download the code and change directories using the following commands.
+
[source, subs="attributes"]
----
$ git clone {quickstartRepo_link}
$ cd {quickstartRepo_dir}/app-profile-jee-vanilla/config
----

. Copy the `keycloak.json` file to the current directory.

. Move one level up to the `app-profile-jee-vanilla` directory.

. Install the code using the following command.
+
[source, subs="attributes"]
----
$ mvn clean wildfly:deploy
----

. Confirm that the application installationt succeeded. Go to http://localhost:8080/vanilla where a login page is displayed.
+
.Login page confirming success
image:images/vanilla.png[Login page confirming success]

. Log in using the account that you created in the demo realm.
+
.Login page to demo realm
image:images/demo-login.png[Login page to demo realm]
+
A message appears indicating you have completed a successful use of {project_name} to protect a sample {appserver_name} application.  Congratulations!
+
.Complete success
image:images/success.png[Complete success]
