Prior to updating from Spring Security 5.3.24 I was able to dynamically configure multiple login solutions on an HttpSecurity such as saml2Login, and two formLogin with differing loginProcessingUrl configurations e.g.
(httpSecurity
.authorizeRequests()
.antMatchers("/index.html","/static/**").permitAll()
.anyRequest().authenticated()
.and()
.exceptionHandling()
.defaultAuthenticationEntryPointFor(
loginUrlauthenticationEntryPoint(),
new AntPathRequestMatcher("/**"))
.and());
followed by
.saml2Login(saml2 -> saml2
.relyingPartyRegistrationRepository(relyingPartyRegistrationRepository)
.successHandler(authenticationSuccessHandler));
and
.formLogin(form -> form
.loginPage("/index.html")
.loginProcessingUrl("/app/internal/login" + "/**").permitAll()
.successHandler(authenticationSuccessHandler)
.failureHandler(new AuthenticationFailureHandler() {
And this all worked providing urls for all the login methods. Updating Spring Security 6 (6.1.3) this no longer works. Has this functionality been removed or is there some other way of configuring multiple ways to login with separate url's for handling them all?
I think the problems that you met in is deprecated methods and to be sure here are the problem i recommend you to rewrite the
securityFilterChain
something like this:If it also doesn't help you should create two instance of
securityFilter
@Bean
a good example how to do it you can find here a most upvoted answer of this questionAlso you have to check Migration Guide