Sun Java System Application Server Platform Edition 8.2 Administration Guide

Creating a Custom Realm

In addition to the four built-in realms, you can also create custom realms that store user data in some other way, such as in a relational database. Development of a custom realm is outside the scope of this document. For more information, see the Application Server Developer's Guide chapter titled Securing Applications.

As an administrator, the main thing you need to know is that a custom realm is implemented by a class (called the LoginModule) derived from the Java Authentication and Authorization Service (JAAS) package.

ProcedureTo create a custom realm

  1. Follow the procedure outline in To create a realm, entering the name of the custom realm and the name of the LoginModule class.

    Any unique name can be used for the custom realm, for example myCustomRealm.

  2. Add the properties for a custom realm shown in the following table.

    Property Name  

    Property Value  


    LoginModule class name, for example simpleCustomRealm


    Description of the realm, for example “A simple example custom realm”. 

  3. Click OK.

  4. Edit the domain's login configuration file, domain-dir/config/login.conf, and add the fully-qualified class name of the JAAS LoginModule at the end of the file, as follows:

    realmName {
        fully-qualified-LoginModule-classname required;

    For example,

    myCustomRealm { required;
  5. Copy the LoginModule class and all dependent classes into the directory domain-dir/lib/classes.

  6. Restart the Server if Restart Required displays in the console.

  7. Make sure that the realm is properly loaded.

    Check domain-dir/logs/server.log to make sure the server loaded the realm. The server should invoke the realm’s init() method.