[jboss-cvs] jboss-seam/src/main/org/jboss/seam/security ...

Shane Bryzak sbryzak at redhat.com
Tue Oct 2 23:14:48 EDT 2007


  User: sbryzak2
  Date: 07/10/02 23:14:48

  Modified:    src/main/org/jboss/seam/security  RuleBasedIdentity.java
  Log:
  RuleBasedIdentity should first check the security context for hasRole()
  
  Revision  Changes    Path
  1.17      +19 -0     jboss-seam/src/main/org/jboss/seam/security/RuleBasedIdentity.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: RuleBasedIdentity.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/RuleBasedIdentity.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -b -r1.16 -r1.17
  --- RuleBasedIdentity.java	17 Jul 2007 22:17:58 -0000	1.16
  +++ RuleBasedIdentity.java	3 Oct 2007 03:14:48 -0000	1.17
  @@ -151,6 +151,25 @@
         return check.isGranted();
      }
      
  +   /**
  +    * Overridden version of hasRole() that checks for the existence of the role
  +    * in the security context first.  If it is not found there, then the super
  +    * method is invoked instead.
  +    */
  +   @Override
  +   public boolean hasRole(String role)
  +   {
  +      Iterator<Role> iter = securityContext.iterateObjects(new ClassObjectFilter(Role.class));
  +      
  +      while (iter.hasNext())
  +      {
  +         Role r = iter.next();
  +         if (r.getName().equals(role)) return true;
  +      }
  +      
  +      return super.hasRole(role);
  +   }
  +   
      @SuppressWarnings("unchecked")
      @Override   
      protected void unAuthenticate()
  
  
  



More information about the jboss-cvs-commits mailing list