geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgenen...@apache.org
Subject svn commit: r391699 - /geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java
Date Wed, 05 Apr 2006 18:39:34 GMT
Author: jgenender
Date: Wed Apr  5 11:39:33 2006
New Revision: 391699

URL: http://svn.apache.org/viewcvs?rev=391699&view=rev
Log:
Reset the current caller in the before afters

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

Modified: geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java?rev=391699&r1=391698&r2=391699&view=diff
==============================================================================
--- geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java
(original)
+++ geronimo/trunk/modules/tomcat/src/java/org/apache/geronimo/tomcat/interceptor/PolicyContextBeforeAfter.java
Wed Apr  5 11:39:33 2006
@@ -16,10 +16,13 @@
  */
 package org.apache.geronimo.tomcat.interceptor;
 
+import javax.security.auth.Subject;
 import javax.security.jacc.PolicyContext;
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 
+import org.apache.geronimo.security.ContextManager;
+
 public class PolicyContextBeforeAfter implements BeforeAfter{
     
     private final BeforeAfter next;
@@ -35,7 +38,11 @@
     public void before(Object[] context, ServletRequest httpRequest, ServletResponse httpResponse)
{
         
         //Save the old
-        context[policyContextIDIndex] = PolicyContext.getContextID();
+        PolicyHolder policyHolder = new PolicyHolder();
+        policyHolder.setContextId(PolicyContext.getContextID());
+        policyHolder.setSubject(ContextManager.getCurrentCaller());
+        
+        context[policyContextIDIndex] = policyHolder;
         
         //Set the new
         PolicyContext.setContextID(policyContextID);
@@ -52,7 +59,28 @@
         }
         
         //Replace the old
-        PolicyContext.setContextID((String)context[policyContextIDIndex]);
+        PolicyHolder policyHolder = (PolicyHolder)context[policyContextIDIndex];
+        PolicyContext.setContextID(policyHolder.getContextId());
+        ContextManager.setCurrentCaller(policyHolder.getSubject());
+    }
+    
+    class PolicyHolder{
+        
+        private Subject subject;
+        private String contextId;
+        
+        public String getContextId() {
+            return contextId;
+        }
+        public void setContextId(String contextId) {
+            this.contextId = contextId;
+        }
+        public Subject getSubject() {
+            return subject;
+        }
+        public void setSubject(Subject subject) {
+            this.subject = subject;
+        }
     }
 
 }



Mime
View raw message