我正在使用 liferay 6.1 并创建了我的自定义 portlet 我正在使用 liferay 登录 portlet,并且在按照以下步骤登录时遇到一些问题..
- 使用 user1 登录
- 现在打开具有相同网址的不同选项卡,该选项卡将自动登录到 liferay 中的 user1 帐户
- 现在从任何选项卡注销,然后您将从两个选项卡注销
- 现在从两个选项卡首先在选项卡 1 中使用 user1 登录
- 现在从 tab2 使用 user2 登录
现在liferay将在同一个浏览器中使用不同的选项卡与我一起登录两个不同的用户。(当我刷新页面时,它将使用最后一个用户登录帐户自动登录) 现在我想要的是,当同一用户尝试使用同一浏览器登录时,它会自动重定向到在选项卡中首先登录的用户帐户..
任何人都可以指导我如何做到这一点吗?
我尝试对 portlet-ext.properties 文件进行一些更改,如下所示,但没有成功
live.users.enabled=true
#
# Set the following to true if users are allowed to have simultaneous logins
# from different sessions. This property is not used unless the property
# "live.users.enabled" is set to true.
#
auth.simultaneous.logins=false
最佳答案
发生这种情况是因为浏览器选项卡通过 cookie 共享同一 session 。因此,您需要禁用 liferay 应用程序的 cookie,以便使用相同的浏览器进行不同的帐户登录。您可以将以下属性设置为 false
,默认情况下它们为 true:
#
# Set this to false to disable all persistent cookies. Features like
# automatically logging in will not work.
#
session.enable.persistent.cookies=true
#
# Set this to true to test whether users have cookie support before allowing
# them to sign in.
#
session.test.cookie.support=true
如果cookie被禁用,liferay将通过附加jsessionId使用url重写来维护 session 。
我还没有尝试过,但我认为这应该可行。
关于authentication - 如何避免在liferay中从同一浏览器多次登录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15629893/