WebLogic Server 6.1 Code Examples, BEA Systems, Inc.

Package examples.security.jaas

This package demonstrates how to access a WebLogic Server resource (in this case, an RMI object) through the use of JAAS authentication.

See:
          Description

Interface Summary
Frobable A remote interface that illustrates access control on an RMI object.
 

Class Summary
CertLoginModule Sample login module for certificate based mutual authentication.
ConfigParser  
FrobImpl Illustrates how to use an ACL to protect the methods of an RMI object's.
MyCallbackHandler Implementation of the CallbackHandler Interface
SampleAction  
SampleClient Sample client for JAAS user authentication
SampleConfig Sample configuration class for JAAS user authentication.
SampleLoginModule Sample login module that performs password authentication.
 

Package examples.security.jaas Description

This package demonstrates how to access a WebLogic Server resource (in this case, an RMI object) through the use of JAAS authentication. JAAS authentication replaces a JNDI Environment object as the way to pass authentication data from a client to WebLogic Server. Two JAAS login modules are supplied in the package:

Perform the following steps in order to build, compile and run the example:

  1. Build the example
  2. Configure the WebLogic server for username/password authentication or certificate authentication
  3. Run the example

Build the Example

  1. Set up your development shell as described in Setting up your environment.

  2. Compile the example by executing an ant build script or by executing a set of commands.

Configure the Server for Username/Password Authentication

  1. Bring up the Administration Console in a browser.

  2. Register the FrobImpl instance as a RMI startup class:
    1. Click to expand the Deployments node in the left pane.
    2. Click to expand the Startup & Shutdown node in the left pane.
    3. Select the frob node.
    4. Verify that the ClassName is examples.security.jaas.FrobImpl.
    5. Deploy the frob startup class on the examplesServer.

  3. If not already defined, define joeuser as a User in the File realm:
    1. Click to expand the Security node in the left pane.
    2. Select the Users node.
    3. Click the Create a New User link.
    4. Add a User named joeuser with the password joepass.

    Note: The Examples WebLogic Server comes pre-configured with users and groups; the preceding procedure is provided mostly for informational purposes.

  4. If not already added, add joeuser to the Everyone Group.
    1. Click to expand the Group node in the left pane.
    2. Enter everyone in the Name attribute.
    3. Click on the Users attribute and select joeuser
    4. Click on the Apply button.

  5. Create an ACL called aclexample that grants the permission frob for User joeuser:
    1. Select the Access Control Lists node in the left pane.
    2. Create a new ACL with the name aclexample.
    3. In the Permission field, enter frob.
    4. In the Grant to User field, enter joeuser.

Configure the Server for Certificate Authentication

  1. Copy the demonstration digital certificate and private key for WebLogic Server and the digital certificate for the certificate authority from the \wlserver6.1\config\examples directory to the directory in which you are running the JAAS code example.

    You can also use digital certificate and private key you obtain with the JAAS code example. Copy the digital certificates and the private key file into the directory in which you are running the JAAS code example.

  2. Copy the Sample.policy file from the \wlserver6.1\samples\examples\security\jaas directory to the \wlserver61.\config\examples directory.

  3. Bring up the Administration Console in a browser.

  4. Register the FrobImpl instance as a RMI startup class:
    1. Click to expand the Deployments node in the left pane.
    2. Click to expand the Startup & Shutdown node in the left pane.
    3. Select the frob node.
    4. Verify that the ClassName is examples.security.jaas.FrobImpl.
    5. Deploy the frob startup class on the examplesServer.

  5. Run the CertAuthenticator code example. This code example installs the SimpleCertAuthenticator which is used for certificate authentication. In order for the JAAS code example to work with the demonstration digital certificate, a user named support must be defined through the Administration Console.

Run the Example

  1. Restart the Server. When starting WebLogic Server, use the following command line argument to specify the location of policy file that is used with the JAAS code example.

      -Djava.security.auth.policy=%WL_HOME%\config\examples\Sample.policy

  2. You can use either username/password authentication or certificate authentication with SampleClient.

There's more...

Read more about using the JAAS API to authenticate clients in Programming WebLogic Security .


Documentation is available at
http://e-docs.bea.com/wls/docs61

Copyright © 2001 BEA Systems, Inc. All Rights Reserved.