我已经实现了spring security以登录我的门户网站.除了一个问题,它工作正常.我将会话超时设置为5分钟.一旦超时结束,然后用户点击任何URL,它就会被重定向到注销页面.
但是当用户重新验证时,用户直接登陆最后一个访问页面而不是主页,这是默认目标URL.
ecurity"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.0.xsd">
fig="true">
sstoken.html" access="ROLE_USER" />
login-page="/login.html" default-target-url="/home.html"
authentication-failure-url="/loginFailed.html" />
<logout logout-url="/logout.html" logout-success-url="/logoutSuccess.html" invalidate-session="true" />
logout.html" />
最佳答案
将always-use-default-target属性添加到form-login标记.
If set to true,the user will always start at the value given by default-target-url,regardless of how they arrived at the login page. Maps to the alwaysUseDefaultTargetUrl property of UsernamePasswordAuthenticationFilter. Default value is false.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。