Skip to content

Commit e0bb038

Browse files
wushengyeyouyazqburde
authored andcommitted
Fix the bug that DSS cannot jump into the external system without login.
1 parent e9c1209 commit e0bb038

File tree

1 file changed

+21
-2
lines changed
  • dss-appconn/dss-appconn-manager/dss-appconn-manager-core/src/main/java/com/webank/wedatasphere/dss/appconn/manager/utils

1 file changed

+21
-2
lines changed

dss-appconn/dss-appconn-manager/dss-appconn-manager-core/src/main/java/com/webank/wedatasphere/dss/appconn/manager/utils/AppInstanceConstants.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
package com.webank.wedatasphere.dss.appconn.manager.utils;
1818

19+
import com.webank.wedatasphere.dss.common.utils.MapUtils;
20+
import com.webank.wedatasphere.dss.standard.app.sso.builder.SSOUrlBuilderOperation;
1921
import com.webank.wedatasphere.dss.standard.common.desc.AppInstance;
2022
import org.apache.commons.lang.StringUtils;
2123
import org.apache.linkis.common.conf.CommonVars;
@@ -26,12 +28,29 @@ public class AppInstanceConstants {
2628
static final String INDEX_FILE_PREFIX = "index_";
2729
static final String INDEX_FILE_SUFFIX = ".index";
2830

31+
static final String REQUEST_URI = "reqUri";
32+
2933
public static final CommonVars<TimeType> APP_CONN_REFRESH_INTERVAL = CommonVars.apply("wds.dss.appconn.refresh.interval", new TimeType("5m"));
3034

31-
public static String getHomepageUrl(AppInstance appInstance,
35+
public static String getHomepageUrl(AppInstance appInstance, SSOUrlBuilderOperation ssoUrlBuilderOperation,
3236
Long workspaceId, String workspaceName) {
33-
return getHomepageUrl(appInstance.getBaseUrl(), appInstance.getHomepageUri(),
37+
String homepageUrl = getHomepageUrl(appInstance.getBaseUrl(), appInstance.getHomepageUri(),
3438
workspaceId, workspaceName);
39+
if(MapUtils.isEmpty(appInstance.getConfig()) || ssoUrlBuilderOperation == null ||
40+
!appInstance.getConfig().containsKey(REQUEST_URI)) {
41+
return homepageUrl;
42+
} else {
43+
String reqUri = (String) appInstance.getConfig().get(REQUEST_URI);
44+
String reqUrl;
45+
if(appInstance.getBaseUrl().endsWith("/")) {
46+
reqUrl = appInstance.getBaseUrl() + reqUri;
47+
} else {
48+
reqUrl = appInstance.getBaseUrl() + "/" + reqUri;
49+
}
50+
ssoUrlBuilderOperation.redirectTo(homepageUrl);
51+
ssoUrlBuilderOperation.setReqUrl(reqUrl);
52+
return ssoUrlBuilderOperation.getBuiltUrl();
53+
}
3554
}
3655

3756
public static String getHomepageUrl(String baseUrl, String homepageUri,

0 commit comments

Comments
 (0)