Issue
As you know WebSecurityConfigurerAdapter
is deprecated. Obviously I sound dumb, since "Spring Security's documentation is the most obvious, most comfortable, and simply the best documentation in the entire world", BUT how do you plug in Custom Authentication Provider in new Version?
I need alternative to this:
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.authenticationProvider(authenticationProvider);
}
Solution
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception
{
//Rest of your HttpSecurity config
http.authenticationProvider(authenticationProvider);
return http.build();
}
Look at https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter (also in comments) for how most basic authentication things are done without WebSecurityConfigurerAdapter
Answered By - Ralan
Answer Checked By - Timothy Miller (JavaFixing Admin)