[jboss-user] [JBoss Seam] - Instance.hasRole()...

garypinkham do-not-reply at jboss.com
Fri Jul 6 22:42:18 EDT 2007

I added code into my Authenticator object which adds roles to the Identity object.     I tried to use a restriction on a page for a certain role but none of my logins have access now.    So I added a check in the Authenticator right after adding the role(s) and it still returns false for hasRole().  I even hard coded a the addRole("admin") and that returns false when calling hasRole("admin") too...

Here's a quick snap shot of the code.. Let me know if you need more artifacts.

  | 			 if (user.getAuthoritieses() != null) {
  | 				 for (Authorities role : user.getAuthoritieses()) {
  | 					 log.info("adding role: #0 to user: #1", role.getAuthority(), Identity.instance().getUsername());
  | 					 Identity.instance().addRole(role.getAuthority());
  | 				 }
  | 			 }
  | 			 Identity.instance().addRole("admin");
  | 			 log.info("has Role: #0", Identity.instance().hasRole("ROLE_RUN_LINK")?"Yes":"No");
  | 			 log.info("has Role2: #0", Identity.instance().hasRole("admin")?"Yes":"No");

Which reminds me..  The code Seam generates uses an @In for Identity in the Authenticator sample class.  But all the Docs show Identity.instance().   Is there a preference?   


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

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

More information about the jboss-user mailing list