[英]Listening to successful login with Spring Security
I want to perform several actions when a User successfully logs in to my app, this actions need some User data as parameters, so is there a way to listen to successful logins with Spring Security 3.0.x? 我想在用户成功登录我的应用程序时执行多个操作,此操作需要一些用户数据作为参数,那么有没有办法使用Spring Security 3.0.x 监听成功登录? Or any other way to accomplish this?
或任何其他方式来实现这一目标?
Thanks! 谢谢!
Use an AuthenticationSuccessHandler 使用AuthenticationSuccessHandler
<form-login authentication-success-handler-ref="authenticationSuccessHandler"/>
You can get the username from the Authentication (UsernamePasswordAuthenticationToken) that is passed to onAuthenticationSuccess() and then look up the other user info from there. 您可以从传递给onAuthenticationSuccess()的Authentication(UsernamePasswordAuthenticationToken)中获取用户名,然后从那里查找其他用户信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.