This code seems to work:

private void findRole() throws PolicyContextException {
        
//      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())) {
                                        Enumeration en = sg.members();
                                        while(en.hasMoreElements()) {
                                                String role = 
en.nextElement().toString();
                                                if(role != null) {
                                                        setRole(role);
                                                }
                                        }
                                }
            }
        }
    }

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

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


-------------------------------------------------------
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
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to