开发者

Spring security 3 : Save informations about authentification in database

I need to save some informations ab开发者_JAVA技巧out 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?


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.


You need to implement your custom AuthenticationSuccessHandler.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜