|
@@ -7,6 +7,7 @@ import com.qmth.boot.api.constant.ApiConstant;
|
|
import com.qmth.teachcloud.common.SignatureEntityTest;
|
|
import com.qmth.teachcloud.common.SignatureEntityTest;
|
|
import com.qmth.teachcloud.common.bean.dto.UserAuthenticationDto;
|
|
import com.qmth.teachcloud.common.bean.dto.UserAuthenticationDto;
|
|
import com.qmth.teachcloud.common.bean.result.LoginResult;
|
|
import com.qmth.teachcloud.common.bean.result.LoginResult;
|
|
|
|
+import com.qmth.teachcloud.common.cache.ThirdUserAuthCacheUtil;
|
|
import com.qmth.teachcloud.common.config.DictionaryConfig;
|
|
import com.qmth.teachcloud.common.config.DictionaryConfig;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
import com.qmth.teachcloud.common.entity.*;
|
|
import com.qmth.teachcloud.common.entity.*;
|
|
@@ -15,7 +16,6 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.enums.RoleTypeEnum;
|
|
import com.qmth.teachcloud.common.enums.RoleTypeEnum;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.util.*;
|
|
import com.qmth.teachcloud.common.util.*;
|
|
-import com.qmth.teachcloud.report.business.cache.ThirdUserAuthCacheUtil;
|
|
|
|
import com.qmth.teachcloud.report.business.service.ReportCommonService;
|
|
import com.qmth.teachcloud.report.business.service.ReportCommonService;
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -75,6 +75,9 @@ public class SsoApiController {
|
|
@Resource
|
|
@Resource
|
|
ReportCommonService reportCommonService;
|
|
ReportCommonService reportCommonService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ CommonCacheService commonCacheService;
|
|
|
|
+
|
|
@ApiOperation(value = "单点登录接口")
|
|
@ApiOperation(value = "单点登录接口")
|
|
@ApiResponses({@ApiResponse(code = 200, message = "单点登录接口", response = Object.class)})
|
|
@ApiResponses({@ApiResponse(code = 200, message = "单点登录接口", response = Object.class)})
|
|
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
|
@@ -150,6 +153,7 @@ public class SsoApiController {
|
|
String pattern = "{0}{1}{2}";
|
|
String pattern = "{0}{1}{2}";
|
|
String code = URLEncoder.encode(MessageFormat.format(pattern, userAuthenticationDto.getUid(), SignatureEntityTest.FIELD_JOINER, SignatureEntityTest.encrypt(userAuthenticationDto.getCode())), SystemConstant.CHARSET_NAME);
|
|
String code = URLEncoder.encode(MessageFormat.format(pattern, userAuthenticationDto.getUid(), SignatureEntityTest.FIELD_JOINER, SignatureEntityTest.encrypt(userAuthenticationDto.getCode())), SystemConstant.CHARSET_NAME);
|
|
|
|
|
|
|
|
+ ThirdUserAuthCacheUtil.setAuthRole(String.valueOf(sysUser.getId()), role);
|
|
ThirdUserAuthCacheUtil.setAuthReturnUrl(String.valueOf(sysUser.getId()), returnUrl);
|
|
ThirdUserAuthCacheUtil.setAuthReturnUrl(String.valueOf(sysUser.getId()), returnUrl);
|
|
|
|
|
|
HttpServletResponse response = ServletUtil.getResponse();
|
|
HttpServletResponse response = ServletUtil.getResponse();
|
|
@@ -184,6 +188,10 @@ public class SsoApiController {
|
|
}
|
|
}
|
|
LoginResult loginResult = teachcloudCommonService.login(sysUser.getPassword(), sysUser, appSource);
|
|
LoginResult loginResult = teachcloudCommonService.login(sysUser.getPassword(), sysUser, appSource);
|
|
ThirdUserAuthCacheUtil.deleteAuthCode(values[0]);
|
|
ThirdUserAuthCacheUtil.deleteAuthCode(values[0]);
|
|
|
|
+ commonCacheService.removeUserCache(sysUser.getId());
|
|
|
|
+ commonCacheService.removeUserAuthCache(sysUser.getId());
|
|
|
|
+ commonCacheService.removeUserMenuCache(sysUser.getId());
|
|
|
|
+ commonCacheService.removeUserRolePrivilegeCache(sysUser.getId());
|
|
return ResultUtil.ok(loginResult);
|
|
return ResultUtil.ok(loginResult);
|
|
}
|
|
}
|
|
|
|
|