tags:

views:

443

answers:

2

What's the best practice to implement sign in "Remember Me" feature in Java?

Obviously, storing cookies with username and password in user's browser is not secure enough. Create authentication token in cookies and db instead? Any simple examples?

+4  A: 

Take a look at the Spring Security framework. You can achieve this scenario with a few lines of configuration.

Kees de Kooter
I agree, Spring is worth considering, but what I am looking for is design pattern and Java implementation using J2EE.
Artemij
He didn't suggest Spring, just Spring Security. You don't need to use one to use the other.
CoverosGene
"what I am looking for is design pattern and Java implementation using J2EE" ... eh? Is Spring not "J2EE" enough? I feel like "J2EE" is such a meaningless term
matt b
A: 

I'll second the suggestion of using Spring Security. It comes with a couple of different implementations for managing the token stored in the cookie on the users's browser.

http://static.springframework.org/spring-security/site/reference/html/remember-me.html

David