Right now I'm doing this, but I'd rather have a cleaner solution with the 
RoleModule ... 


  | public static boolean hasRole(String roleName) {
  |     Subject caller = SecurityAssociation.getSubject();
  |     if ( caller == null ) {
  |             return false;
  |                     
  |     }
  |     Set princes = caller.getPrincipals();
  |     Iterator i = princes.iterator();
  |     while (i.hasNext() ) {
  |              String roles = i.next().toString();
  |              // e.g. Roles(members:User,Admin,Administrators,Authenticated)
  |              // make sure to check for commas, colons, and close paren
  |              // so "User" isn't mistaken for "SuperUser" and the like 
  |              if ( roles.contains(":" + roleName + ",") ||
  |                              roles.contains("," + roleName + ",") ||
  |                                      roles.contains("," + roleName + ")")) {
  |                     return true;
  |                              
  |             }
  |                      
  |     }
  |     return false;
  |             
  | }
  | 

Any suggestions?

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074928
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to