在编译和集群服务器上退出 securesocial [英] Getting logged out of securesocial on compile and on clustered servers

查看:19
本文介绍了在编译和集群服务器上退出 securesocial的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个关于身份验证机制本身的快速问题.securesocial 如何管理登录cookie?我在更改系统中的代码时遇到了一个小问题,并且在代码更改之前我已经登录,然后我将被注销,我需要再次登录.这对于开发来说是正确的.对于生产,我们使用一个有 2 台机器的集群系统,如果我在一台机器上开始一个请求,而下一个请求在另一台机器上,那么我每次都会被注销.有没有人知道这可能是什么或更好的为什么会发生这种情况?我们使用的是securesocial 0.2.2

I have a quick question about the authentication mechanism itself. How does securesocial manages the login cookie? I have a little problem when I change code in my system and I have been logged in before the code change then I will be logged out and I need to login again. This is true for development. For production we use a cluster system which has 2 machines if i start a request on one machine and the next request is on the other machine then I will be logged out every single time. Does anyone has an idea what this could be or better why this happens ?? we are using securesocial 0.2.2

最好的问候托马斯

推荐答案

该模块依赖于 UserService 接口的实现来保存/查找经过身份验证的用户.SecureSocial 带有一个默认实现:DefaultUserService.然而,这不适合生产环境,因为它将所有内容都存储在内存中的 HashMap 中.这就是为什么当应用在 DEV 模式下重新加载或要求您在集群环境中再次登录时,您会被注销.

The module relies on an implementation of the UserService interface to save/find users that are authenticated. SecureSocial comes with a default implementation: DefaultUserService. However this is not suitable for a production environment because it stores everything in a HashMap in memory. This is why you get logged out when the app reloads on DEV mode or you are asked to log in again in a clustered environment.

您需要提供自己对该类的实现并将内容存储在数据库或其他后备存储中.查看 UserService 中的 javadoc.

You need to provide your own implementation of that class and store things in a DB or another backing store. Checkout the javadocs in UserService.

顺便说一句,请升级到 0.2.4 版本.我修复了一个错误,该错误会阻止某些请求在应该重定向到登录页面时被授予访问权限.

BTW, please upgrade to version 0.2.4. I fixed a bug that prevented some requests to be granted access when they should be redirected to the login page.

这篇关于在编译和集群服务器上退出 securesocial的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆