wangliang 3 年之前
父节点
当前提交
a339d9e235

+ 4 - 4
teachcloud-common/src/main/java/com/qmth/teachcloud/common/cache/ThirdUserAuthCacheUtil.java

@@ -31,16 +31,16 @@ public class ThirdUserAuthCacheUtil {
     }
 
     public static void setAuthReturnUrl(String key, String url) {
-        redisUtil.set(RedisKeyHelper.thirdUserAuthReturnUrl(key), url, SystemConstant.REDIS_DEFAULT_EXPIRE_TIME, TimeUnit.SECONDS);
+        redisUtil.set(RedisKeyHelper.thirdUserAuthReturnUrl(key), url, SystemConstant.REDIS_DEFAULT_EXPIRE_TIME + 180L, TimeUnit.SECONDS);
     }
 
     public static String getAuthReturnUrl(String key) {
         return (String) redisUtil.get(RedisKeyHelper.thirdUserAuthReturnUrl(key));
     }
 
-    public static void deleteAuthReturnUrl(String key) {
-        redisUtil.delete(RedisKeyHelper.thirdUserAuthReturnUrl(key));
-    }
+//    public static void deleteAuthReturnUrl(String key) {
+//        redisUtil.delete(RedisKeyHelper.thirdUserAuthReturnUrl(key));
+//    }
 
     public static void deleteCache(Long userId) {
         CommonCacheService commonCacheService = SpringContextHolder.getBean(CommonCacheService.class);

+ 1 - 2
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/SsoApiController.java

@@ -145,8 +145,6 @@ public class SsoApiController {
         ThirdUserAuthCacheUtil.setAuthCode(userAuthenticationDto);
         String pattern = "{0}{1}{2}";
         String code = URLEncoder.encode(MessageFormat.format(pattern, userAuthenticationDto.getUid(), SignatureEntityTest.FIELD_JOINER, SignatureEntityTest.encrypt(userAuthenticationDto.getCode())), SystemConstant.CHARSET_NAME);
-
-        ThirdUserAuthCacheUtil.deleteCache(sysUser.getId());
         ThirdUserAuthCacheUtil.setAuthReturnUrl(String.valueOf(sysUser.getId()), returnUrl);
 
         HttpServletResponse response = ServletUtil.getResponse();
@@ -182,6 +180,7 @@ public class SsoApiController {
         LoginResult loginResult = teachcloudCommonService.login(sysUser.getPassword(), sysUser, appSource);
         loginResult.setReturnUrl(ThirdUserAuthCacheUtil.getAuthReturnUrl(String.valueOf(sysUser.getId())));
         ThirdUserAuthCacheUtil.deleteAuthCode(values[0]);
+        ThirdUserAuthCacheUtil.deleteCache(sysUser.getId());
         return ResultUtil.ok(loginResult);
     }