Custom User Registry Sample

August 21, 2013

Download

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

Description

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 FileRegistrySample.java file and users and groups are defined in the users.props file and groups.props file.

This sample can be installed onto runtime versions 8.5.5.0 and later.

Instructions

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

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

Notes

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
          • com.ibm.ws.samples.cur_1.0.0.201306201237.jar
          • features
            • sampleCustomUserRegistry-1.0.mf
      • servers
        • CustomUserRegistrySample
          • Copyright.txt
          • apps
            • SecureEJBSample.ear
          • bootstrap.properties
          • readme.html
          • resources
            • security
              • groups.props
              • users.props
          • server.xml