【发布时间】:2016-07-21 03:31:13
【问题描述】:
我正在使用带有 REST 的 Spring Security,并且我正在使用 URL (/logout) 作为我的注销方法的端点。但是调用这个方法后,它把我重定向到(/login?logout),我知道这是春天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() 也不会改变任何东西。
您知道如何禁用此重定向吗?
【问题讨论】:
-
本文详细介绍了如何禁用注销重定向:baeldung.com/spring-security-disable-logout-redirects
标签: java spring spring-security