diff --git a/core/src/main/java/org/acegisecurity/intercept/web/FilterSecurityInterceptor.java b/core/src/main/java/org/acegisecurity/intercept/web/FilterSecurityInterceptor.java
index 2012462d54..39bf223f3e 100644
--- a/core/src/main/java/org/acegisecurity/intercept/web/FilterSecurityInterceptor.java
+++ b/core/src/main/java/org/acegisecurity/intercept/web/FilterSecurityInterceptor.java
@@ -51,6 +51,7 @@ public class FilterSecurityInterceptor extends AbstractSecurityInterceptor {
//~ Instance fields ========================================================
private FilterInvocationDefinitionSource objectDefinitionSource;
+ private boolean observeOncePerRequest = true;
//~ Methods ================================================================
@@ -63,14 +64,37 @@ public class FilterSecurityInterceptor extends AbstractSecurityInterceptor {
return this.objectDefinitionSource;
}
+ public void setObserveOncePerRequest(boolean observeOncePerRequest) {
+ this.observeOncePerRequest = observeOncePerRequest;
+ }
+
+ /**
+ * Indicates whether once-per-request handling will be observed. By default
+ * this is true
, meaning the
+ * FilterSecurityInterceptor
will only execute
+ * once-per-request. Sometimes users may wish it to execute more than once
+ * per request, such as when JSP forwards are being used and filter
+ * security is desired on each included fragment of the HTTP request.
+ *
+ * @return true
(the default) if once-per-request is honoured,
+ * otherwise false
if
+ * FilterSecurityInterceptor
will enforce
+ * authorizations for each and every fragment of the HTTP request.
+ */
+ public boolean isObserveOncePerRequest() {
+ return observeOncePerRequest;
+ }
+
public Class getSecureObjectClass() {
return FilterInvocation.class;
}
public void invoke(FilterInvocation fi) throws Throwable {
if ((fi.getRequest() != null)
- && (fi.getRequest().getAttribute(FILTER_APPLIED) != null)) {
- // filter already applied to this request, so don't re-do security checking
+ && (fi.getRequest().getAttribute(FILTER_APPLIED) != null)
+ && observeOncePerRequest) {
+ // filter already applied to this request and user wants us to observce
+ // once-per-request handling, so don't re-do security checking
fi.getChain().doFilter(fi.getRequest(), fi.getResponse());
} else {
// first time this request being called, so perform security checking
diff --git a/doc/xdocs/changes.xml b/doc/xdocs/changes.xml
index a431c842f3..5bb16f64b1 100644
--- a/doc/xdocs/changes.xml
+++ b/doc/xdocs/changes.xml
@@ -44,6 +44,7 @@
JBoss container adapter to use getName() instead to toString() (see http://opensource.atlassian.com/projects/spring/browse/SEC-22)
HttpSessionContextIntegrationFilter elegantly handles IOExceptions and ServletExceptions within filter chain (see http://opensource.atlassian.com/projects/spring/browse/SEC-20)
Form, CAS, X509 and Remember-Me authentication mechanisms now publish an InteractiveAuthenticationSuccessEvent (see http://opensource.atlassian.com/projects/spring/browse/SEC-5)
+ FilterSecurityInterceptor now has an observeOncePerRequest boolean property, allowing multiple fragments of the HTTP request to be individually authorized (see http://opensource.atlassian.com/projects/spring/browse/SEC-14)
Correct location of AuthenticationSimpleHttpInvokerRequestExecutor in clientContext.xml