如何避免在liferay中从同一个浏览器进行多次登录?

时间:2013-03-26 05:18:58

标签: login liferay portlet liferay-6

我正在使用liferay 6.1并创建了我的自定义portlet 我正在使用liferay登录portlet,因为我在使用以下步骤登录时遇到了一些问题..

  • 使用user1登录
  • 现在打开带有相同网址的不同标签,它会自动登录到liferay中的user1帐户
  • 现在从任何标签中退出,然后你将从标签
  • 中退出
  • 现在从两个标签首次登录tab1中的user1
  • 现在从tab2
  • 登录user2

现在liferay将在同一个borwser中使用不同的标签向我登录两个不同的用户。(当我刷新页面时,它将使用最后一个用户登录帐户自动登录) 现在我想要的是当同一个用户尝试使用相同的浏览器登录时,它将自动重定向到首先登录选项卡的用户帐户..

任何人都可以告诉我怎么做?

我尝试过对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 

1 个答案:

答案 0 :(得分:2)

这种情况正在发生,因为浏览器标签通过Cookie共享同一会话。因此,您需要为liferay应用程序禁用cookie,以便使用相同的浏览器进行不同的帐户登录。您可以将以下属性设置为false,默认情况下为真:

#
# 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将使用url-rewriting来维护会话,方法是附加jsessionId。

我还没有尝试过,但我认为这应该有用。