Spring中会话过期的监听器 [英] Listener for Session Expiration in Spring

查看:57
本文介绍了Spring中会话过期的监听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Spring Security 的新手并使用它进行身份验证.我面临的问题是,当浏览器关闭或出现任何异常故障时,会话会过期,但我无法捕获该事件以执行清理代码.我对此进行了探索,并在 Spring 中找到了 HttpSessionEventPublisher 来捕获 SessionDestroyed() 方法中的 HttpSessionDestroyedEvent,但在我关闭浏览器时不会调用该方法./p>

请求提出相同的解决方案.

解决方案

也许 SessionManagementFilter 有帮助吗?

或者您可以将 Spring Security 配置为在发生超时时自动重定向用户:检测超时 部分.

I am new to spring security and using it for authentication. I am facing a issue that when the browser is closed or in case of any unusual failure the session expires but I am unable catch the event so as to get the clean up code executed. I explore about it and found HttpSessionEventPublisher in Spring to capture HttpSessionDestroyedEvent in sessionDestroyed() method but that is not called when I close the browser.

Request to suggest solution for the same.

解决方案

Maybe SessionManagementFilter could help?

Or you can configure Spring Security to automatically redirect user if timeout occured: Detecting timeouts section.

这篇关于Spring中会话过期的监听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆