From 2619c646646ce9c6a07d1a58d3fddb7124948a1d Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Thu, 14 Mar 2024 18:09:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(X-Pack):=20=E6=95=B4=E5=90=88ldap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/config/axios/service.ts | 2 ++ de-xpack | 2 +- .../src/main/java/io/dataease/constant/AuthConstant.java | 1 + .../src/main/java/io/dataease/utils/ServletUtils.java | 7 +++++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/core-frontend/src/config/axios/service.ts b/core/core-frontend/src/config/axios/service.ts index e397e35da0..8e050b56b8 100644 --- a/core/core-frontend/src/config/axios/service.ts +++ b/core/core-frontend/src/config/axios/service.ts @@ -111,6 +111,8 @@ service.interceptors.request.use( ;(config.headers as AxiosRequestHeaders)['X-DE-LINK-TOKEN'] = linkStore.getLinkToken } else if (embeddedStore.token) { ;(config.headers as AxiosRequestHeaders)['X-EMBEDDED-TOKEN'] = embeddedStore.token + } else if (wsCache.get('de-ldap-token')) { + ;(config.headers as AxiosRequestHeaders)['Authorization'] = wsCache.get('de-ldap-token') } if (wsCache.get('user.language')) { const key = wsCache.get('user.language') diff --git a/de-xpack b/de-xpack index f846f87140..c7ce3cd116 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit f846f871400184a9da7aa10dd4c96d5f7dd35a8d +Subproject commit c7ce3cd1164f89f42603f7e1c301df841f8d129d diff --git a/sdk/common/src/main/java/io/dataease/constant/AuthConstant.java b/sdk/common/src/main/java/io/dataease/constant/AuthConstant.java index d358bc2095..730f1133f0 100644 --- a/sdk/common/src/main/java/io/dataease/constant/AuthConstant.java +++ b/sdk/common/src/main/java/io/dataease/constant/AuthConstant.java @@ -21,6 +21,7 @@ public class AuthConstant { public final static String ASK_TOKEN_KEY = "X-DE-ASK-TOKEN"; public final static String DE_EXECUTE_VERSION = "X-DE-EXECUTE-VERSION"; + public final static String DE_LDAP_AUTHORIZATION = "Authorization"; } diff --git a/sdk/common/src/main/java/io/dataease/utils/ServletUtils.java b/sdk/common/src/main/java/io/dataease/utils/ServletUtils.java index 0789328c00..93810de8bb 100644 --- a/sdk/common/src/main/java/io/dataease/utils/ServletUtils.java +++ b/sdk/common/src/main/java/io/dataease/utils/ServletUtils.java @@ -4,6 +4,7 @@ import io.dataease.constant.AuthConstant; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.lang3.ObjectUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -35,6 +36,12 @@ public class ServletUtils { return getHead(AuthConstant.OIDC_X_USER); } + public static String getLdapUser() { + String authorization = getHead(AuthConstant.DE_LDAP_AUTHORIZATION); + if (StringUtils.isBlank(authorization)) return null; + return authorization; + } + public static String getCasUser() { return getHead(AuthConstant.CAS_X_USER); }