|
@@ -267,60 +267,60 @@ public class SSOLoginLogoutController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-// @ApiOperation(".登录接口(sso)")
|
|
|
-// @RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
|
-// public Result<JSONObject> login(HttpServletRequest request, HttpServletResponse response, @RequestBody SysLoginModel sysLoginModel){
|
|
|
-//
|
|
|
-// Result<JSONObject> result = new Result<JSONObject>();
|
|
|
-// String username = sysLoginModel.getUsername();
|
|
|
-// String password = sysLoginModel.getPassword();
|
|
|
-//
|
|
|
-// String eiToken = ssodlcs(username, password);
|
|
|
-// if(eiToken==null || "".equals(eiToken)){
|
|
|
-// result.error("登录请求失败");
|
|
|
-// return result;
|
|
|
-// }
|
|
|
-//
|
|
|
-//// response.setHeader("Set-Cookie", String.format("EIToken=%s; Max-Age=3600; Path=/", eiToken));
|
|
|
-//// response.setHeader("Set-Cookie", String.format("WISEUser=%s; Max-Age=3600; Path=/", username));
|
|
|
-// Cookie cookie = new Cookie("EIToken", eiToken);
|
|
|
-// Cookie cookie1 = new Cookie("WISEUser", username);
|
|
|
-// cookie.setMaxAge(3600);
|
|
|
-// cookie1.setMaxAge(3600);
|
|
|
-// cookie.setPath("/");
|
|
|
-// cookie1.setPath("/");
|
|
|
-// response.addCookie(cookie);
|
|
|
-// response.addCookie(cookie1);
|
|
|
-//
|
|
|
-// //1. 校验用户是否有效
|
|
|
-// SysUser sysUser = sysUserService.getUserAll(username);
|
|
|
-// result = sysUserService.checkUserIsEffective(sysUser);
|
|
|
-// if(!result.isSuccess()) {
|
|
|
-// // TODO 已经单点登录成功了的用户如果在本系统不存在,新增用户?
|
|
|
-// if(result.getMessage().equals(SSOConstants.BCZ) ){
|
|
|
-// log.info("用户在本系统不存在,新增该用户");
|
|
|
-// JSONObject addJSONObject = toAddJSONObject(username, password);
|
|
|
-// addUser(addJSONObject);
|
|
|
-// }else if(result.getMessage().equals(SSOConstants.YZX) || result.getMessage().equals(SSOConstants.YDj)){
|
|
|
-// // TODO 已注销或冻结的用户怎么处理?——首先不应该允许在本系统注销或者冻结用户?——如果真的有恢复正常状态?
|
|
|
-// editUserStatusOrDel(username);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// SysUser sysUser1 = sysUserService.getUserAll(username);
|
|
|
-// //用户登录信息
|
|
|
-// userInfo1(sysUser1, result);
|
|
|
-// LoginUser loginUser = new LoginUser();
|
|
|
-// BeanUtils.copyProperties(sysUser1, loginUser);
|
|
|
-// baseCommonService.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null,loginUser);
|
|
|
-// //update-end--Author:wangshuai Date:20200714 for:登录日志没有记录人员
|
|
|
-//
|
|
|
-// return result;
|
|
|
-// }
|
|
|
+ @ApiOperation(".登录接口(sso)")
|
|
|
+ @RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
|
+ public Result<JSONObject> login(HttpServletRequest request, HttpServletResponse response, @RequestBody SysLoginModel sysLoginModel){
|
|
|
+
|
|
|
+ Result<JSONObject> result = new Result<JSONObject>();
|
|
|
+ String username = sysLoginModel.getUsername();
|
|
|
+ String password = sysLoginModel.getPassword();
|
|
|
+
|
|
|
+ String eiToken = ssodlcs(username, password);
|
|
|
+ if(eiToken==null || "".equals(eiToken)){
|
|
|
+ result.error("登录请求失败");
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+// response.setHeader("Set-Cookie", String.format("EIToken=%s; Max-Age=3600; Path=/", eiToken));
|
|
|
+// response.setHeader("Set-Cookie", String.format("WISEUser=%s; Max-Age=3600; Path=/", username));
|
|
|
+ Cookie cookie = new Cookie("EIToken", eiToken);
|
|
|
+ Cookie cookie1 = new Cookie("WISEUser", username);
|
|
|
+ cookie.setMaxAge(3600);
|
|
|
+ cookie1.setMaxAge(3600);
|
|
|
+ cookie.setPath("/");
|
|
|
+ cookie1.setPath("/");
|
|
|
+ response.addCookie(cookie);
|
|
|
+ response.addCookie(cookie1);
|
|
|
+
|
|
|
+ //1. 校验用户是否有效
|
|
|
+ SysUser sysUser = sysUserService.getUserAll(username);
|
|
|
+ result = sysUserService.checkUserIsEffective(sysUser);
|
|
|
+ if(!result.isSuccess()) {
|
|
|
+ // TODO 已经单点登录成功了的用户如果在本系统不存在,新增用户?
|
|
|
+ if(result.getMessage().equals(SSOConstants.BCZ) ){
|
|
|
+ log.info("用户在本系统不存在,新增该用户");
|
|
|
+ JSONObject addJSONObject = toAddJSONObject(username, password);
|
|
|
+ addUser(addJSONObject);
|
|
|
+ }else if(result.getMessage().equals(SSOConstants.YZX) || result.getMessage().equals(SSOConstants.YDj)){
|
|
|
+ // TODO 已注销或冻结的用户怎么处理?——首先不应该允许在本系统注销或者冻结用户?——如果真的有恢复正常状态?
|
|
|
+ editUserStatusOrDel(username);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ SysUser sysUser1 = sysUserService.getUserAll(username);
|
|
|
+ //用户登录信息
|
|
|
+ userInfo1(sysUser1, result);
|
|
|
+ LoginUser loginUser = new LoginUser();
|
|
|
+ BeanUtils.copyProperties(sysUser1, loginUser);
|
|
|
+ baseCommonService.addLog("用户名: " + username + ",登录成功!", CommonConstant.LOG_TYPE_1, null,loginUser);
|
|
|
+ //update-end--Author:wangshuai Date:20200714 for:登录日志没有记录人员
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation(".登录接口(sso) 修改权限之后的登陆接口")
|
|
|
@RequestMapping(value = "/interlockLogin", method = RequestMethod.POST)
|
|
|
- public Result<JSONObject> login(HttpServletRequest request, HttpServletResponse response, @RequestBody SysLoginModel sysLoginModel){
|
|
|
+ public Result<JSONObject> interlockLogin(HttpServletRequest request, HttpServletResponse response, @RequestBody SysLoginModel sysLoginModel){
|
|
|
|
|
|
Result<JSONObject> result = new Result<JSONObject>();
|
|
|
String username = sysLoginModel.getUsername();
|