Question

I successfully configured Glassfish to work with JDBCrealm using Basic Auth. But it's not working for Jsp page. My jsp page is simple using j_security_check and j_username and j_password. It throws me to UnAuthorizedAccess page (login error page). It's strange that it's working for basic auth and not for form based. What can be potential problem can anybody tell?

Also the structure of JDBCrealm table requirement is so ugly, i mean why is it so unnormalized? what if i want to change the structure? like

Users(Userid int, Username varchar(50), Userpassword varchar(50))

Roles(Roleid int, Rolename varchar(20))

UsersXRoles(UsersXRolesId int, UserId int, RoleId int)

??How should i configure this now?

Thanks in advance :)

Was it helpful?

Solution

I found a library that can do it: http://flexiblejdbcrealm.wamblee.org/

OTHER TIPS

You can create a normalized database and create a view for Glassfish. We have the same layout that you described in your post and our view looks like this:

CREATE OR REPLACE VIEW v_user_role_relation AS 
 SELECT u.username, u.password, g.groupname
   FROM user_group_rel ugr
   JOIN users u ON u.user_id = ugr.user_id
   JOIN groups g ON g.group_id = ugr.group_id::numeric;

However your other problem may have many reasons. Check if you defined your Realm in the server config and not only in the default config (that happened to me once).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top