Spring - 登录后做一些动作

时间:2011-09-07 11:44:15

标签: java spring spring-security

用户登录成功后,我需要在DB中存储实际日期。怎么做 ?过滤器,处理器还是什么?需要帮助。

1 个答案:

答案 0 :(得分:6)

    public class AuthenticationSuccessHandlerImpl extends SimpleUrlAuthenticationSuccessHandler {
           @Override
       public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) 
       throws IOException, ServletException {
       //your code here    
     }
}

配置:

<beans:bean id="authSuccessHandler"
            class="your.pachage.decleration.AuthenticationSuccessHandlerImpl"/>