SEC-722: Fixed problem with empty loginpage string (rather than null) preventing default login page filter from being added to the stack.

This commit is contained in:
Luke Taylor 2008-03-21 21:50:26 +00:00
parent b73736ffaf
commit 9871685ea3
2 changed files with 15 additions and 1 deletions

View File

@ -58,6 +58,9 @@ public class FormLoginBeanDefinitionParser implements BeanDefinitionParser {
defaultTargetUrl = elt.getAttribute(ATT_FORM_LOGIN_TARGET_URL);
authenticationFailureUrl = elt.getAttribute(ATT_FORM_LOGIN_AUTHENTICATION_FAILURE_URL);
loginPage = elt.getAttribute(ATT_LOGIN_PAGE);
if (!StringUtils.hasText(loginPage)) {
loginPage = null;
}
source = parserContext.extractSource(elt);
}
@ -73,7 +76,7 @@ public class FormLoginBeanDefinitionParser implements BeanDefinitionParser {
BeanDefinitionBuilder.rootBeanDefinition(AuthenticationProcessingFilterEntryPoint.class);
entryPointBuilder.setSource(source);
entryPointBuilder.addPropertyValue("loginFormUrl", StringUtils.hasText(loginPage) ? loginPage : DEF_LOGIN_PAGE);
entryPointBuilder.addPropertyValue("loginFormUrl", loginPage != null ? loginPage : DEF_LOGIN_PAGE);
entryPointBean = (RootBeanDefinition) entryPointBuilder.getBeanDefinition();

View File

@ -122,6 +122,17 @@ public class HttpSecurityBeanDefinitionParserTests {
}
@Test
public void formLoginWithNoLoginPageAddsDefaultLoginPageFilter() {
setContext(
" <http auto-config='true' path-type='ant' lowercase-comparisons='false'>" +
" <form-login />" +
" </http>" + AUTH_PROVIDER_XML);
FilterChainProxy filterChainProxy = getFilterChainProxy();
// These will be matched by the default pattern "/**"
checkAutoConfigFilters(filterChainProxy.getFilters("/anything"));
}
@Test
public void lowerCaseComparisonIsRespectedBySecurityFilterInvocationDefinitionSource() throws Exception {
setContext(