Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Single login for a Particular url

 
sindhu sheela
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use Cookie or Database flag
 
sindhu sheela
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since it is a java based web application, implementing jaas will solve this issue once and for all.
 
Sreekaanth Thiruvengadam
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic