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

Shane Bryzak Shane_Bryzak at symantec.com
Sat Jan 27 07:39:24 EST 2007


  User: sbryzak2
  Date: 07/01/27 07:39:24

  Modified:    src/main/org/jboss/seam/security  Identity.java
  Log:
  support post-login method, don't retract objects that are already in working memory
  
  Revision  Changes    Path
  1.21      +32 -9     jboss-seam/src/main/org/jboss/seam/security/Identity.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Identity.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/Identity.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -b -r1.20 -r1.21
  --- Identity.java	27 Jan 2007 11:29:58 -0000	1.20
  +++ Identity.java	27 Jan 2007 12:39:24 -0000	1.21
  @@ -9,6 +9,7 @@
   import java.security.acl.Group;
   import java.security.acl.Permission;
   import java.util.ArrayList;
  +import java.util.Collection;
   import java.util.Enumeration;
   import java.util.HashMap;
   import java.util.HashSet;
  @@ -82,6 +83,7 @@
      private String password;
      
      private MethodBinding authMethod;
  +   private MethodBinding postLogin;
   
      protected Principal principal;   
      protected Subject subject;
  @@ -126,13 +128,6 @@
   
      public Principal getPrincipal()
      {
  -      if (principal == null)
  -      {
  -         Set<Principal> principals = subject.getPrincipals(Principal.class);
  -         if (!principals.isEmpty())
  -            principal = principals.iterator().next();
  -      }
  -      
         return principal;
      }
      
  @@ -252,10 +247,23 @@
   
         handles.add(securityContext.assertObject(check));
   
  -      if (arg != null)
  +      if (arg != null && securityContext.getFactHandle(arg) == null)
  +      {
  +         if (arg instanceof Collection)
  +         {
  +            for (Object value : ((Collection) arg))
  +            {
  +               if (securityContext.getFactHandle(value) == null)
         {
            handles.add(securityContext.assertObject(arg));
         }      
  +            }
  +         }
  +         else
  +         {
  +            handles.add(securityContext.assertObject(arg));
  +         }
  +      }      
         
         // this doesn't work?
   //      for (String nm : Contexts.getMethodContext().getNames())
  @@ -358,6 +366,8 @@
            }
            else
            {
  +            if (principal == null) principal = p;
  +            
               securityContext.assertObject(p);            
            }
         }
  @@ -382,6 +392,9 @@
               break;
            }
         }
  +      
  +      if (postLogin != null)
  +         postLogin.invoke();
      }
      
      /**
  @@ -460,4 +473,14 @@
      {
         this.authMethod = authMethod;
      }
  +   
  +   public MethodBinding getPostLogin()
  +   {
  +      return postLogin;
  +   }
  +   
  +   public void setPostLogin(MethodBinding postLogin)
  +   {
  +      this.postLogin = postLogin;
  +   }
   }
  
  
  



More information about the jboss-cvs-commits mailing list