Compile and run HelloWorld with Java Authentication and Authorization Service on an iSeries server

This information looks at how HelloWorld for Java™ Authentication and Authorization Service (JAAS) is compiled and run on an iSeries™ server.

This information should be considered a replacement for the HelloWorld section of the API Developers Guide. The source code, policy, and configuration files are the same as those in the API Developers Guide. There are, however, some aspects that are unique to the iSeries server.

  1. You should put the following source files in your own test directory:

    These source files need to be compiled into your ./classes directory.

    To look at the source code for these files formatted for your HTML browser, see HelloWorld in HTML.

  2. The three source files, HWLoginModule.java, HWPrincipal.java and HelloWorld.java, need to be compiled. Run the following commands (each on one line) on an iSeries command line:

    1. strqsh

    2. cd yourTestDir

    3. javac -J-Djava.version=1.3
            -classpath /qibm/proddata/os400/java400/ext/jaas13.jar:.
            -d ./classes *.java
    Where yourTestDir is directory you created to hold the sample files. The classpath needs the classes directory (.\classes) added to it to compile the classes.

    Note: HWLoginModule and HWPrincipal are in the com.ibm.security package and are created in the appropriate directory during compilation (\classes\com\ibm\security).

  3. Run the following commands (each on one line) on the iSeries command line:

    1. strqsh

    2. cd yourTestDir

      Where yourTestDir is the directory that you created to hold the sample files. The classpath needs the classes directory (.\classes) added to it to compile the classes.

    3. You should put the following source files in your own test directory:
    4. java -Djava.security.manager=
           -Djava.security.auth.login.config=./jaas.config
           -Djava.security.policy=./java2.policy
           -Djava.security.auth.policy=./jaas.policy 
           -Djava.version=1.3
           -classpath ./classes
           HelloWorld
    5. When prompted for the user name, enter bob. If running with a security manager, user bob must be entered for all of the access permissions to succeed. When prompted for a password, enter Go JAAS, case sensitive with a space.