Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sharing Session object between different web applications

Okay this is the problem

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.

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

Thank you

like image 526
Asad Khan Avatar asked Oct 28 '09 16:10

Asad Khan


2 Answers

Tomcat provides Single Sign On functionality via a valve specified within Host element in Tomcat's configuration:

<Host name="localhost" ...>
  <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
</Host>

There are certain restrictions applied, take a look at the above link (scroll to Single Sign On section) for details.

like image 170
ChssPly76 Avatar answered Nov 15 '22 19:11

ChssPly76


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.

like image 45
thethinman Avatar answered Nov 15 '22 19:11

thethinman