diff --git a/tang-framework/src/main/java/com/tang/framework/config/SecurityConfig.java b/tang-framework/src/main/java/com/tang/framework/config/SecurityConfig.java index cfc1c497..0bf43b66 100644 --- a/tang-framework/src/main/java/com/tang/framework/config/SecurityConfig.java +++ b/tang-framework/src/main/java/com/tang/framework/config/SecurityConfig.java @@ -32,6 +32,12 @@ @EnableMethodSecurity public class SecurityConfig { + private final List providers; + + public SecurityConfig(List providers) { + this.providers = providers; + } + @Bean public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity, AuthenticationEntryPoint authenticationEntryPoint, JwtAuthenticationTokenFilter jwtAuthenticationTokenFilter, LogoutSuccessHandler logoutSuccessHandler) throws Exception { @@ -60,9 +66,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity httpSecurity, Authen } @Bean - public AuthenticationManager authenticationManager(AuthenticationProvider usernameAuthenticationProvider, AuthenticationProvider emailAuthenticationProvider, - AuthenticationProvider gitHubAuthenticationProvider) { - var providers = List.of(usernameAuthenticationProvider, emailAuthenticationProvider, gitHubAuthenticationProvider); + public AuthenticationManager authenticationManager() { return new ProviderManager(providers); }