- WebSecurityConfigurerAdapter deprecated
https://spring.io/blog/2022/02/21/spring-security-without-the-websecurityconfigureradapter

https://www.appsdeveloperblog.com/migrating-from-deprecated-websecurityconfigureradapter/

https://stackoverflow.com/questions/71281032/spring-security-exposing-authenticationmanager-without-websecurityconfigureradap


@Bean(BeanIds.AUTHENTICATION_MANAGER)
public AuthenticationManager authenticationManager(AuthenticationConfiguration authenticationConfiguration) throws Exception {
    return authenticationConfiguration.getAuthenticationManager();
}


@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
	// AuthenticationProvider
	http.authenticationProvider(authenticationProvider);

    // AuthenticationManager
    AuthenticationManager authManager = authenticationManager(http.getSharedObject(AuthenticationConfiguration.class));

	UsernamePasswordAuthenticationFilter authFilter = new UsernamePasswordAuthenticationFilter(authManager);

	http.addFilterAt(authFilter, UsernamePasswordAuthenticationFilter.class);
}









'spring-security' 카테고리의 다른 글

권한 계층(Role Hierarchy)  (0) 2024.02.05
HTTP Strict Transport Security (HSTS)  (0) 2022.08.10
Decode a JWT Token in Java  (0) 2022.03.13
AccessDecisionVoters  (0) 2022.02.23
method security  (0) 2022.02.23
Posted by 張's blog
,