-1

I am trying to enable "remember_me" functionality in grails. I am using latest version of Spring-security plugin for grails. I have tried many scenarios but the Remember_me functionality does not work. I can confirm that the cookie is created properly but it is deleted every time I logout and I guess that is the main reason that the functionality does not work. This is the config that I have in my resource.groovy:

grails.plugin.springsecurity.rememberMe.alwaysRemember = true
grails.plugin.springsecurity.rememberMe.key = 'admin'
grails.plugin.springsecurity.rememberMe.cookieName = 'grails_remember_me'
grails.plugin.springsecurity.rememberMe.tokenValiditySeconds = 360000

grails.plugin.springsecurity.providerNames = [
        'rememberMeAuthenticationProvider',  'daoAuthenticationProvider']

grails.plugin.springsecurity.logout.handlerNames =
        ['rememberMeServices',
         'securityContextLogoutHandler']

Anyone has a solution on my problem? Thank you so much for your help !

Lina
  • 1,217
  • 1
  • 15
  • 28
  • 1
    Isn't log out supposed to clear that? I believe that the remember me capability is intended for use after session timeout, but not an explicit logout. – Daniel Mar 11 '19 at 15:31

1 Answers1

1

In "Remember Me" functionality, after a user login, user will have access from same machine to all its data even after session expired. This access will be possible until user does a logout.

Just add <input name="_spring_security_remember_me" type="hidden" value="true"/> to your login form.

Please check this documentation for more details

Rahul Mahadik
  • 11,668
  • 6
  • 41
  • 54
  • I am using the default forms ... I do not have any gsp to modify .... grails and spring security handle all the gsp s and login related stuff... when I inspect the form , the hidden input is there... – Lina Mar 12 '19 at 08:52
  • 1
    It sounds like your 'remember me' is working as intended. Wait for a session timeout (set low for testing), then return to your application. (Do not log out.) Confirm that you do not have to log back in. – Daniel Mar 12 '19 at 15:57