Spring重定向到URL的一部分

时间:2017-07-27 08:17:44

标签: spring security redirect logout

使用Spring启动,以这种方式设置注销:

 @Override
 protected void configure(HttpSecurity http) throws Exception {

    http
      .logout()
      .logoutSuccessUrl("https://www.my-sso-server.com/logout?
           redirectto=https://www.my-appli-server.com/my-context")
    ;

但是在服务器响应中,重定向URL是 https://www.my-appli-server.com/my-context

我在调试模式下仔细检查了所有内容并注意到更改上下文,重定向网址是完整的:例如。

https://www.my-sso-server.com/logout?redirectto=https://www.my-appli-server.com/not-my-context

被很好地重定向到此网址

似乎在参数的url中拥有当前上下文会重定向到同一个url。

这种行为有什么解释吗?如何绕过它?

注意:我还尝试定义一个自定义LogoutSuccessHandler,我在其中手动处理重定向:

response.setStatus(HttpServletResponse.SC_FOUND);
response.setHeader("Location", ...

但结果是相同的

1 个答案:

答案 0 :(得分:0)

在您的开发者工具中启用preserve log。您的浏览器将所有重定向合并到(第一个请求,最后一个响应)。

enter image description here