There is a JBoss specific way of doing this.

  | //Get the Authenticated Subject
  | Subject subject = (Subject) 
PolicyContext.getContext("javax.security.auth.Subject.container");
  | 
  | //Now look for a Group called Roles
  | Set principals = subject.getPrincipals(Principal.class);
  | Iterator iter = principals.iterator();
  | while(iter.hasNext())
  | {
  |    Principal p = (Principal)iter.next;
  |    if(p instanceof SimpleGroup)
  |    {
  |         SimpleGroup sg = (SimpleGroup)p;
  |         if("Roles".equals(sg.getName())
  |            //we got the roles
  |     }
  | }
  | 

The flip side is that this gives all the roles the user belongs to.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3947144#3947144

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3947144


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to