16
16
17
17
package com .webank .wedatasphere .dss .appconn .manager .utils ;
18
18
19
+ import com .webank .wedatasphere .dss .common .utils .MapUtils ;
20
+ import com .webank .wedatasphere .dss .standard .app .sso .builder .SSOUrlBuilderOperation ;
19
21
import com .webank .wedatasphere .dss .standard .common .desc .AppInstance ;
20
22
import org .apache .commons .lang .StringUtils ;
21
23
import org .apache .linkis .common .conf .CommonVars ;
@@ -26,12 +28,29 @@ public class AppInstanceConstants {
26
28
static final String INDEX_FILE_PREFIX = "index_" ;
27
29
static final String INDEX_FILE_SUFFIX = ".index" ;
28
30
31
+ static final String REQUEST_URI = "reqUri" ;
32
+
29
33
public static final CommonVars <TimeType > APP_CONN_REFRESH_INTERVAL = CommonVars .apply ("wds.dss.appconn.refresh.interval" , new TimeType ("5m" ));
30
34
31
- public static String getHomepageUrl (AppInstance appInstance ,
35
+ public static String getHomepageUrl (AppInstance appInstance , SSOUrlBuilderOperation ssoUrlBuilderOperation ,
32
36
Long workspaceId , String workspaceName ) {
33
- return getHomepageUrl (appInstance .getBaseUrl (), appInstance .getHomepageUri (),
37
+ String homepageUrl = getHomepageUrl (appInstance .getBaseUrl (), appInstance .getHomepageUri (),
34
38
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
+ }
35
54
}
36
55
37
56
public static String getHomepageUrl (String baseUrl , String homepageUri ,
0 commit comments