Frederic Close
Frederic Close

Reputation: 9639

Spring security change remember me cookie name

Is it possible via configuration to change the default name of the the remember me cookie ?

By default the cookie name is: SPRING_SECURITY_REMEMBER_ME_COOKIE and I would like to have a less obvious cookie name.

Upvotes: 1

Views: 1705

Answers (2)

Shailendra Sah
Shailendra Sah

Reputation: 1

For Spring Security 4 , the below works .

 <remember-me
  key="<yourKey>"
  remember-me-parameter="remember-me"
  token-validity-seconds="1209600"
  user-service-ref="userDetailsService"
  remember-me-cookie="<whateveryouwanttonamethecookie>"
  />

Upvotes: 0

NimChimpsky
NimChimpsky

Reputation: 47290

<bean id="rememberMeServices" class="org.springframework.security.ui.rememberme.TokenBasedRememberMeServices">
    <property name="userDetailsService" ref="userService"/>
    <property name="key" value="remember-me-security"/>
    <property name="cookieName" value="remember_me_cookie" />
</bean>

Upvotes: 1

Related Questions