diff --git a/config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java b/config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java index 610b52e1a1..ce398aed0f 100644 --- a/config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java +++ b/config/src/test/java/org/springframework/security/config/FilterChainProxyConfigTests.java @@ -17,8 +17,7 @@ package org.springframework.security.config; import static org.junit.Assert.*; import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.*; import java.util.List; @@ -53,6 +52,8 @@ public class FilterChainProxyConfigTests { @Before public void loadContext() { + System.setProperty("sec1235.pattern1", "/login"); + System.setProperty("sec1235.pattern2", "/logout"); appCtx = new ClassPathXmlApplicationContext("org/springframework/security/util/filtertest-valid.xml"); } @@ -113,6 +114,17 @@ public class FilterChainProxyConfigTests { assertNull(filterChainProxy.getFilters(url)); } + // SEC-1235 + @Test + public void mixingPatternsAndPlaceholdersDoesntCauseOrderingIssues() throws Exception { + FilterChainProxy filterChainProxy = (FilterChainProxy) appCtx.getBean("sec1235FilterChainProxy", FilterChainProxy.class); + + String[] paths = filterChainProxy.getFilterChainMap().keySet().toArray(new String[0]); + assertEquals("/login*", paths[0]); + assertEquals("/logout", paths[1]); + assertEquals("/**", paths[2]); + } + private void checkPathAndFilterOrder(FilterChainProxy filterChainProxy) throws Exception { List filters = filterChainProxy.getFilters("/foo/blah"); assertEquals(1, filters.size()); diff --git a/config/src/test/resources/org/springframework/security/util/filtertest-valid.xml b/config/src/test/resources/org/springframework/security/util/filtertest-valid.xml index 898a60edd1..aff02845c8 100644 --- a/config/src/test/resources/org/springframework/security/util/filtertest-valid.xml +++ b/config/src/test/resources/org/springframework/security/util/filtertest-valid.xml @@ -89,6 +89,16 @@ http://www.springframework.org/schema/security http://www.springframework.org/sc + + + + + + + + + +