Hi all,
I want to prepare some data after user login system. After some google, I implemented a ApplicationListener to listen AuthenticationSuccessEvent:
import org.springframework.context.ApplicationListener; import org.springframework.security.authentication.event.AuthenticationSuccessEvent; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.stereotype.Component;
@Component public class MyApplicationListener implements ApplicationListener {
@Override
public void onApplicationEvent(AuthenticationSuccessEvent event) {
UserDetails userDetails = (UserDetails) event.getAuthentication()
.getPrincipal();
System.out.println("Successed login:" + userDetails.getUsername());
}
}
I updated to Spring 3.0 RELEASE, and Spring Security 3.0.0.RC2. But I can never get called for AuthenticationSuccessEvent:( (I tried other event, such as AuthenticationFailureBadCredentialsEvent, it worked).
I use my own authentication-manager and do nothing about the event:
Do I need to podcast the event by myself?
Thank you.