Resolve a Weblogic compatibility issue (patch thanks to Patrick Burleson).

This commit is contained in:
Ben Alex 2004-07-15 23:27:59 +00:00
parent e3be8f20bb
commit 2f2b054b7a
3 changed files with 76 additions and 51 deletions

View File

@ -12,6 +12,7 @@ Changes in version 0.6 (2004-xx-xx)
* Improved test coverage (now 98.3%) * Improved test coverage (now 98.3%)
* Fixed Linux compatibility issues (directory case sensitivity etc) * Fixed Linux compatibility issues (directory case sensitivity etc)
* Fixed AbstractProcessingFilter to handle servlet spec container differences * Fixed AbstractProcessingFilter to handle servlet spec container differences
* Fixed AbstractIntegrationFilter to resolve a Weblogic compatibility issue
* Fixed CasAuthenticationToken if proxy granting ticket callback not requested * Fixed CasAuthenticationToken if proxy granting ticket callback not requested
* Documentation improvements * Documentation improvements

View File

@ -20,4 +20,11 @@ contributions to the Acegi Security System for Spring project:
public automated Maven build at the Monkey Machine public automated Maven build at the Monkey Machine
(http://www.monkeymachine.co.uk/acegi). (http://www.monkeymachine.co.uk/acegi).
* Patrick Burleson contributed a patch for Weblogic support.
* Anyone else I've forgotten (please let me know so I can correct this).
Plus of course all the people who use the project and provide feedback, bug
reports, suggestions and help fellow users.
$Id$ $Id$

View File

@ -68,7 +68,13 @@ import javax.servlet.ServletResponse;
* instance defined by the {@link #setSecureContext(Class)} method. * instance defined by the {@link #setSecureContext(Class)} method.
* </p> * </p>
* *
* <P>
* This filter will only execute once per request, to resolve servlet container
* (specifically Weblogic) incompatibilities.
* </p>
*
* @author Ben Alex * @author Ben Alex
* @author Patrick Burleson
* @version $Id$ * @version $Id$
*/ */
public abstract class AbstractIntegrationFilter implements InitializingBean, public abstract class AbstractIntegrationFilter implements InitializingBean,
@ -76,6 +82,7 @@ public abstract class AbstractIntegrationFilter implements InitializingBean,
//~ Static fields/initializers ============================================= //~ Static fields/initializers =============================================
protected static final Log logger = LogFactory.getLog(AbstractIntegrationFilter.class); protected static final Log logger = LogFactory.getLog(AbstractIntegrationFilter.class);
private static final String FILTER_APPLIED = "__acegi_integration_fitlerapplied";
//~ Instance fields ======================================================== //~ Instance fields ========================================================
@ -114,6 +121,14 @@ public abstract class AbstractIntegrationFilter implements InitializingBean,
public void doFilter(ServletRequest request, ServletResponse response, public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException { FilterChain chain) throws IOException, ServletException {
if ((request != null) && (request.getAttribute(FILTER_APPLIED) != null)) {
// ensure that filter is only applied once per request
chain.doFilter(request, response);
} else {
if (request != null) {
request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
}
// Populate authentication information // Populate authentication information
Object extracted = this.extractFromContainer(request); Object extracted = this.extractFromContainer(request);
@ -167,7 +182,8 @@ public abstract class AbstractIntegrationFilter implements InitializingBean,
.getContext(); .getContext();
// Update container with new Authentication object (may have been updated during method invocation) // Update container with new Authentication object (may have been updated during method invocation)
this.commitToContainer(request, secureContext.getAuthentication()); this.commitToContainer(request,
secureContext.getAuthentication());
// Remove authentication information from ContextHolder // Remove authentication information from ContextHolder
secureContext.setAuthentication(null); secureContext.setAuthentication(null);
@ -179,6 +195,7 @@ public abstract class AbstractIntegrationFilter implements InitializingBean,
} }
} }
} }
}
/** /**
* Subclasses must override this method to provide the <code>Object</code> * Subclasses must override this method to provide the <code>Object</code>