Merge pull request #8526 from dataease/pr@dev-v2@feat_ldap

feat(X-Pack): 整合ldap
This commit is contained in:
fit2cloud-chenyw
2024-03-14 18:10:52 +08:00
committed by GitHub
4 changed files with 11 additions and 1 deletions

View File

@@ -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')

View File

@@ -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";
}

View File

@@ -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);
}