- <http auto-config="true" access-denied-page="/common/403.htm">
- <intercept-url pattern="/login.**" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
- <form-login login-page="/login.jsp" default-target-url="/demo/success.action" authentication-failure-url="/login.jsp?error=1" />
- <logout logout-success-url="/login.jsp" invalidate-session="true"/>
- <remember-me key="e37f4b31-0c45-11dd-bd0b-0800200c9a66" services-ref="rememberMeServices"/>
- <concurrent-session-control max-sessions="1" exception-if-maximum-exceeded="false" expired-url="/login.jsp?error=3"/>
- </http>
- <!-- cookie认证过滤器 -->
- <beans:bean id="rememberMeProcessingFilter"
- class="org.springframework.security.ui.rememberme.RememberMeProcessingFilter">
- <beans:property name="authenticationManager"
- ref="authenticationManager">
- </beans:property>
- <beans:property name="rememberMeServices"
- ref="rememberMeServices">
- </beans:property>
- </beans:bean>
- <beans:bean id="rememberMeServices"
- class="org.springframework.security.ui.rememberme.TokenBasedRememberMeServices">
- <beans:property name="userDetailsService" ref="userDetailsService"></beans:property>
- <!-- cookie中的键值, 防止保存到客户端的cookie中的加密串被恶意篡改 -->
- <beans:property name="key" value="e37f4b31-0c45-11dd-bd0b-0800200c9a66"></beans:property>
- <!-- cookie有效时间, 单位为秒, 这里设定为5天内不用再登陆 -->
- <beans:property name="tokenValiditySeconds" value="432000"></beans:property>
- </beans:bean>
Spring Security2的COOKIE的保存时间设置
最新推荐文章于 2023-10-21 15:19:03 发布