Spring 安全会话管理不起作用



当我尝试使用其他浏览器登录时成功登录后,它会将我重定向到身份验证失败网址。为什么它不重定向到过期的网址?

<http auto-config='false' use-expressions="true">
<intercept-url pattern="/login" access="permitAll"/>        
<intercept-url pattern="/j_spring_security_check" access="permitAll"/>
<logout logout-success-url="/login.xhtml" invalidate-session="true" delete-cookies="JSESSIONID"/>        
<form-login login-page="/login.xhtml"
            login-processing-url="/j_spring_security_check"                                                       
            default-target-url="/pages/index.xhtml"
            always-use-default-target="true"                                                                            
            authentication-failure-url="/login.xhtml?error=true"/>
<custom-filter before="FORM_LOGIN_FILTER" ref="customAjaxControlFilter" />
<session-management invalid-session-url="/login.xhtml?error=sessionExpired" session-authentication-error-url="/login.xhtml?error=alreadyLogin">
        <concurrency-control error-if-maximum-exceeded="true" max-sessions="1" expired-url="/login.xhtml?error=expired"/>            
</session-management>

编辑:顺便说一下,在我成功注销后,它会将我重定向到无效的会话网址。我不明白发生了什么。

这是预期的行为。从手册:

然后,第二次登录将被拒绝。通过"拒绝",我们的意思是,如果使用基于表单的登录,用户将被发送到身份验证失败网址。

如果您设置error-if-maximum-exceeded="true",就会发生这种情况。

如果尚未设置error-if-maximum-exceeded="true",则使用 expired-url 参数。在这种情况下,将允许新登录,原始会话将被标记为已过期,如果您尝试使用它,您将被重定向到此URL。

最新更新