You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2009/07/27 18:44:56 UTC
svn commit: r798211 - in /geronimo/server/trunk:
framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/
framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/
framework/modules/geronimo-security/sr...
Author: djencks
Date: Mon Jul 27 16:44:55 2009
New Revision: 798211
URL: http://svn.apache.org/viewvc?rev=798211&view=rev
Log:
GERONIMO-2622, GERONIMO-4766 Implement jacc handler data so the types dont interfere with each other. ejb and soap handlers not hooked up yet
Added:
geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ThreadData.java (with props)
geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEjbArguments.java (with props)
geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEnterpriseBean.java
- copied, changed from r797784, geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerHttpServletRequest.java
Modified:
geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java
geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/SecurityServiceImpl.java
geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerHttpServletRequest.java
geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerSOAPMessage.java
geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/ContextManagerTest.java
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/POJOWebServiceHolderWrapper.java
geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/JaccSecurityHandler.java
geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCSecurityValve.java
Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java?rev=798211&r1=798210&r2=798211&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java Mon Jul 27 16:44:55 2009
@@ -39,6 +39,7 @@
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import javax.security.auth.login.Configuration;
+import javax.security.jacc.PolicyContext;
import org.apache.geronimo.security.realm.providers.GeronimoCallerPrincipal;
@@ -49,6 +50,14 @@
public class ContextManager {
private static final ThreadLocal<Callers> callers = new ThreadLocal<Callers>();
+ private static final ThreadLocal<ThreadData> threadData = new ThreadLocal<ThreadData>() {
+ @Override
+ protected ThreadData initialValue() {
+ ThreadData threadData = new ThreadData();
+ PolicyContext.setHandlerData(threadData);
+ return threadData;
+ }
+ };
private static Map<Subject, Context> subjectContexts = new IdentityHashMap<Subject, Context>();
private static Map<SubjectId, Subject> subjectIds = Collections.synchronizedMap(new HashMap<SubjectId, Subject>());
private static long nextSubjectId = System.currentTimeMillis();
@@ -364,6 +373,12 @@
return null;
}
+ public static ThreadData getThreadData() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) sm.checkPermission(GET_CONTEXT);
+ return threadData.get();
+ }
+
public static String getAlgorithm() {
SecurityManager sm = System.getSecurityManager();
if (sm != null) sm.checkPermission(GET_CONTEXT);
Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/SecurityServiceImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/SecurityServiceImpl.java?rev=798211&r1=798210&r2=798211&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/SecurityServiceImpl.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/SecurityServiceImpl.java Mon Jul 27 16:44:55 2009
@@ -18,23 +18,31 @@
package org.apache.geronimo.security;
import java.security.Policy;
+
import javax.security.jacc.PolicyConfigurationFactory;
import javax.security.jacc.PolicyContextException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.annotation.GBean;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+import org.apache.geronimo.gbean.annotation.ParamSpecial;
+import org.apache.geronimo.gbean.annotation.SpecialAttributeType;
import org.apache.geronimo.security.jacc.PolicyContextHandlerContainerSubject;
+import org.apache.geronimo.security.jacc.PolicyContextHandlerEjbArguments;
+import org.apache.geronimo.security.jacc.PolicyContextHandlerEnterpriseBean;
import org.apache.geronimo.security.jacc.PolicyContextHandlerHttpServletRequest;
import org.apache.geronimo.security.jacc.PolicyContextHandlerSOAPMessage;
import org.apache.geronimo.security.util.ConfigurationUtil;
import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* An MBean that registers the JACC factory and handlers.
*
* @version $Rev$ $Date$
*/
+
+@GBean
public class SecurityServiceImpl implements SecurityService {
public static boolean POLICY_INSTALLED = false;
@@ -46,11 +54,15 @@
*/
public static final GeronimoSecurityPermission CONFIGURE = new GeronimoSecurityPermission("configure");
- public SecurityServiceImpl(ClassLoader classLoader, ServerInfo serverInfo, String policyConfigurationFactory,
- String policyProvider, String keyStore, String keyStorePassword,
- String trustStore, String trustStorePassword)
- throws PolicyContextException, ClassNotFoundException, IllegalAccessException, InstantiationException
- {
+ public SecurityServiceImpl(@ParamSpecial(type = SpecialAttributeType.classLoader) ClassLoader classLoader,
+ @ParamReference(name = "ServerInfo") ServerInfo serverInfo,
+ @ParamAttribute(name = "policyConfigurationFactory") String policyConfigurationFactory,
+ @ParamAttribute(name = "policyProvider") String policyProvider,
+ @ParamAttribute(name = "keyStore") String keyStore,
+ @ParamAttribute(name = "keyStorePassword") String keyStorePassword,
+ @ParamAttribute(name = "trustStore") String trustStore,
+ @ParamAttribute(name = "trustStorePassword") String trustStorePassword)
+ throws PolicyContextException, ClassNotFoundException, IllegalAccessException, InstantiationException {
/**
* @see "JSR 115 4.6.1" Container Subject Policy Context Handler
@@ -58,6 +70,8 @@
ConfigurationUtil.registerPolicyContextHandler(new PolicyContextHandlerContainerSubject(), true);
ConfigurationUtil.registerPolicyContextHandler(new PolicyContextHandlerSOAPMessage(), true);
ConfigurationUtil.registerPolicyContextHandler(new PolicyContextHandlerHttpServletRequest(), true);
+ ConfigurationUtil.registerPolicyContextHandler(new PolicyContextHandlerEnterpriseBean(), true);
+ ConfigurationUtil.registerPolicyContextHandler(new PolicyContextHandlerEjbArguments(), true);
if (!POLICY_INSTALLED) {
policyProvider = sysOverRide(policyProvider, POLICY_PROVIDER);
@@ -112,28 +126,4 @@
}
- public static final GBeanInfo GBEAN_INFO;
-
- static {
- GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(SecurityServiceImpl.class);
-
- infoFactory.addAttribute("classLoader", ClassLoader.class, false);
- infoFactory.addReference("ServerInfo", ServerInfo.class);
- infoFactory.addAttribute("policyConfigurationFactory", String.class, true);
- infoFactory.addAttribute("policyProvider", String.class, true);
- infoFactory.addAttribute("keyStore", String.class, true);
- infoFactory.addAttribute("keyStorePassword", String.class, true);
- infoFactory.addAttribute("trustStore", String.class, true);
- infoFactory.addAttribute("trustStorePassword", String.class, true);
-
- infoFactory.setConstructor(new String[]{"classLoader", "ServerInfo", "policyConfigurationFactory",
- "policyProvider", "keyStore", "keyStorePassword", "trustStore",
- "trustStorePassword"});
-
- GBEAN_INFO = infoFactory.getBeanInfo();
- }
-
- public static GBeanInfo getGBeanInfo() {
- return GBEAN_INFO;
- }
}
Added: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ThreadData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ThreadData.java?rev=798211&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ThreadData.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ThreadData.java Mon Jul 27 16:44:55 2009
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package org.apache.geronimo.security;
+
+import javax.xml.soap.SOAPMessage;
+import javax.servlet.http.HttpServletRequest;
+import javax.ejb.EnterpriseBean;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ThreadData {
+ private Callers callers;
+ private HttpServletRequest request;
+ private SOAPMessage soapMessage;
+ private EnterpriseBean bean;
+ private Object[] args;
+
+ public Callers getCallers() {
+ return callers;
+ }
+
+ public void setCallers(Callers callers) {
+ this.callers = callers;
+ }
+
+ public HttpServletRequest getRequest() {
+ return request;
+ }
+
+ public void setRequest(HttpServletRequest request) {
+ this.request = request;
+ }
+
+ public SOAPMessage getSoapMessage() {
+ return soapMessage;
+ }
+
+ public void setSoapMessage(SOAPMessage soapMessage) {
+ this.soapMessage = soapMessage;
+ }
+
+ public EnterpriseBean getBean() {
+ return bean;
+ }
+
+ public void setBean(EnterpriseBean bean) {
+ this.bean = bean;
+ }
+
+ public Object[] getArgs() {
+ return args;
+ }
+
+ public void setArgs(Object[] args) {
+ this.args = args;
+ }
+}
Propchange: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ThreadData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ThreadData.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ThreadData.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEjbArguments.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEjbArguments.java?rev=798211&view=auto
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEjbArguments.java (added)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEjbArguments.java Mon Jul 27 16:44:55 2009
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.security.jacc;
+
+import javax.security.jacc.PolicyContextException;
+import javax.security.jacc.PolicyContextHandler;
+import javax.servlet.http.HttpServletRequest;
+import javax.ejb.EnterpriseBean;
+import org.apache.geronimo.security.ThreadData;
+import org.apache.geronimo.security.ContextManager;
+
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PolicyContextHandlerEjbArguments implements PolicyContextHandler {
+ public static final String HANDLER_KEY = "javax.ejb.arguments";
+
+ public boolean supports(String key) throws PolicyContextException {
+ return HANDLER_KEY.equals(key);
+ }
+
+ public String[] getKeys() throws PolicyContextException {
+ return new String[]{HANDLER_KEY};
+ }
+
+ public Object getContext(String key, Object data) throws PolicyContextException {
+ if (HANDLER_KEY.equals(key)) {
+ return ((ThreadData)data).getArgs();
+ }
+ return null;
+ }
+
+ public static Object[] pushContextData(Object[] args) {
+ ThreadData threadData = ContextManager.getThreadData();
+ Object[] oldArgs = threadData.getArgs();
+ threadData.setArgs(args);
+ return oldArgs;
+ }
+
+ public static void popContextData(Object[] oldArgs) {
+ ThreadData threadData = ContextManager.getThreadData();
+ threadData.setArgs(oldArgs);
+ }
+}
\ No newline at end of file
Propchange: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEjbArguments.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEjbArguments.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEjbArguments.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEnterpriseBean.java (from r797784, geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerHttpServletRequest.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEnterpriseBean.java?p2=geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEnterpriseBean.java&p1=geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerHttpServletRequest.java&r1=797784&r2=798211&rev=798211&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerHttpServletRequest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerEnterpriseBean.java Mon Jul 27 16:44:55 2009
@@ -17,15 +17,18 @@
package org.apache.geronimo.security.jacc;
+import javax.ejb.EnterpriseBean;
import javax.security.jacc.PolicyContextException;
import javax.security.jacc.PolicyContextHandler;
+import org.apache.geronimo.security.ContextManager;
+import org.apache.geronimo.security.ThreadData;
/**
* @version $Rev$ $Date$
*/
-public class PolicyContextHandlerHttpServletRequest implements PolicyContextHandler {
- public static final String HANDLER_KEY = "javax.servlet.http.HttpServletRequest";
+public class PolicyContextHandlerEnterpriseBean implements PolicyContextHandler {
+ public static final String HANDLER_KEY = "javax.ejb.EnterpriseBean";
public boolean supports(String key) throws PolicyContextException {
return HANDLER_KEY.equals(key);
@@ -36,11 +39,21 @@
}
public Object getContext(String key, Object data) throws PolicyContextException {
- if (HANDLER_KEY.equals(key) && data != null) {
-
- return data;
+ if (HANDLER_KEY.equals(key)) {
+ return ((ThreadData)data).getBean();
}
-
return null;
}
-}
+
+ public static EnterpriseBean pushContextData(EnterpriseBean bean) {
+ ThreadData threadData = ContextManager.getThreadData();
+ EnterpriseBean oldBean = threadData.getBean();
+ threadData.setBean(bean);
+ return oldBean;
+ }
+
+ public static void popContextData(EnterpriseBean oldBean) {
+ ThreadData threadData = ContextManager.getThreadData();
+ threadData.setBean(oldBean);
+ }
+}
\ No newline at end of file
Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerHttpServletRequest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerHttpServletRequest.java?rev=798211&r1=798210&r2=798211&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerHttpServletRequest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerHttpServletRequest.java Mon Jul 27 16:44:55 2009
@@ -19,6 +19,9 @@
import javax.security.jacc.PolicyContextException;
import javax.security.jacc.PolicyContextHandler;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.geronimo.security.ThreadData;
+import org.apache.geronimo.security.ContextManager;
/**
@@ -36,11 +39,21 @@
}
public Object getContext(String key, Object data) throws PolicyContextException {
- if (HANDLER_KEY.equals(key) && data != null) {
-
- return data;
+ if (HANDLER_KEY.equals(key)) {
+ return ((ThreadData)data).getRequest();
}
-
return null;
}
+
+ public static HttpServletRequest pushContextData(HttpServletRequest httpServletRequest) {
+ ThreadData threadData = ContextManager.getThreadData();
+ HttpServletRequest oldRequest = threadData.getRequest();
+ threadData.setRequest(httpServletRequest);
+ return oldRequest;
+ }
+
+ public static void popContextData(HttpServletRequest oldRequest) {
+ ThreadData threadData = ContextManager.getThreadData();
+ threadData.setRequest(oldRequest);
+ }
}
Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerSOAPMessage.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerSOAPMessage.java?rev=798211&r1=798210&r2=798211&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerSOAPMessage.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/jacc/PolicyContextHandlerSOAPMessage.java Mon Jul 27 16:44:55 2009
@@ -19,6 +19,10 @@
import javax.security.jacc.PolicyContextException;
import javax.security.jacc.PolicyContextHandler;
+import javax.xml.soap.SOAPMessage;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.geronimo.security.ThreadData;
+import org.apache.geronimo.security.ContextManager;
/**
@@ -36,7 +40,21 @@
}
public Object getContext(String key, Object data) throws PolicyContextException {
- // todo: Wire in the return of the SOAPMessage object
+ if (HANDLER_KEY.equals(key)) {
+ return ((ThreadData)data).getSoapMessage();
+ }
return null;
}
+
+ public static SOAPMessage pushContextData(SOAPMessage SOAPMessage) {
+ ThreadData threadData = ContextManager.getThreadData();
+ SOAPMessage oldMessage = threadData.getSoapMessage();
+ threadData.setSoapMessage(SOAPMessage);
+ return oldMessage;
+ }
+
+ public static void popContextData(SOAPMessage oldMessage) {
+ ThreadData threadData = ContextManager.getThreadData();
+ threadData.setSoapMessage(oldMessage);
+ }
}
Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/ContextManagerTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/ContextManagerTest.java?rev=798211&r1=798210&r2=798211&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/ContextManagerTest.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/test/java/org/apache/geronimo/security/ContextManagerTest.java Mon Jul 27 16:44:55 2009
@@ -80,4 +80,5 @@
ContextManager.clearCallers();
}
}
+
}
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/POJOWebServiceHolderWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/POJOWebServiceHolderWrapper.java?rev=798211&r1=798210&r2=798211&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/POJOWebServiceHolderWrapper.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/POJOWebServiceHolderWrapper.java Mon Jul 27 16:44:55 2009
@@ -90,22 +90,6 @@
return servletHolder.getName();
}
- /**
- * TODO THIS IS NOT CALLED!!! only the ServletHolder is!!
- * Service a request with this servlet. Set the ThreadLocal to hold the
- * current JettyServletHolder.
- */
- public void handle(Request baseRequest, ServletRequest request, ServletResponse response)
- throws ServletException, UnavailableException, IOException {
-
- // TODO There has to be some way to get this in on the Servlet's init method.
-// request.setAttribute(POJOWebServiceServlet.WEBSERVICE_CONTAINER, webServiceContainer);
-
- PolicyContext.setHandlerData(Request.getRequest((HttpServletRequest) request));
-
- servletHolder.handle(baseRequest, request, response);
- }
-
public void doStart() throws Exception {
if (context != null) {
Class pojoClass = context.getWebClassLoader().loadClass(pojoClassName);
Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/JaccSecurityHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/JaccSecurityHandler.java?rev=798211&r1=798210&r2=798211&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/JaccSecurityHandler.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/handler/JaccSecurityHandler.java Mon Jul 27 16:44:55 2009
@@ -30,6 +30,7 @@
import org.apache.geronimo.jetty7.JettyContainer;
import org.apache.geronimo.security.Callers;
import org.apache.geronimo.security.ContextManager;
+import org.apache.geronimo.security.jacc.PolicyContextHandlerHttpServletRequest;
import org.eclipse.jetty.security.Authenticator;
import org.eclipse.jetty.security.SecurityHandler;
import org.eclipse.jetty.security.IdentityService;
@@ -80,15 +81,16 @@
ServletException {
String old_policy_id = PolicyContext.getContextID();
Callers oldCallers = ContextManager.getCallers();
-
+ HttpServletRequest oldRequest = PolicyContextHandlerHttpServletRequest.pushContextData(request);
try {
PolicyContext.setContextID(policyContextID);
- PolicyContext.setHandlerData(request);
+
super.handle(target, baseRequest, request, response);
} finally {
PolicyContext.setContextID(old_policy_id);
ContextManager.popCallers(oldCallers);
+ PolicyContextHandlerHttpServletRequest.popContextData(oldRequest);
}
}
Modified: geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCSecurityValve.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCSecurityValve.java?rev=798211&r1=798210&r2=798211&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCSecurityValve.java (original)
+++ geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/security/jacc/JACCSecurityValve.java Mon Jul 27 16:44:55 2009
@@ -23,12 +23,14 @@
import java.io.IOException;
import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
import javax.security.jacc.PolicyContext;
import org.apache.geronimo.tomcat.security.SecurityValve;
import org.apache.geronimo.tomcat.security.Authenticator;
import org.apache.geronimo.tomcat.security.Authorizer;
import org.apache.geronimo.tomcat.security.IdentityService;
+import org.apache.geronimo.security.jacc.PolicyContextHandlerHttpServletRequest;
import org.apache.catalina.connector.Request;
import org.apache.catalina.connector.Response;
@@ -47,13 +49,13 @@
public void invoke(Request request, Response response) throws IOException, ServletException {
String oldContextId = PolicyContext.getContextID();
PolicyContext.setContextID(policyContextId);
- PolicyContext.setHandlerData(request);
+ HttpServletRequest oldRequest = PolicyContextHandlerHttpServletRequest.pushContextData(request);
try {
super.invoke(request, response);
} finally {
PolicyContext.setContextID(oldContextId);
// Must unset handler data from thread - see GERONIMO-4574
- PolicyContext.setHandlerData(null);
+ PolicyContextHandlerHttpServletRequest.popContextData(oldRequest);
}
}
}