[jboss-cvs] JBossAS SVN: r66397 - trunk/tomcat/src/main/org/jboss/web/tomcat/security.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 24 16:14:07 EDT 2007


Author: anil.saldhana at jboss.com
Date: 2007-10-24 16:14:07 -0400 (Wed, 24 Oct 2007)
New Revision: 66397

Modified:
   trunk/tomcat/src/main/org/jboss/web/tomcat/security/RunAsListener.java
Log:
JBAS-4890: rollback change made by Scott during JBAS-4506 with RunAsIdentity push

Modified: trunk/tomcat/src/main/org/jboss/web/tomcat/security/RunAsListener.java
===================================================================
--- trunk/tomcat/src/main/org/jboss/web/tomcat/security/RunAsListener.java	2007-10-24 19:23:55 UTC (rev 66396)
+++ trunk/tomcat/src/main/org/jboss/web/tomcat/security/RunAsListener.java	2007-10-24 20:14:07 UTC (rev 66397)
@@ -31,7 +31,7 @@
 import org.jboss.metadata.web.jboss.JBossWebMetaData;
 import org.jboss.security.RunAsIdentity;
 import org.jboss.security.SecurityConstants;
-import org.jboss.security.SecurityContext; 
+import org.jboss.security.SecurityContext;
 import org.jboss.security.SecurityUtil;
 
 /**
@@ -71,12 +71,22 @@
          boolean trace = log.isTraceEnabled();
          String name = servlet.getName();
          SecurityRoleMetaData identity = metaData.getRunAsIdentity(name);
-         // TODO: why can't this be null?
+         /*// TODO: why can't this be null?
          if(identity == null)
          {
             identity = new SecurityRoleMetaData();
             identity.setRoleName("anonymous");
+         }*/
+         RunAsIdentity runAsIdentity = null;
+         if(identity != null)
+         {
+            String principalName = identity.getPrincipalName();
+            if (principalName == null)
+               principalName = identity.getRoleName();
+            runAsIdentity = new RunAsIdentity(identity.getRoleName(), principalName, 
+                  identity.getPrincipals());             
          }
+         
          if (trace)
             log.trace(name + ", runAs: " + identity);
          // Push the identity on the before init/destroy
@@ -84,12 +94,8 @@
             || type.equals(InstanceEvent.BEFORE_DESTROY_EVENT)
             || type.equals(InstanceEvent.BEFORE_SERVICE_EVENT) )
          {
-            String principalName = identity.getPrincipalName();
-            if (principalName == null)
-               principalName = identity.getRoleName();
-            RunAsIdentity runAs = new RunAsIdentity(identity.getRoleName(), principalName, identity.getPrincipals());
             ensureSecurityContext();
-            SecurityAssociationActions.pushRunAsIdentity(runAs);
+            SecurityAssociationActions.pushRunAsIdentity(runAsIdentity);
          }
          // Pop the identity on the after init/destroy
          else if( type.equals(InstanceEvent.AFTER_INIT_EVENT)




More information about the jboss-cvs-commits mailing list