Hello,
Follow the example how to make the jdbcRealm work:
asadmin create-auth-realm --classname
com.sun.enterprise.security.auth.realm.jdbc.JDBCRealm --property
jaas-context=jdbcRealm:datasource-jndi=jdbc/YOUR_JDBC_NAME:user-table=YOUR_USER_TABLE:user-name-column=YOUR_USERNAME_COLUMN:password-column=YOUR_PASSWORD_COLUMN:group-table=YOUR_USER_ROLE_TABLE:group-name-column=YOUR_USERNAME_COLUMN_ON_USER_ROLE_TABLE:digest-algorithm=MD5
YOUR_AUTH_REALM_NAME
Note that on this example you must use the username of the user on the user
role table to do the role assignment, example:
user table:
USERNAME varchar(40) NO PRI (null)
LASTSEEN datetime YES (null)
CREATED datetime YES (null)
BLOCKED tinyint(1) YES 0
PASSWORD longblob NO (null)
VERSION bigint(20) YES (null)
user_role table:
ID bigint(20) NO PRI (null) auto_increment
NAME varchar(255) NO (null)
VERSION bigint(20) YES (null)
USERNAME varchar(40) YES MUL (null)
Don't forget to add the roles correctly on web.xml and sun-web.xml as
example:
(web.xml)
...
<security-role>
<description />
<role-name>admin</role-name>
</security-role>
<security-role>
<description />
<role-name>user</role-name>
</security-role>
...
(sun-web.xml)
...
<security-role-mapping>
<role-name>admin</role-name>
<principal-name>AdminPrincipal</principal-name>
<group-name>admin</group-name>
</security-role-mapping>
<security-role-mapping>
<role-name>user</role-name>
<principal-name>UserPrincipal</principal-name>
<group-name>user</group-name>
</security-role-mapping>
...
Hope this help you.
Bye.
-------------------------------
Paulo Reis
On Tue, Sep 21, 2010 at 10:12 PM, <glassfish_at_javadesktop.org> wrote:
> Realm