I am trying to implement the remember me function on my website using Spring. Cookies and the persistent_logins table entry are created correctly. In addition, I see that the correct user is restored when the username is displayed at the top of the page.
However, as soon as I try to access any information for this user, when they return after their "remembering", I get a NullPointerException. It looks like the user is not set again in the session.
My applicationContext-security.xml contains the following:
<remember-me data-source-ref="dataSource" user-service-ref="userService"/> ... <authentication-provider user-service-ref="userService" /> <jdbc-user-service id="userService" data-source-ref="dataSource" role-prefix="ROLE_" users-by-username-query="select email as username, password, 1 as ENABLED from user where email=?" authorities-by-username-query="select user.id as id, upper(role.name) as authority from user, role, users_roles where users_roles.user_fk=id and users_roles.role_fk=role.name and user.email=?"/>
I thought this might be due to user requests by name, but of course the login will not work correctly if this request was incorrect?
Any help on this would be greatly appreciated.
Thanks, Gearoid.
source share