Java Reference
In-Depth Information
<param name="password.column" value="password" />
<param name="group.table" value="forest.GROUPS" />
<param name="group.name.column" value="name" />
<param name="assign.groups" value="USERS,ADMINS" />
<param name="digest.algorithm" value="MD5" />
</antcall>
</target>
This task associates the resource with the realm, defines the tables and columns for
users and groups used for authentication, and defines the digest algorithm that will
be used for storing passwords in the database.
You can also use the Administration Console or the command line to create a
realm.
6. Modify the deployment descriptor for your application to specify the JDBC
realm:
• For an enterprise application in an EAR file, modify the
glassfish-ap-
plication.xml
file.
• For a web application in a WAR file, modify the
web.xml
file.
• For an enterprise bean in an EJB JAR file, modify the
glassfish-ejb-
jar.xml
file.
For example, for the Duke's Forest application, the
web.xml
file specifies the
jdbcRealm
realm:
<login-config>
<auth-method>FORM</auth-method>
<realm-name>jdbcRealm</realm-name>
<form-login-config>
<form-login-page>/login.xhtml</form-login-page>
<form-error-page>/login.xhtml</form-error-page>
</form-login-config>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure Pages</web-resource-name>
<description/>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>ADMINS</role-name>