Рассмотрите возможность определения bean-компонента типа org.springframework.security.authentication.AuthenticationProvi ⇐ JAVA
Рассмотрите возможность определения bean-компонента типа org.springframework.security.authentication.AuthenticationProvi
ОШИБКА: параметру 1 конструктора в com.example.Security.Config.SecurityConfig требовался bean-компонент типа org.springframework.security.authentication.AuthenticationProvider, который не удалось найти. `
пожалуйста, дайте мне решение, я новичок, я учусь.
@Бин public SecurityFilterChain securityFilterChain(HttpSecurity http) выдает исключение { http.csrf().disable(); http.sessionManagement().sessionCreationPolicy(БЕЗ СОСТОЯНИЯ); http.authorizeRequests().requestMatchers(HttpMethod.OPTIONS, "/**").permitAll() .requestMatchers("/api/v1/auth/**").permitAll() .requestMatchers("/admin/**").hasAnyAuthority("ROLE_ADMIN") .requestMatchers("/user/**").hasAnyAuthority("ROLE_ADMIN", "ROLE_USER") .и() .csrf().отключить() .cors(Customizer.withDefaults()) .authorizeRequests() .Любой запрос() .аутентифицированный() .и() .authenticationProvider(провайдер аутентификации) .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); вернуть http.build(); }
ОШИБКА: параметру 1 конструктора в com.example.Security.Config.SecurityConfig требовался bean-компонент типа org.springframework.security.authentication.AuthenticationProvider, который не удалось найти. `
пожалуйста, дайте мне решение, я новичок, я учусь.
@Бин public SecurityFilterChain securityFilterChain(HttpSecurity http) выдает исключение { http.csrf().disable(); http.sessionManagement().sessionCreationPolicy(БЕЗ СОСТОЯНИЯ); http.authorizeRequests().requestMatchers(HttpMethod.OPTIONS, "/**").permitAll() .requestMatchers("/api/v1/auth/**").permitAll() .requestMatchers("/admin/**").hasAnyAuthority("ROLE_ADMIN") .requestMatchers("/user/**").hasAnyAuthority("ROLE_ADMIN", "ROLE_USER") .и() .csrf().отключить() .cors(Customizer.withDefaults()) .authorizeRequests() .Любой запрос() .аутентифицированный() .и() .authenticationProvider(провайдер аутентификации) .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); вернуть http.build(); }
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение