users@glassfish.java.net

Re: Getting JDBC authentication to work

From: <glassfish_at_javadesktop.org>
Date: Fri, 11 May 2007 15:06:22 PDT

I discovered that Glassfish only works with a particular schema for users and roles. I was able to get this working by creating a user table and a group table, but in a way that is not normalized. This is a problem because now, if I want to use Entity beans in an intuitive way, I cannot do something like:

String username = "someusername";
SiteUserAccountFacadeLocal accountSessionBean =lookupSiteUserAccountFacade();
SiteUserAccount account = accountSessionBean.find(username);
            
Iterator<SiteRole> it = account.getSiteRoleIDCollection().iterator();

What i get here is an empty iterator because the Entity beans stuff will use the junction table. It is empty because Glassfish cannot use it to assign users to roles. I suppose that when i assign users to roles, I could insert a record into the junction table so I can use the Entity bean like it was meant to AND insert what glassfish wants me to into the SiteRoles table, but that isn't very elegant. Furthermore, I could add an operation to the SiteRole entity bean allowing me to lookup roles by username.

So there are ways around this, but it clutters my code and makes it less intuitive and I think its because glassfish insists on a non-normalized user/role schema.

Someone please comment on this..
[Message sent by forum member 'atappert' (atappert)]

http://forums.java.net/jive/thread.jspa?messageID=216559