Униженные методы .csrf () и .requireschannel () после пружинной загрузки v3 миграцииJAVA

Программисты JAVA общаются здесь
Anonymous
Униженные методы .csrf () и .requireschannel () после пружинной загрузки v3 миграции

Сообщение Anonymous »

Я попытался перенести более старый проект в новейшую версию Spring Boot a.k.a 3.1.2, как мы говорим. Тем не менее, методы .csrf () и .requireschannel () из приведенного ниже куска кода больше не работают из -за детекаций. < /P>
Я не могу найти методы, которые их заменили. Вы можете помочь? < /P>
@Configuration
@EnableWebSecurity
public class ApplicationSecurityConfig {

private final ApplicationUserService applicationUserService;

private final BCryptPasswordEncoder bCryptPasswordEncoder;

public ApplicationSecurityConfig(
ApplicationUserService applicationUserService,
BCryptPasswordEncoder bCryptPasswordEncoder) {
this.applicationUserService = applicationUserService;
this.bCryptPasswordEncoder = bCryptPasswordEncoder;
}

@Bean
protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.csrf().disable()
.requiresChannel()
.antMatchers("/actuator/**")
.requiresInsecure()
.and()
.authorizeRequests()
.antMatchers(
"/api/v*/registration/**",
"/register*",
"/login",
"/actuator/**").permitAll()
.anyRequest()
.authenticated()
.and()
.formLogin()
.loginPage("/login")
.usernameParameter("email")
.permitAll()
.defaultSuccessUrl("/",true)
.failureUrl("/login-error")
.and()
.logout()
.logoutUrl("/logout")
.clearAuthentication(true)
.invalidateHttpSession(true)
.deleteCookies("JSESSIONID","Idea-2e8e7cee")
.logoutSuccessUrl("/login");

return http.build();
}

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

@Bean
public DaoAuthenticationProvider daoAuthenticationProvider() {
DaoAuthenticationProvider provider =
new DaoAuthenticationProvider();
provider.setPasswordEncoder(bCryptPasswordEncoder);
provider.setUserDetailsService(applicationUserService);
return provider;
}
}


Подробнее здесь: https://stackoverflow.com/questions/769 ... -migration

Вернуться в «JAVA»