通过facebook登录后设置春季安全记住我cookie



我正在构建一个移动web应用程序,可以选择通过facebook/twitter登录。我希望应用程序记住通过Spring安全的记住我的功能登录,以便用户需要经常登录。

我有将调用facebook并获得将识别用户的access_token的部分。我可以使用

登录用户<>之前SecurityContextHolder.getContext () .setAuthentication (新UsernamePasswordAuthenticationToken(主体,凭据,授权));之前

我正在尝试使用类似的方法添加记住我的功能

<>之前memormeauthenticationtoken auth = new memormeauthenticationtoken (key, principal, authorities);SecurityContextHolder.getContext () .setAuthentication(身份验证);之前

当用户登录时,它没有设置记住我的cookie。我遗漏了什么?

谢谢!

尝试注入RememberMeServices接口的实现,然后尝试做:

rememberMeServices.loginSuccess(request, response, auth);

确保请求中存在_spring_security_remember_me参数

最新更新