aspose file tools*
The moose likes JSP and the fly likes Single login for a Particular url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Single login for a Particular url" Watch "Single login for a Particular url" New topic
Author

Single login for a Particular url

sindhu sheela
Greenhorn

Joined: May 20, 2008
Posts: 26
Hi All,

I'm required to restrict a user from signing into the same URL second time.
i.e., when a user A has logged in to the application with user name "A",he can not log in with other user name with in the same browser.
I had an idea like, on load of the login page i will check for the session, if the session is null direct to the login page else, to the home page.
But how will i be able to check the session in login page?

Thanks in advance
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Use Cookie or Database flag
sindhu sheela
Greenhorn

Joined: May 20, 2008
Posts: 26
i fear if you got my question wrong.
I was trying to say that given a client only one user can login to the application with in the same browser.If he visits the same URL in a new tab or new window of the same browser he should be directed to home page directly need not login again,i.e.,He will not be able to view login page again so their is no chance for him to log in with a different user name.
Charbel Keyrouz
Ranch Hand

Joined: Jun 10, 2005
Posts: 46
Since it is a java based web application, implementing jaas will solve this issue once and for all.
Sreekaanth Thiruvengadam
Greenhorn

Joined: Aug 14, 2009
Posts: 2
Consider you are using session in your code, then whenever a new window opened that would have new session... so you can solve a part of the problem by this....
when going for a new tab try the same.... session and cookie combined will give you a answer...

reply how it works....
Charbel Keyrouz
Ranch Hand

Joined: Jun 10, 2005
Posts: 46
Sorry to say but if you a open a new window from an existing window it will still be in the same session, same thing goes when you open another tab.

I think the solution resides in setting in the session an array or a list of any type containing all the visited URLs by the user.

At the beginning of each page that is called you should check if this url was visited or not, if not let him do whatever he wants otherwise force redirection to the home page.

Remember that a session ID will remain the same as long you did not log out or session did not expire and you are in the same browser not matter how many tabs you open or how many windows you open.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Single login for a Particular url