Basic Authentication Sample Application

Basic Authentication Sample Application


This document describes how to use the Basic Authentication sample application with Sun Java System Web Server.

This sample application document contains the following sections:



Overview

The following instructions describe how to manually deploy the application. You might want to experiment by modifying and redeploying the sample.


Precompilation Tasks

Complete these prerequisites before you begin to compile and deploy the code.

You must add user names in the keyfile. To do so, complete the following steps:

  1. Log on to the Administration GUI.
  2. Click the Configurations tab.
  3. Select the correct configuration.
  4. Click the Access Control tab.
  5. Click the Users tab.
  6. Select the correct Authentication Database. Make sure it's the keyfile database and pointing to the default keyfile.
  7. Click the New button and enter the following information:
    1. Enter j2ee for the User ID.
    2. Enter secret for the Password.
    3. Enter secret for the Password (Again).
  8. Click OK.
  9. Click the Groups tab.
  10. Select the correct Authentication Database. Make sure it's the keyfile database and pointing to the default keyfile.
  11. Click the New button and enter the following information:
    1. Enter staff for the Group Name.
    2. Click Search button.
    3. Select the user j2ee.
  12. Click OK.
  13. Click Deploy.

Compiling and Assembling the Sample Application
To compile and assemble the basic security web sample application:

Note - Make sure that the necessary parameters for running the samples are specified in install_root/samples/java/webapps/common.properties.
  1. Set the keyfile.location property within the install_root/samples/java/webapps/security/auth.build.properties file.

    For example, keyfile.location=install_root/instance_name/config/keyfile

  2. Go to install_root/samples/java/webapps/security/basic-auth/src and execute the following command:
    # ant
     The default target default is executed to build the WAR file.
     
  3. Deploy the application.
    After you have created the sample application from scratch, you can proceed to Deploying the Sample Application.
     
  4. (Optional.) Clean the web application project area.
    # ant clean


Deploying the Sample Application


To deploy the basic security sample application:
  1. Change to the source directory at install_root/samples/java/webapps/security/basic-auth/src.

     
  2. Run ant using the deploy task:
    # ant deploy
If you want to verify the registration of the application, proceed to Verifying Deployment. Otherwise, proceed to Running the Sample Application.


Verifying Deployment

To verify the registration and deployment of the application, complete the following steps:

  1. Change to the source directory at install_root/samples/java/webapps/security/basic-auth/src.

  2. Run the ant tool using the list_apps task.
    # ant list_apps

    The webapps-security-basic module is listed as one of the components.

Running the Sample Application

You can run the application through the following URL:

http://Sun_Java_System_Web_Server_hostname:port/webapps-security-basic

Log on as j2ee with password secret.

The message "Welcome to our BASIC secure zone!" is displayed.

Undeploying the Sample Application


After successfully deploying and running the application, you might decide to undeploy it and remove the files. To undeploy the application, complete the following steps:

  1. Change to the source directory at install_root/samples/java/webapps/security/basic-auth/src.
  2. Run the ant tool using the undeploy task.
    # ant undeploy

Troubleshooting