使用 joinpoint 跟踪用户注销

发布于 2024-12-15 16:59:49 字数 440 浏览 3 评论 0原文

我正在使用Spring AOP来制作系统日志, 我的aop切入点是这样的:

<aop:pointcut expression="execution(* a.b.*.service.impl.*.*(..)) or (execution       
(* a.core.service.impl.*.*(..)))" id="allMethod"/>

问题是它只能跟踪service.impl中的函数,当然,如果我更改切入点,它可以跟踪任何服务,或操作,或dao, 但是用户注销,这个项目使用Spring Security,如“./j_logout”, 不在任何行动、服务、道中,所以,我不能切入它, 有没有办法切入Spring Security,以便我可以知道哪个用户注销? 任何其他没有切入 Spring Security 的解决方案也可以。 PS:英语不是我的母语,我说清楚了吗?

I'm using Spring AOP to make a system log,
my aop pointcut is like:

<aop:pointcut expression="execution(* a.b.*.service.impl.*.*(..)) or (execution       
(* a.core.service.impl.*.*(..)))" id="allMethod"/>

The problem is it only trace functions in service.impl,of course,if I change the pointcut,It can trace any service,or action, or dao,
But user's logout,this project uses Spring Security,like "./j_logout",
not in any action, service, dao,so,I can't pointcut it,
is there any way to pointcut Spring Security so I can tell which user logout?
Any other solution without pointcuting Spring Security is fine too.
PS: English is not my first language,Do I make myself clear?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逆光下的微笑 2024-12-22 16:59:49

您可以扩展 SimpleUrlLogoutSuccessHandler 并覆盖 onLogoutSuccess(),然后配置您的过滤器,

 <security:logout success-handler-ref="myCustomLogoutSuccessHandler"/> 

不要忘记手动重定向到登录页面。

请参阅文档以获取任何帮助。

You can extendSimpleUrlLogoutSuccessHandler and override onLogoutSuccess() then configure your filter

 <security:logout success-handler-ref="myCustomLogoutSuccessHandler"/> 

don't forget to redirect to login page manually.

See documentation for any help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文