OPEN - issue SEC-763: Allow setting of alwaysUseDirectTargetUrl via form-login namespace URL

http://jira.springframework.org/browse/SEC-763. Added always-use-default target attribute to namespace.
This commit is contained in:
Luke Taylor
2008-04-11 12:03:55 +00:00
parent 3e259b460c
commit 7145198e5a
4 changed files with 75 additions and 50 deletions

View File

@@ -131,12 +131,24 @@ public class HttpSecurityBeanDefinitionParserTests {
@Test
public void formLoginWithNoLoginPageAddsDefaultLoginPageFilter() throws Exception {
setContext(
" <http auto-config='true' path-type='ant' lowercase-comparisons='false'>" +
" <form-login />" +
" </http>" + AUTH_PROVIDER_XML);
"<http auto-config='true' path-type='ant' lowercase-comparisons='false'>" +
" <form-login />" +
"</http>" + AUTH_PROVIDER_XML);
// These will be matched by the default pattern "/**"
checkAutoConfigFilters(getFilters("/anything"));
}
@Test
public void formLoginAlwaysUseDefaultSetsCorrectProperty() throws Exception {
setContext(
"<http>" +
" <form-login default-target-url='/default' always-use-default-target='true' />" +
"</http>" + AUTH_PROVIDER_XML);
// These will be matched by the default pattern "/**"
AuthenticationProcessingFilter filter = (AuthenticationProcessingFilter) getFilters("/anything").get(2);
assertEquals("/default", filter.getDefaultTargetUrl());
assertEquals(Boolean.TRUE, FieldUtils.getFieldValue(filter, "alwaysUseDefaultTargetUrl"));
}
@Test
public void lowerCaseComparisonIsRespectedBySecurityFilterInvocationDefinitionSource() throws Exception {
@@ -385,10 +397,6 @@ public class HttpSecurityBeanDefinitionParserTests {
getFilters.setAccessible(true);
return (List) ReflectionUtils.invokeMethod(getFilters, fcp, new Object[] {url});
}
private FilterChainProxy getFilterChainProxy() {
return (FilterChainProxy) appContext.getBean(BeanIds.FILTER_CHAIN_PROXY);
}
private FilterInvocation createFilterinvocation(String path, String method) {
MockHttpServletRequest request = new MockHttpServletRequest();