File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Remember Me Functionality Implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Remember Me Functionality Implementation" Watch "Remember Me Functionality Implementation" New topic
Author

Remember Me Functionality Implementation

Vaibhav G Garg
Ranch Hand

Joined: Sep 23, 2011
Posts: 140
I have to implement Remember Me Functionality in a web application. Please provide inputs to achieve the same. Also, if the cookies are disabled then what is the alternative so that if the user comes after 4-5 days, he is automatically logged in to the system when he hits the web site url.
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

Vaibhav, use cookies for remember me and single sign on. I am not very sure but you can also use client IP to identify and validate him.
Vaibhav G Garg
Ranch Hand

Joined: Sep 23, 2011
Posts: 140
harshvardhan ojha wrote:Vaibhav, use cookies for remember me and single sign on. I am not very sure but you can also use client IP to identify and validate him.


Thanks for your inputs Harshvardhan. But, generally the IP gets allocated dynamically and hence, it will be different each and every time.
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

then the only option you are left with is cookies, BTW cookies are the reliable way. Any specific requirement?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42263
    
  64
The way to do this are sessions, not cookies. And sessions work even in the absence of cookies (read up on URL rewriting, which is supported by the servlet specification).

And yes, using IP addresses has numerous problems that render this approach unusable in the general case.


Ping & DNS - my free Android networking tools app
harshvardhan ojha
Ranch Hand

Joined: Jul 26, 2007
Posts: 157
    
    1

Ulf, how can we identify a user next time using URL rewriting? I don't think user will bookmark my URL or I can't keep my session active for so long.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42263
    
  64
Doesn't the user have to log in? At which point he'd be authenticated?

But ultimately, if the user doesn't accept cookies then hid experience of the modern web will be diminished. I think thats's a perfectly acceptable tradeoff.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Remember Me Functionality Implementation