我正在开发一个java spring mvc项目。这是我的 securityConfig 类的一部分:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
....
.logoutSuccessUrl("/loginForm")
...
}
当用户注销时,spring将他重定向到loginForm
页面。但是,我想动态更改此网址。事实上,我想根据某些条件将用户重定向到不同的页面。我怎样才能做到这一点?
最佳答案
Strategy that is called after a successful logout by the
LogoutFilter
, to handle redirection or forwarding to the appropriate destination.
有关 Java 配置,请参阅 LogoutConfigurer#logoutSuccessHandler .
您修改后的源代码:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.logout().logoutSuccessHandler(myLogoutSuccessHandler);
}
关于java - spring security - 动态更改注销成功url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33564991/