diff --git a/config/src/test/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParserTests.java b/config/src/test/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParserTests.java
index 63cbd16ef7..d989534bb5 100644
--- a/config/src/test/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParserTests.java
+++ b/config/src/test/java/org/springframework/security/config/http/HttpSecurityBeanDefinitionParserTests.java
@@ -558,10 +558,12 @@ public class HttpSecurityBeanDefinitionParserTests {
// Decorated user-filters should be added to stack. The others should be ignored.
String contextHolderFilterClass = SecurityContextHolderAwareRequestFilter.class.getName();
String contextPersistenceFilterClass = SecurityContextPersistenceFilter.class.getName();
+ System.setProperty("customFilterRef", "userFilter1");
setContext(
+ "" +
"" +
- " " +
+ " " +
" " +
" " +
"" + AUTH_PROVIDER_XML +
diff --git a/itest/context/src/test/java/org/springframework/security/integration/HttpNamespaceWithMultipleInterceptorsTests.java b/itest/context/src/test/java/org/springframework/security/integration/HttpNamespaceWithMultipleInterceptorsTests.java
new file mode 100644
index 0000000000..fb6b31015c
--- /dev/null
+++ b/itest/context/src/test/java/org/springframework/security/integration/HttpNamespaceWithMultipleInterceptorsTests.java
@@ -0,0 +1,57 @@
+package org.springframework.security.integration;
+
+import static org.junit.Assert.*;
+
+import javax.servlet.http.HttpSession;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.mock.web.MockFilterChain;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.mock.web.MockHttpSession;
+import org.springframework.security.authentication.TestingAuthenticationToken;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.web.FilterChainProxy;
+import org.springframework.security.web.context.HttpSessionSecurityContextRepository;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@ContextConfiguration(locations={"/http-extra-fsi-app-context.xml"})
+@RunWith(SpringJUnit4ClassRunner.class)
+public class HttpNamespaceWithMultipleInterceptorsTests {
+
+ @Autowired
+ private FilterChainProxy fcp;
+
+ @Test
+ public void requestThatIsMatchedByDefaultInterceptorIsAllowed() throws Exception {
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.setServletPath("/somefile.html");
+ request.setSession(createAuthenticatedSession("ROLE_0", "ROLE_1", "ROLE_2"));
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ fcp.doFilter(request, response, new MockFilterChain());
+ assertEquals(200, response.getStatus());
+ }
+
+ @Test
+ public void securedUrlAccessIsRejectedWithoutRequiredRole() throws Exception {
+ MockHttpServletRequest request = new MockHttpServletRequest();
+ request.setServletPath("/secure/somefile.html");
+ request.setSession(createAuthenticatedSession("ROLE_0"));
+ MockHttpServletResponse response = new MockHttpServletResponse();
+ fcp.doFilter(request, response, new MockFilterChain());
+ assertEquals(403, response.getStatus());
+ }
+
+ public HttpSession createAuthenticatedSession(String... roles) {
+ MockHttpSession session = new MockHttpSession();
+ SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken("bob", "bobspassword", roles));
+ session.setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, SecurityContextHolder.getContext());
+ SecurityContextHolder.clearContext();
+ return session;
+ }
+
+
+}
diff --git a/itest/context/src/test/resources/http-extra-fsi-app-context.xml b/itest/context/src/test/resources/http-extra-fsi-app-context.xml
new file mode 100644
index 0000000000..eb2edf40be
--- /dev/null
+++ b/itest/context/src/test/resources/http-extra-fsi-app-context.xml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+