Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create one login servlet and have other WARs reference it?  RSS feed

 
Mark McKay
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to design a website that will require users to register and login before they use it. In order to keep things separate, I was thinking it might be useful to create a single web archive that just handles the user signup and login. That way I could work on my other web archive apps independently and have them just check to see if the user has logged in and posted a token somewhere, and if not redirect to the login webpage.

Is there a way to do this?

 
K. Tsang
Bartender
Posts: 3620
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK so you plan to have a WAR (web archive) just for login and registration. Then other WAR files doing other stuff.

Yes this is indeed possible. Create a EAR file (enterprise archive) and add all the relevant WAR files in it). Set the entry point URL to the login/reg WAR file.

Now once logged in, you will need to redirect to a new web archive's files (one of those other WARs). Similarly when user logs out redirect it back to the login page.

Thinking about it, will this mean you need a separate archive for logout only or each other WAR has a logout?

Also I really don't know how sessions are maintained from WAR to WAR.
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds exactly like what SSO (single sign-on) is for. You may wish to check out the existing solutions in this space - see http://www.coderanch.com/how-to/java/SecurityFaq#web-apps for a list of some of them.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!