如何在登录屏幕上重定向Spring安全性并发会话控制"消息"?

DHR*_*SAL 7 java spring spring-security java-ee spring-webflow

我有web应用程序,其中我使用了Spring框架.对于并发会话控制,我使用spring功能,一旦用户登录到另一个会话,将只为1个用户维护1个登录会话,他/她之前的会话将过期.

现在,在这种情况下,我收到此消息" 此会话已过期(可能是由于多个并发登录尝试作为同一用户). "

但我在浏览器的完整白页上收到此消息.我希望此消息仅在我的登录屏幕上显示.

这是我的spring security xml的一部分,我处理了用户的并发会话.

<security:session-management invalid-session-url="/login.jsp?error=sessionExpired" session-authentication-error-url="/login.jsp?error=alreadyLogin">
                    <security:concurrency-control max-sessions="1" error-if-maximum-exceeded="false" />
</security:session-management>
Run Code Online (Sandbox Code Playgroud)

任何专门用于自定义此消息并在所需Web应用程序页面上重定向此消息的链接将不胜感激.

提前致谢.

DHR*_*SAL 7

spring-security.xml中的原始XML条目

<security:session-management session-authentication-error-url="/login.jsp?error=alreadyLogin">
                    <security:concurrency-control max-sessions="1" error-if-maximum-exceeded="false" />
</security:session-management>
Run Code Online (Sandbox Code Playgroud)

您只需在xml中添加以下参数即可重定向登录过期操作或无效会话URL

expired-url ="url value"

invalid-session-url ="url value"

修改后的XML条目

<security:session-management invalid-session-url="/login.jsp?error=sessionExpired" session-authentication-error-url="/login.jsp?error=alreadyLogin">
                    <security:concurrency-control max-sessions="1" expired-url="/login.jsp?error=sessionExpiredDuplicateLogin" error-if-maximum-exceeded="false" />
</security:session-management>
Run Code Online (Sandbox Code Playgroud)