在不同的Web应用程序之间共享Session对象

在不同的Web应用程序之间共享Session对象

问题描述:

好的,这就是问题

我有一个运行在Apache Tomcat&之上的Java应用程序。我也有这个其他应用程序,它在同一台服务器上运行自己的war文件。

I have a Java application running on top of Apache Tomcat & I have this other application too with its own war file running on the same server.

现在我想验证用户一次&将该会话传递给另一个应用程序。

Now I want to authenticate user once & pass that session to the other application.

我们可以说在同一个Apache Tomcat上进行跨域会话共享..我应该怎么做......?

We can say cross domain session sharing on same Apache Tomcat .. how should I go about it ....?

谢谢

为会话创建一个唯一的令牌并放入两个应用程序都访问的数据库表。

将令牌存储在用户的cookie中。

这样可以避免会话共享问题并且可扩展性更高。

Create a unique token for the session and put in in a db table that both apps access.
Store the token in the users's cookie.
This avoids the session sharing issue and is also more scalable.