소스 검색

西安交大单点登录bug

xiaofei 1 년 전
부모
커밋
9046973740

+ 5 - 4
xjtu-exchange/src/main/java/com/qmth/xjtu/api/OpenApiController.java

@@ -97,9 +97,10 @@ public class OpenApiController {
         if (Objects.isNull(teachcloudLoginUrl) || Objects.equals(teachcloudLoginUrl, "")) {
             throw ExceptionResultEnum.PARAMS_ERROR.exception("知学登录跳转地址不存在");
         }
-        String[] strs = teachcloudLoginUrl.split(SystemConstant.PATH_SUBSTR);
-        if (strs[0].contains(SystemConstant.PATH_MATCH)) {
-            strs[0] = strs[0].replace(SystemConstant.PATH_MATCH, SCHOOL_CODE);
+        int index = teachcloudLoginUrl.lastIndexOf(SystemConstant.PATH_SUBSTR);
+        String hostUrl = teachcloudLoginUrl.substring(0, index);
+        if (hostUrl.contains(SystemConstant.PATH_MATCH)) {
+            hostUrl = hostUrl.replace(SystemConstant.PATH_MATCH, SCHOOL_CODE);
         }
 
         QueryWrapper<BasicSchool> basicSchoolQueryWrapper = new QueryWrapper<>();
@@ -110,7 +111,7 @@ public class OpenApiController {
         Long timestamp = System.currentTimeMillis();
         String signature = SignatureEntity.build(SignatureType.SECRET, SystemConstant.METHOD, LOGIN_BEFORE_XJU_LOGIC_API, timestamp, basicSchool.getAccessKey(), basicSchool.getAccessSecret());
 
-        String callResult = HttpUtil.postJson(strs[0] + LOGIN_BEFORE_XJU_LOGIC_API, JacksonUtil.parseJson(employeeNo), signature, timestamp);
+        String callResult = HttpUtil.postJson(hostUrl + LOGIN_BEFORE_XJU_LOGIC_API, JacksonUtil.parseJson(employeeNo), signature, timestamp);
 //        String schoolCodeParam = null;
         if (!StringUtils.isBlank(callResult)) {
             log.info("callbackResult:{}", JacksonUtil.parseJson(callResult));

+ 1 - 1
xjtu-exchange/src/main/resources/application.properties

@@ -48,6 +48,6 @@ com.qmth.solar.access-key=274f823e5f59410f8b3bb6edcd8e2b6e
 com.qmth.solar.access-secret=y7AO6W0TOdTF8HpWBwGHbp3wfIHsmUKr
 #com.qmth.solar.license=/Volumes/extend/\u542F\u660E/\u5206\u5E03\u5F0F\u5370\u5237/\u5206\u5E03\u5F0F\u5370\u5237&\u6559\u7814\u5206\u6790v3.1.0/tc-dev-wl.lic
 
-cas.config.teachcloudPrintLoginUrl=https://*.teach-cloud-test.com/#/login-open
+cas.config.teachcloudPrintLoginUrl=https://*.teach-cloud-test.com/login-open
 cas.config.logoutUrl=https://dj-xian.qmth.com.cn/api/open/authentication/logout
 cas.config.returnUrl=https://org.xjtu.edu.cn/openplatform/oauth/authorize?appId=1548&redirectUri=http://10.184.206.15/api/open/authentication&responseType=code&scope=user_info&state=1234