This article shows you how to create a security realm using Geronimo Eclipse Plugin(GEP) during development. GEP provides an easy-using wizard for different types of security realm configuration such as properties file realm, SQL realm and LDAP realm.
In this article, we use a sample Dynamic Web Project and SQL realm for demonstration. You can of course choose the project or realm type as you needed.
Note that this wizard has the following 2 limitations:
- It only supports local server.
- The login module classes are only visible when server has started.
Creating a SQL realm
- Double-click the
geronimo-web.xmlfile under /META-INF directory of your application to open it in Geronimo Deployment Plan Editor, you will see general information page of the application.
- Select Security tab, and then open Security Realm section to display the security realms that are defined.
- Add - start a wizard for security realm creation.
- Remove - remove an existing security realm.
- Edit - reconfigure an existing security realm.
- Click Add to start a security realm wizard and fill in required fields. In this example, we select SQL Realm.
- Realm Name is used to specify the name of the security realm that will be used for user authentication for the application.
- Realm Type is the type of login module.
- Click Next to input SQL statements for user and group verification.
- Select SQL : input SQL statements to retrieve user and group information from database .
- Digest Configuration : specify digesting algorithm and encoding configuration for the user's password.
- Input a database pool name or JDBC URL to connect to the database where the credentials are stored.
- Click Finish to complete the wizard, and you will see that the realm and corresponding LoginModule class are listed in the Security Realm section.
- In the tool-bar, click Finish to save the changes.
Now you have created a new security realm for a simple Web application. You can click the Source tab to review the sample deployment plan.