feat(X-Pack): 整合ldap

This commit is contained in:
fit2cloud-chenyw 2024-03-14 18:09:42 +08:00
parent afb337e0fa
commit 2619c64664
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')

@ -1 +1 @@
Subproject commit f846f871400184a9da7aa10dd4c96d5f7dd35a8d
Subproject commit c7ce3cd1164f89f42603f7e1c301df841f8d129d

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