是否可以通过配置更改记住我的cookie的默认名称?
默认情况下,Cookie名称为:SPRING_SECURITY_REMEMBER_ME_COOKIE
,我希望Cookie名称不那么明显。
答案 0 :(得分:1)
<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>
答案 1 :(得分:0)
对于Spring Security 4,以下工作。
<remember-me
key="<yourKey>"
remember-me-parameter="remember-me"
token-validity-seconds="1209600"
user-service-ref="userDetailsService"
remember-me-cookie="<whateveryouwanttonamethecookie>"
/>