Custom User Registry

This sample demonstrates how to configure a Custom User Registry Liberty user feature as a User Registry for authentication.

A custom registry is a customer-implemented registry that implements the UserRegistry Java interface, as provided by the product. A custom registry can support virtually any type of an account repository from a relational database, flat file, and so on. For this sample, a file based user registry is implemented by file and users and groups are defined in the users.props file and groups.props file.

This sample can be installed onto runtime versions and later.

Installation Instructions

Online installation (requires or later):

  1. Install the sample by running the command below from the bin directory of your server installation:
    installUtility install CustomUserRegistrySample

Any missing features required by the server will be installed for you.

Offline installation:

  1. Download the CustomUserRegistrySample.jar using the download button at the top of the page and place it in the root of your server installation.
  2. Extract the sample into the Liberty installation by running the command below from the root of your server installation:
    java -jar CustomUserRegistrySample.jar

Any missing features required by the server will need to be installed separately.

Running The Application

To run the SecureEJBSample application using the sample Custom User Registry:

  1. Start the CustomUserRegistrySample server by running the command below from the bin directory in the Liberty profile installation:
    server run CustomUserRegistrySample
  2. Confirm the application started by looking for the following message in the log:
    CWWKZ0001I: Application SecureEJBSample started in XX.XX seconds.
  3. Access the servlet: http://localhost:9135/SecureEJBSample/sampleServlet (where port 9135 assumes the httpEndpoint provided in the sample server.xml has not been modified).
  4. At the prompt, enter the authorized user information:
    • user: user1
    • password: user1pwd
  5. Confirm the hello method in the EJB is called by validating the servlet output is as follows:
    In SecureEJBServlet, Hello Secure EJB World.


The sampleCustomUserRegistry-1.0_1.0.0.201306201237.esa file contains the source and binaries for the sample custom user registry feature, and can be used to import it to Eclipse. The featureManager script can be used to install the feature in a Liberty profile. The howto.html file describes how to create a Custom User Registry as a user Liberty Feature.

Sample Structure

  • wlp
    • usr
      • extension
        • lib
          • features
      • servers
        • CustomUserRegistrySample
          • Copyright.txt
          • apps
            • SecureEJBSample.ear
          • readme.html
          • resources
            • security
              • groups.props
              • users.props
          • server.xml