Issue
I've read some examples and docs on Spring security which i managed to rewrite a deprecated function on the SecurityFilterchain.
However in another function below im facing issue on not knowing how i can rewrite it in a lambda based configuration and would need help to rewrite this.
@Bean
public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception {
return http.getSharedObject(AuthenticationManagerBuilder.class)
.userDetailsService(customUserDetailService)
.passwordEncoder(passwordEncoder())
.and().build();
}
Solution
You could rewrite AuthenticationManager
Bean as next one it is going to work as expected.
@Bean
public AuthenticationManager authenticationManager(HttpSecurity http) throws Exception {
AuthenticationManagerBuilder authManagerBuilder = http.getSharedObject(AuthenticationManagerBuilder.class);
authManagerBuilder.userDetailsService(customUserDetailService)
.passwordEncoder(passwordEncoder());
return authManagerBuilder.build();
}
More details about it and some references you will be able to find spring-security-without-the-websecurityconfigureradapter post.
Answered By - Andrei Lisa
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.