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? Or any other way to accomplish this?
开发者_如何学JAVAThanks!
Use an 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.
精彩评论