Skip to Content
1
Former Member
Apr 14, 2016 at 06:35 PM

How to implement remember me functionality in storefront ?

739 Views

Hi Experts,

I'm implementing now remember me functionality in storefront 5.7, which automatically logs a customer into the storefront based on a cookie., but currently it's not the case ! When I close navigator and remember me was checked, I'm redirected to login page which is wrong !

below is all steps used to implement remember me :

1- modify "spring-security-config.xml"

... ...

...

 <bean id="rememberMeProcessingFilter" class="org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter" >
     <property name="rememberMeServices" ref="rememberMeServices"/>
     <property name="authenticationManager" ref="authenticationManager"/>
 </bean>
 
 <alias name="defaultRememberMeServices" alias="rememberMeServices"/>
 <bean id="defaultRememberMeServices" class="de.hybris.platform.yacceleratorstorefront.security.AcceleratorRememberMeServices" >
     <property name="userDetailsService" ref="originalUidUserDetailsService" />
     <property name="key" value="yacceleratorstorefront" />
     <property name="cookieName" value="yacceleratorstorefrontRememberMe" />
     <property name="alwaysRemember" value="false" />
     <property name="userService" ref="userService"/>
     <property name="useSecureCookie" value="false"/>
     <property name="customerFacade" ref="customerFacade"/>
     <property name="checkoutCustomerStrategy" ref="checkoutCustomerStrategy"/>
     <property name="urlEncoderService" ref="urlEncoderService"/>
     <property name="storeSessionFacade" ref="storeSessionFacade"/>
     <property name="commonI18NService" ref="commonI18NService"/>
     <property name="secureTokenService" ref="secureTokenService"/>
 </bean>
 
 <bean id="rememberMeAuthenticationProvider" class="org.springframework.security.authentication.RememberMeAuthenticationProvider" >
     <property name="key" value="yacceleratorstorefront"/>
 </bean>

...

In login.tag, I have added this code :

         <div>
             Remember me :
             <input type="checkbox" name="_spring_security_remember_me" class="checkbox" id="j_remember"  />
         </div>

What is wrong in this code ? may be I missed something ?

thanks in advance for your help.

Regards

Houssem