[seam-commits] Seam SVN: r8466 - trunk/src/main/org/jboss/seam/security.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jul 14 17:33:48 EDT 2008


Author: shane.bryzak at jboss.com
Date: 2008-07-14 17:33:48 -0400 (Mon, 14 Jul 2008)
New Revision: 8466

Modified:
   trunk/src/main/org/jboss/seam/security/Identity.java
Log:
JBSEAM-3164

Modified: trunk/src/main/org/jboss/seam/security/Identity.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/Identity.java	2008-07-14 20:58:02 UTC (rev 8465)
+++ trunk/src/main/org/jboss/seam/security/Identity.java	2008-07-14 21:33:48 UTC (rev 8466)
@@ -98,11 +98,20 @@
       
       if (Contexts.isApplicationContextActive())
       {
-         permissionMapper = (PermissionMapper) Component.getInstance(PermissionMapper.class);
+         permissionMapper = (PermissionMapper) Component.getInstance(PermissionMapper.class);                 
+      }    
+      
+      if (Contexts.isSessionContextActive())
+      {
+         rememberMe = (RememberMe) Component.getInstance(RememberMe.class, true);      
+         credentials = (Credentials) Component.getInstance(Credentials.class);         
       }
       
-      rememberMe = (RememberMe) Component.getInstance(RememberMe.class, true);      
-      credentials = (Credentials) Component.getInstance(Credentials.class);     
+      if (credentials == null)
+      {
+         // Must have credentials for unit tests
+         credentials = new Credentials();
+      }
    }
    
    public static boolean isSecurityEnabled()
@@ -368,6 +377,7 @@
    {      
       principal = null;
       subject = new Subject();
+      
       credentials.clear();
    }
 




More information about the seam-commits mailing list