webtier@glassfish.java.net

Retrieving Logged in users security roles

From: <webtier_at_javadesktop.org>
Date: Mon, 27 Jul 2009 05:41:33 PDT

Good Morning,
I have spent the better part of two days trying to find the answer to this problem but I am unable to find anything. I might be searching on the wrong terms because it seems like a pretty basic question. Any help you can provide would be greatly appreciated.

I have a Web application running in Glassfish 2.1. I am currently using form based login with the Glassfish's file-realm (planning on creating/using a LDAP realm for production). Once a users logs in, I am able to retrieve the username using this code:
[i]
FacesContext fc = FacesContext.getCurrentInstance();
String username = fc.getExternalContext().getRemoteUser();[/i]

However, I also need to retrieve the users security roles (group list). For example, if the user is part of the TechAdmin, TechManagement, and TechUser security roles, I would like to be able to retrieve that a list containing those group (security role) names.

Is this possible?
Thanks in advance for any help you can provide.

Jon
[Message sent by forum member 'hoffmanjon' (hoffmanjon)]

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