1 回答

TA貢獻1860條經驗 獲得超9個贊
在您的配置類(實現)中使用 spring 安全約束和注銷配置WebSecurityConfigurerAdapter:
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
.
...
...
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeRequests()
.antMatchers("/login*").permitAll()
.anyRequest().authenticated()
.anyRequest().authenticated()
....
.
.
.and()
.logout()
.invalidateHttpSession(true)
.deleteCookies("JSESSIONID")
}
...
...
...
}
添加回答
舉報