| | |
| | | import com.vci.starter.web.annotation.bus.VciLoginAfter; |
| | | import com.vci.starter.web.annotation.bus.VciLogoutBefore; |
| | | import com.vci.starter.web.annotation.bus.VciLogoutPlugin; |
| | | import com.vci.starter.web.constant.VConstant; |
| | | import com.vci.starter.web.exception.VciBaseException; |
| | | import com.vci.starter.web.interceptor.VciSessionForLoginI; |
| | | import com.vci.starter.web.pagemodel.RequestClientInfo; |
| | |
| | | import com.vci.constant.CacheNameConstant; |
| | | import com.vci.dto.LoginUserDTO; |
| | | import com.vci.web.properties.WebProperties; |
| | | import com.vci.web.redis.RedisService; |
| | | import com.vci.starter.web.redis.RedisService; |
| | | import com.vci.web.service.LoginServiceI; |
| | | import com.vci.web.util.Func; |
| | | import com.vci.web.util.PlatformClientUtil; |
| | |
| | | * @return 执行结果 |
| | | * @throws VciBaseException 参数错误,用户不能登录等会抛出异常 |
| | | */ |
| | | private LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo, boolean checkPassword/*单点登录不需要校验密码*/) throws VciBaseException, PLException { |
| | | private LoginResultBO login(LoginUserDTO userDTO, RequestClientInfo clientInfo, boolean checkPassword/*单点登录不需要校验密码*/) throws VciBaseException { |
| | | LoginResultBO loginResult = new LoginResultBO(); |
| | | loginResult.setSuccess(false); |
| | | |
| | |
| | | String tokenKey = redisService.getCacheObject(userIdTokenKey); |
| | | redisService.deleteObject(tokenKey); |
| | | redisService.deleteObject(userIdTokenKey); |
| | | redisService.decreOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); |
| | | } |
| | | |
| | | //3.获取用户的对象(对象中包含角色部门还有密码策略信息(当前用户没设置密码策略就是取的默认密码策略)) |
| | |
| | | machine.machine = clientInfo.getMachine(); |
| | | String token = null; |
| | | try { |
| | | /*ThreeDES des = new ThreeDES();// 实例化一个对�? |
| | | des.getKey("daliantan0v0");// 生成密匙 |
| | | String encPassword = des.getDesString(userDTO.getPassword());*/ |
| | | //前端传过来的密码是经过加密传输的,所以需要按照约定解密,再传给平台进行比对 |
| | | userDTO.setPassword(Func.decryptAes(userDTO.getPassword(),"daliantan0v0vcip")); |
| | | LoginResult chkRes = platformClientUtil.getFrameworkService().checkLogin(userDTO.getUserId(),userDTO.getPassword(), machine); |
| | | loginResult.setFailCode(getErrorCode(chkRes)); |
| | | //loginResult.setFailMsgArray(new String[]{userDTO.getUserId(), String.valueOf(chkRes.auxInfo)}); |
| | |
| | | sessionInfo.setToken(token); |
| | | //初始化平台的token |
| | | sessionForLogin.initInvocationInfo(sessionInfo); |
| | | //记录当前登录人数的总数 |
| | | redisService.increOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); |
| | | //拷贝用户到新的session会话中 |
| | | copyUser2SessionInfo(user, sessionInfo, userDTO.getLangCode()); |
| | | //拷贝请求信息到session会话中 |
| | |
| | | |
| | | //3、判断密码是否正确 |
| | | if (checkPassword) { |
| | | boolean passwordIsEqual = userQueryService.checkPasswordEqual(userDTO.getPassword(), user.getOid()); |
| | | boolean passwordIsEqual = userQueryService.checkPasswordEqual(userDTO.getPassword(), user.getName()); |
| | | if (!passwordIsEqual) { |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("{}密码不正确", user.getId()); |
| | |
| | | } |
| | | }); |
| | | } |
| | | //清除存当前登录的用户(总数-1) |
| | | redisService.decreOnlineUser(VConstant.CURRENT_LOGGED_USERS_KEY); |
| | | sessionForLogin.logout(userToken); |
| | | if(!CollectionUtils.isEmpty(logoutpluginBeanMap)){ |
| | | logoutpluginBeanMap.forEach((k,v) -> { |