geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r391720 - /geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java
Date Wed, 05 Apr 2006 19:01:21 GMT
Author: kevan
Date: Wed Apr  5 12:01:20 2006
New Revision: 391720

URL: http://svn.apache.org/viewcvs?rev=391720&view=rev
Log:
Insure that ContextManager.currentCaller is reset. Otherwise, ThreadLocal will be set when
the Thread is reused. This can lead to incorrect Subjects being used

Modified:
    geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java

Modified: geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java?rev=391720&r1=391719&r2=391720&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java
(original)
+++ geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java
Wed Apr  5 12:01:20 2006
@@ -22,6 +22,7 @@
 import javax.servlet.ServletResponse;
 
 import org.apache.catalina.connector.Request;
+import org.apache.geronimo.security.ContextManager;
 import org.apache.geronimo.tomcat.realm.TomcatGeronimoRealm;
 
 public class PolicyContextBeforeAfter implements BeforeAfter{
@@ -41,6 +42,7 @@
         //Save the old
         PolicyObject policyObject = new PolicyObject();
         policyObject.setContextId(PolicyContext.getContextID());
+        policyObject.setSubject(ContextManager.getCurrentCaller());
         //Save the old Request object in case it gets changed 
         //with a x-context Dispatch
         policyObject.setRequest(TomcatGeronimoRealm.getRequest());
@@ -65,11 +67,13 @@
         PolicyObject policyObject = (PolicyObject)context[policyContextIDIndex];
         
         PolicyContext.setContextID(policyObject.getContextId());
+        ContextManager.setCurrentCaller(policyObject.getSubject());
         TomcatGeronimoRealm.setRequest(policyObject.getRequest());
     }
     
     class PolicyObject{
         private String contextId = null;
+        private Subject subject = null;
         private Request request = null;
         
         public String getContextId() {
@@ -77,6 +81,12 @@
         }
         public void setContextId(String contextId) {
             this.contextId = contextId;
+        }
+        public Subject getSubject() {
+            return subject;
+        }
+        public void setSubject(Subject subject) {
+            this.subject = subject;
         }
         public Request getRequest() {
             return request;



Mime
View raw message