我正在使用Spring Security和REST,将URL (/logout
) 作为我的退出方法的端点。但是在调用此方法后,它会将我重定向到 (/login?logout
),我知道这是Spring logOutSuccessUrl
。我想取消重定向。这是我的代码:
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/login").permitAll()
.anyRequest().fullyAuthenticated()
.and().requiresChannel().anyRequest().requiresSecure()
.and().httpBasic().disable().logout()
.disable()
// .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler(HttpStatus.OK))
.csrf().disable();
}
我尝试使用HttpStatusReturningLogoutSuccessHandler
,但它没有起作用,即使设置logoutSuccessUrl()
也没有任何变化。
你知道如何禁用这个重定向吗?