Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Preserving Login Information  RSS feed

 
Vivek Saxena
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have question about "Preserving Login Information" or "Passing Authentication Information to all other pages".
Q1.
once a user has logged in, and we have confirmed that the loging is correct, How do we keep track this information for all future user request that we have validate this user and this is a valid user. what is the best and way to achieve this task?
Just to let know that i am using Programmatic authentication( one way Encryption ) for my login authentication.
Q2.
Once user leave the application , lets say user opens yahoo.com without
clicking on logout link on the application. how can we prompt user for login/password, if he/she try to use application using "Back" button?
If someone can help me or point me to a example where i can see how do we solve or implement both the problem? please do help me because i have to build this application and give a demo ASAP ( not fully but loging part).

waiting for help and thanks for help.
vivek
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
vivek_saxena
Welcome to the Java Ranch, we hope you’ll enjoy visiting as a regular however,
your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
For your first question you can use a session variable to store th users login name or just a Boolean. Then on all of your pages just check this variable to make sure it has a name in it or the Boolean is true. When they hit your logout button jst set the variable to "" or false depending on what you use. It will alos get set to null if the session times out.
As far as I know there is no easy, reliable way to detect when a user leaves your pages. Someone else here might ave mroe input on that.
 
Vivek Saxena
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I did change my name.
could someone please help me with my problems in detail or point me to example?
please do help me.
thanks
 
Adam Hardy
Ranch Hand
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi vivek,
I generally store some sort of indication that the user is logged on in the session. The user's Id generally.
To secure your pages from being accessed thro the browser history, you should try 'expiring' them, but this works differently for different browsers and I'm not totally sure. It's something I've been meaning to find out about but never got around to.
I used to do it with ASP when I was a Microsoftie - you could check out this article and see if it gives you anything you could translate to java:
http://www.learnasp.com/learn/cachenomore.asp
HTH
Adam
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!