使用 joinpoint 跟踪用户注销
我正在使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以扩展
SimpleUrlLogoutSuccessHandler
并覆盖 onLogoutSuccess(),然后配置您的过滤器,不要忘记手动重定向到登录页面。
请参阅文档以获取任何帮助。
You can extend
SimpleUrlLogoutSuccessHandler
and override onLogoutSuccess() then configure your filterdon't forget to redirect to login page manually.
See documentation for any help.