Bladeren bron

URLEncoder改成Base64

wangliang 2 jaren geleden
bovenliggende
commit
b6426f430b

+ 6 - 7
distributed-print/src/main/java/com/qmth/distributed/print/api/OpenApiController.java

@@ -25,7 +25,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.util.UriUtils;
 
 import javax.annotation.Resource;
 import java.io.UnsupportedEncodingException;
@@ -153,18 +152,18 @@ public class OpenApiController {
         if (Objects.isNull(signature) || Objects.equals(signature, "")) {
             throw ExceptionResultEnum.PARAMS_ERROR.exception("鉴权信息不能为空");
         }
-        log.info("signature UriUtils before:{}", signature);
-        signature = UriUtils.decode(signature, SystemConstant.CHARSET_NAME);
-        log.info("signature UriUtils after:{}", signature);
+        log.info("signature URLDecoder before:{}", signature);
+        signature = URLDecoder.decode(signature, SystemConstant.CHARSET_NAME);
+        log.info("signature URLDecoder after:{}", signature);
         if (Objects.isNull(account) || Objects.equals(account, "")) {
             throw ExceptionResultEnum.PARAMS_ERROR.exception("工号不能为空");
         }
-        account = UriUtils.decode(account, SystemConstant.CHARSET_NAME);
+        account = URLDecoder.decode(account, SystemConstant.CHARSET_NAME);
 
         BasicSchool basicSchool = AuthThirdUtil.hasPermissionCas(time, path, signature);
         OpenParams openParams = null;
         if (Objects.nonNull(params) && !Objects.equals(params, "")) {
-            String decodeJson = UriUtils.decode(params, SystemConstant.CHARSET_NAME);
+            String decodeJson = URLDecoder.decode(params, SystemConstant.CHARSET_NAME);
             openParams = JacksonUtil.readJson(decodeJson, OpenParams.class);
         }
 
@@ -178,7 +177,7 @@ public class OpenApiController {
 
         LoginResult loginResult = teachcloudCommonService.login(sysUser.getPassword(), sysUser, AppSourceEnum.CAS_THIRD);
         if (Objects.nonNull(returnUrl) && !Objects.equals(returnUrl, "")) {
-            returnUrl = UriUtils.decode(returnUrl, SystemConstant.CHARSET_NAME);
+            returnUrl = URLDecoder.decode(returnUrl, SystemConstant.CHARSET_NAME);
         }
         loginResult.setReturnUrl(returnUrl);
         return ResultUtil.ok(loginResult);