diff --git a/config/src/test/groovy/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.groovy b/config/src/test/groovy/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.groovy index 0bb4a6de47..4446004e76 100644 --- a/config/src/test/groovy/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.groovy +++ b/config/src/test/groovy/org/springframework/security/config/annotation/web/configurers/FormLoginConfigurerTests.groovy @@ -186,6 +186,45 @@ class FormLoginConfigurerTests extends BaseSpringSpec { } } + def "FormLogin loginProcessingUrl"() { + setup: + loadConfig(FormLoginLoginProcessingUrlConfig) + request.servletPath = "/loginCheck" + request.method = "POST" + request.parameters.username = ["user"] as String[] + request.parameters.password = ["password"] as String[] + when: + springSecurityFilterChain.doFilter(request, response, new MockFilterChain()) + then: + response.redirectedUrl == "/" + } + + @Configuration + @EnableWebSecurity + static class FormLoginLoginProcessingUrlConfig extends BaseWebConfig { + + @Override + protected void configure(HttpSecurity http) { + http + .authorizeRequests() + .anyRequest().authenticated() + .and() + .formLogin() + .loginProcessingUrl("/loginCheck") + .loginPage("/login") + //.failureUrl("/loginFailure") + .defaultSuccessUrl("/", true) + .passwordParameter("password") + .usernameParameter("username") + .permitAll() + .and() + .logout() + .logoutSuccessUrl("/login") + .logoutUrl("/logout") + .deleteCookies("JSESSIONID") + } + } + def "FormLogin uses PortMapper"() { when: "load formLogin() with permitAll" FormLoginUsesPortMapperConfig.PORT_MAPPER = Mock(PortMapper)