Reputation: 25
I need to save some informations about user when he is authentificated like his IP Adress and authentification date and other stuff into the database. In other words i want to keep connections history. I am using a custom authentification provider, an implementation of UserDetailsService but i dont know where to put code of saving these informations.
Any suggestions?
Upvotes: 2
Views: 2877
Reputation: 7522
Since the AbstractAuthenticationProcessingFilter
implements ApplicationEventPublisherAware
and fires the event InteractiveAuthenticationSuccessEvent
on successful authentication, you just need to listen to that event and update database. This will keep your database code clean and decoupled from the security code.
Upvotes: 2
Reputation: 895
You need to implement your custom AuthenticationSuccessHandler.
Upvotes: 1