Grails Spring Security LDAP remember me not working
===

My reading indicates many people have had this same problem, but I have yet to find a working solution.  My problem could be directly related to this [unresolved issue][1] because this is one error I always get if I have set `grails.plugins.springsecurity.ldap.authorities.retrieveGroupRoles = false`.

I have implemented Spring Security LDAP and have all the LDAP authentication working correctly.  I only use LDAP to authenticate a user, but the user's roles/authorities are stored in my application's database.

I have been trying to get the remember me functionality to work.  My reading indicates that I must use a persistent token (stored in database) instead of a cookie.

I have run the `s2-create-persistent-token` script and it created a domain class for me.  When I login to my application with the remember me box checked an entry is added to the `persistent_logins` table of my database.  When I close the browser and try to access a page with an `IS_AUTHENTICATED_REMEMBERED` security level I am unable to, and instead get the login page.

In the "Overview" section [here][2] it is said I need to have a `UserDetailsService` bean which I have implemented according to the docs [here][3].  I have also implemented a `UserDetails` and `UserDetailsContextMapper` in a similar fashion.

I have tried many combinations of different configurations.

I have tried to use "voters" as described [here][4].

I have tried to use a `dataSource` and `tokenRepository` as described [here][5].

I would love to hear from anyone who has been able to get this working.


**PS:**

I'm not 100% sure if when storing a persistent token in the database a cookie should also be stored on the user's PC **(how else can the token be matched to a user/PC?)**, but there is no cookie being stored on my PC when I login.

  [1]: http://jira.grails.org/browse/GPSPRINGSECURITYLDAP-14?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel
  [2]: http://static.springsource.org/spring-security/site/docs/3.0.x/reference/remember-me.html
  [3]: http://grails-plugins.github.com/grails-spring-security-core/docs/manual/guide/11%20Custom%20UserDetailsService.html
  [4]: http://www.tikalk.com/java/spring-security-3-remember-me-ldap-authentication
  [5]: http://jira.grails.org/browse/GPSPRINGSECURITYLDAP-8