LoginSuccessHandler.java
1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.bsth.security.handler;//package com.bsth.security.handler;
//
//import java.io.IOException;
//import java.util.Date;
//
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.springframework.security.core.Authentication;
//import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
//
//import com.bsth.common.Constants;
//import com.bsth.entity.sys.SessionLog;
//import com.bsth.entity.sys.SysUser;
//import com.bsth.util.IpUtils;
//
//public class LoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler{
//
// @Override
// public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
// Authentication authentication) throws ServletException, IOException {
//
// SysUser user = (SysUser) authentication.getPrincipal();
//
// //日志
// SessionLog sLog = new SessionLog();
// sLog.setLoginDate(new Date());
// sLog.setUser(user);
// sLog.setIp(IpUtils.getIpAddr(request));
//
// //session里写入用户名
// request.getSession().setAttribute(Constants.SESSION_USERNAME, user.getUserName());
// super.onAuthenticationSuccess(request, response, authentication);
// }
//
//}