在响应302上cookie不存在于cookie存储中

时间:2018-02-07 05:02:25

标签: java spring google-chrome

目前我正在使用Spring启动,并使用第三方身份验证 成功登录后,我们正在设置一个cookie,该响应在响应标题中可见,并重定向到引用者客户端

但在cookie商店中它并不存在。

public class AuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler implements
    AuthenticationSuccessHandler {
    ...
    // save a cookie 
    saveCookie("code.one",randomString,saveCookie)
    .....
     getRedirectStrategy().sendRedirect(request, response, redirectUrl);
}

public static void saveCookie(String cookieName, String value, HttpServletResponse response) {
    Cookie cookie = new Cookie(cookieName, value);
    //maxAge is one month: 30*24*60*60 
    cookie.setMaxAge(2592000);
    cookie.setDomain("projectName");
    cookie.setPath("/");
    response.addCookie(cookie);
    }
}

我在chrome 62.0.3202.94进行了测试, 任何人都可以建议任何解决方案吗?

enter image description here

enter image description here

0 个答案:

没有答案
相关问题