XML and Web Services Security
Sample Applications

Implementation Version: FCS 1.0

Building and Running the Sample Applications With ASant

You can build and run the XML and Web Services Security sample applications using the supplied asant and/or ant build files. This document assumes the user is deploying the sample applications to the Sun Java Systems Application Server, and thus asant is used for demonstration purposes. If you are deploying to a different application server, use the ant tool instead. To build, package, deploy, and run the sample applications, follow the correct steps for your platform:

For Solaris/Linux, follow these steps. On some shells, you would use setenv in place of export. When using setenv, replace the = with a space.

  1. % export JAVA_HOME=<your J2SE installation directory>
  2. % export JWSDP_HOME=<your JWSDP 1.5 installation directory>
  3. % export SJSAS_HOME=<your Application Server installation directory> (or use SJSWS_HOME or TOMCAT_HOME) as applicable)
  4. % export ANT_HOME=$SJSAS_HOME (or the location of your Ant installation)
  5. % export PATH=$JWSDP_HOME/jwsdp-shared/bin;$SJSAS_HOME/bin:$PATH
  6. % cd $JWSDP_HOME/xws-security/samples/<sample-name>
  7. % cp build.properties.sample build.properties
  8. Edit build.properties as shown in Editing the build.properties file.
  9. To display usage information for the sample,
    % $ANT_HOME/bin/asant 
  10. Follow the instructions provided in %JWSDP_HOME%/xws-security/samples/<sample-name>/README.txt for setting up and running the example on each of the three possible containers.

For Windows NT/2000/XP:

  1. > set JAVA_HOME=<your J2SE installation directory>
  2. > set JWSDP_HOME=<your JWSDP 1.5 installation directory>
  3. > set SJSAS_HOME=<your Application Server installation directory> (or use SJSWS_HOME or TOMCAT_HOME) as applicable)
  4. > set ANT_HOME=%SJSAS_HOME% (or the location of your Ant installation)
  5. > set PATH=%JWSDP_HOME%\jwsdp-shared\bin;%SJSAS_HOME%\bin;%PATH%
  6. > cd %JWSDP_HOME%\xws-security\samples\<sample-name>
  7. > copy build.properties.sample build.properties
  8. Edit build.properties as shown in Editing the build.properties file.
  9. To display usage information for the sample,
    > %ANT_HOME%\bin\asant
  10. Follow the instructions provided in %JWSDP_HOME%\xws-security\samples\<sample-name>\README.txt for setting up and running the example on each of the three possible containers.

Editing the build.properties file

Copy the file %JWSDP_HOME%\xws-security\samples\<sample-name>\build.properties.sample to build.properties. The following is a list of the configurable properties with a description of what needs to be modified in the build.properties file:
  1. javahome: Set this to the location of your Java 2 SDK installation directory
  2. Uncomment one of the container homes by removing the # sign beside the container. Only one container home should be uncommented at a time. Uncomment the container upon which you want to test the sample application, either the Sun Java System Application Server (SJSAS), or Sun Java System Web Server (SJSWS), or Tomcat containers.
  3. username: Replace this with the user name a person assigned to the role of admin for your Application Server or other container installation.
  4. password: Replace this with the password for the above user.
  5. endpoint.host, endpoint.port: Verify the host and port information, as appropriate for your Application Server or other container installation.
  6. VS.DIR: Enter the name of the virtual server. Applicable only if you are deploying to Web Server (SJSWS).
  7. jwsdp.home: Set this to the location of your JWSDP 1.5 installation directory.
  8. jaxrpc.tool.verbose: Set this to true to produce verbose output from the JAX-RPC tools (such as wscompile).
  9. http.proxyhost, http.proxyport: Set these to the correct values for your proxy host and proxy port if you are using an example with remote endpoints.
  10. example: The name of the sample (leave this as is)

List of Sample Applications

samples/simple
This sample application lets you plug in different client and server-side configurations describing security settings. This example has support for digital signatures, XML encryption/decryption, and username token verification. This example allows and demonstrates combinations of these basic security mechanisms through configuration files. See the application's README.txt file for more information on running this example.
 
samples/jaas-sample
This sample demonstrates how to plugin a JAAS LoginModule for authentication. This example allows and demonstrates the following functionality:

  • Obtaining a username and password from the user at runtime. Sending the username and password in a WSS UsernameToken to the server.
  • Configuring the server application to use JAAS authentication to authenticate the username-password it received.
  • Using the SubjectAccessor API from within the endpoint implementation methods to access the sender's subject after authentication.