How do I introduce a Remember me checkbox into an existing project using Spring Security?

I have a pretty standard project with Spring Security.

I have a login form and I need to add a Remember Me checkbox. How can i do this?

I can provide code if needed.

+2


a source to share


3 answers


I think the links below will be very helpful,



+1


a source


So, this is a complete WAG - but how would I go about it, at least initially.



I would override the Spring SecurityContextPersistenceFilter so that it only stores the authentication data (i.e. SecurityContext

) if it is (you know this from some attribute you included when you submitted the login form). You can also create a new Cookie if the checkbox is checked and check for the mentioned Cookie before trying to authenticate - if the cookie exists, it contains UserDetails and will be authenticated, otherwise it is redirected to the login page.

0


a source


Here is a tutorial from mkyong which is good.

0


a source







All Articles