由于WebSecurityConfigurerAdapter
是@Deprecated
,我如何才能正确地移动到org.springframework.security.web.SecurityFilterChain
?
我的意思是,下面的过时配置的等效配置是什么?
@Configuration
static class HttpSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().anyRequest().authenticated();
http.formLogin();
http.httpBasic();
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.NEVER);
http.csrf().disable();
}
}
1条答案
按热度按时间xqk2d5yq1#
如this blog中所述,移除
extends
并暴露SecurityFilterChain
。理想情况下,您还应该重写授权部分。