You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by js...@apache.org on 2006/01/25 07:06:37 UTC
svn commit: r372130 -
/geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Author: jsisson
Date: Tue Jan 24 22:06:25 2006
New Revision: 372130
URL: http://svn.apache.org/viewcvs?rev=372130&view=rev
Log:
GERONIMO-1012 - Tomcat integration does not set a subject in an unsecured web module in a secured ejb application (merged from trunk).
Modified:
geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
Modified: geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java?rev=372130&r1=372129&r2=372130&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java (original)
+++ geronimo/branches/1.0/modules/tomcat/src/java/org/apache/geronimo/tomcat/GeronimoStandardContext.java Tue Jan 24 22:06:25 2006
@@ -134,20 +134,6 @@
PolicyContextValve policyValve = new PolicyContextValve(securityHolder.getPolicyContextID());
addValve(policyValve);
-
- //This is definitely a hack, but I don't see a reasonable way to install the defaultSubject.
- //Obviously this won't work if there are permissions. Setting the default subject if there are
- //permissions breaks authentication.
- boolean hasPermissions = securityHolder.getChecked().elements().hasMoreElements() ||
- securityHolder.getExcluded().elements().hasMoreElements();
- Valve defaultSubjectValve;
- if (!hasPermissions && defaultSubject != null) {
- defaultSubjectValve = new DefaultSubjectValve(defaultSubject);
- } else {
- //this will clear the thread of any read subject added by some other web app
- defaultSubjectValve = new DefaultSubjectValve(null);
- }
- addValve(defaultSubjectValve);
}
}
@@ -184,7 +170,11 @@
if (pipelineInitialized) {
try {
Valve valve = getFirst();
- valve.invoke(null, null);
+ valve.invoke(null, null);
+ //Install the DefaultSubjectValve after the authentication valve so the default subject is supplied
+ //only if no real subject is authenticated.
+ Valve defaultSubjectValve = new DefaultSubjectValve(defaultSubject);
+ addValve(defaultSubjectValve);
} catch (IOException e) {
if (e.getCause() instanceof LifecycleException) {
throw (LifecycleException) e.getCause();
@@ -217,8 +207,8 @@
ClassLoader cl = this.getParentClassLoader();
- Class baseServletClass = null;
- Class servletClass = null;
+ Class baseServletClass;
+ Class servletClass;
try {
baseServletClass = cl.loadClass(Servlet.class.getName());
servletClass = cl.loadClass(servletClassName);
@@ -229,7 +219,7 @@
StoredObject storedObject = (StoredObject) webServiceMap.get(wrapper.getName());
if (storedObject != null) {
- WebServiceContainer webServiceContainer = null;
+ WebServiceContainer webServiceContainer;
try {
webServiceContainer = (WebServiceContainer) storedObject.getObject(cl);
} catch (IOException io) {