2

I have a pretty standard project with Spring Security.

I have a login form and I need to add 'Remember me' checkbox there. How can I do that?

I can provide some code if necessary.

Roman
  • 64,384
  • 92
  • 238
  • 332
  • Related: http://stackoverflow.com/questions/2608372/spring-security-rememberme-services-with-session-cookie – BalusC May 05 '10 at 18:15

3 Answers3

1

I think the below links will be very useful,

user184794
  • 1,036
  • 9
  • 15
  • 1
    First link can be used as step-by-step manual, second link shows an example of what you should get, from 3rd one I took '_spring_security_remember_me' param. – Roman May 10 '10 at 16:11
  • Some of this information did not work for spring 3.1. Second link for instance has some of the tags that does not work for that particular version and gives an error if inserted. – will824 Jan 15 '13 at 19:22
  • @will824 try with this link http://outbottle.com/spring-3-security-custom-login-form-with-remember-me/ – Hidalgo Oct 08 '13 at 17:29
0

Here is a tutorial from mkyong that is good.

nilsi
  • 10,351
  • 10
  • 67
  • 79
0

So this is a complete WAG - but it's how I would do it, at least initially.

I would override the Spring SecurityContextPersistenceFilter so that it only saves the Authentication details (i.e. the SecurityContext) if that box is checked (you would know this by some attribute you included when you POST the Form for login). You could also, possibly, create a new Cookie if the box is checked and check for the existence of said Cookie before you try Authentication - if the cookie exists it contains the UserDetails and will authenticate, otherwise redirect to the login page.

Gandalf
  • 9,648
  • 8
  • 53
  • 88