WebLogic Server 6.0 Code Examples, BEA Systems, Inc.

Package examples.security.rdbmsrealm

This package demonstrates how to implement a custom security realm in WebLogic Server.

See:
          Description

Class Summary
RDBMSDelegate An instance of this class communicates with a single database connection.
RDBMSDelegate.DFactory A factory class that creates instances of the RDBMSDelegate class for the purpose of pooling.
RDBMSDelegate.Finished This class indicates to a caller that a method has reached the end of a ResultSet.
RDBMSGroup This class is the representation of a group from the database.
RDBMSRealm This class represents empty groups or ACLs.
RDBMSUser This is the in-memory representation of a user from the database.
 

Exception Summary
RDBMSException This exception is thrown if an error occurs in the RDBMS realm code.
 

Package examples.security.rdbmsrealm Description

This package demonstrates how to implement a custom security realm in WebLogic Server. The RDBMS security realm stores Users, Groups, and ACLs in a relational database. The RDBMS code example provides a Cloudscape database.

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

  1. Build the example
  2. Set up the database
  3. Configure the server
  4. Run the example

Build the Example

Compile the RDBMS security realm. Run the build.cmd (Windows NT) or build.sh (UNIX) script to build the RDBMS security realm. The script compiles the Java classes into the config/examples/serverclasses directory.

Set Up the Database

The Cloudscape Database

An evaluation copy of Cloudscape RDBMS in shipped with the WebLogic Server code examples. The demo database shipped with this version of Cloudscape includes a table that define an RDBMS security realm. The RDBMS security realm uses three database tables: aclentries, groupmembers, and users. The DDL statements that create the realm and some test data are in the file samples/examples/security/rdbmsrealm/rdbmsrealm.ddl.

Other Databases

  1. Edit the rdbmsrealm.ddl file in the weblogic600\samples\examples\security\rdbmsrealm and make any changes required for your database. Be sure not to change the table or column names. (If you must change anything, you must make the corresponding changes in the config.xml file.) You can also replace the test data with your data.

  2. Set the property getGroupNewStatement to true if you have recursive groups (groups are members of other groups) in your database. If your JDBC driver allows you to have multiple results sets on the same PreparedStatement, you do not have to set this property.

  3. To use utils.Schema, you need a JDBC driver for your database. See WebLogic Utilities for help using utils.Schema.

Configure the Server

To use the Cloudscape database:
  1. Bring up the Administration Console in a browser.

  2. Select the Security node in the left pane.

  3. Select defaultCachingRealm for the Caching Realm field.
To use another database with the RDBMS example:
  1. Bring up the Administration Console in a browser.

  2. Select the Realms node in the right pane.

  3. Select one of the pre-configure RDBMS realms.

  4. Select the Notes tab in the right pane. This will display instructions for enabling this realm in your environment.

  5. After following the steps in the Notes field, click Apply.

  6. Click to expand the Caching Realms node in the left pane.

  7. Select defaultCachingRealm in the left pane.

  8. Select the RDBMS realm that you had previously configured and click Apply.

Run the Example

  1. Restart the server.

  2. Bring up the Administration Console in a browser.

  3. Click to expand the Security node in the left-hand pane.

  4. Select the User, Group, and Access Control Lists nodes and view the addition security information defined by the RDBMS security realm.

There's More...

Read more about security realms in Programming WebLogic Security and in Managing Security.


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

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