| | |
| | | recordLoginInfo(loginUser.getUserId()); |
| | | |
| | | // 创建登录信息 |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(userInfo.getEmployeeId(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.single.login.success"))); |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(userInfo.getEmployeeId(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.sso.login.success"))); |
| | | redisTemplate.opsForValue().set("ssoOauthToken:idToken:" + userInfo.getEmployeeId(), tokenModel.getId_token(), 3, TimeUnit.DAYS); |
| | | // 生成token |
| | | return tokenService.createToken(loginUser); |
| | |
| | | Authentication authentication = null; |
| | | SysUser sysUser = sysUserService.selectUserByUserName(username); |
| | | if (sysUser == null) { |
| | | throw new ServiceException("用户不存在"); |
| | | throw new ServiceException("单点登录验证失败"); |
| | | } |
| | | try |
| | | { |
| | |
| | | { |
| | | if (e instanceof BadCredentialsException) |
| | | { |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.sso.not.match"))); |
| | | throw new UserPasswordNotMatchException(); |
| | | } |
| | | else |
| | |
| | | { |
| | | AuthenticationContextHolder.clearContext(); |
| | | } |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); |
| | | AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.sso.login.success"))); |
| | | return (LoginUser) authentication.getPrincipal(); |
| | | |
| | | } |