From 8a5230f7a7aa2b808ea100b47439a60293364492 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 1 Dec 2023 14:25:19 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=B5=8C=E5=85=A5=E5=BC=8F=E6=8C=81?= =?UTF-8?q?=E7=BB=AD=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core-frontend/src/config/axios/service.ts | 4 ++-- de-xpack | 2 +- .../src/main/java/io/dataease/auth/filter/TokenFilter.java | 7 ++++--- .../java/io/dataease/auth/interceptor/CorsInterceptor.java | 5 ++--- .../src/main/java/io/dataease/constant/AuthConstant.java | 2 +- sdk/common/src/main/java/io/dataease/utils/TokenUtils.java | 3 +-- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/core/core-frontend/src/config/axios/service.ts b/core/core-frontend/src/config/axios/service.ts index c066786dd7..944bdc38e1 100644 --- a/core/core-frontend/src/config/axios/service.ts +++ b/core/core-frontend/src/config/axios/service.ts @@ -116,10 +116,10 @@ service.interceptors.response.use( response: AxiosResponse & { config: InternalAxiosRequestConfig & { loading?: boolean } } ) => { executeVersionHandler(response) - if (response.headers['x-de-refresh-token']) { + /* if (response.headers['x-de-refresh-token']) { wsCache.set('user.token', response.headers['x-de-refresh-token']) wsCache.set('user.exp', new Date().getTime() + 90000) - } + } */ if (response.headers['x-de-link-token']) { linkStore.setLinkToken(response.headers['x-de-link-token']) } diff --git a/de-xpack b/de-xpack index 31d53d9a76..305c135b1e 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 31d53d9a7650f4902ba93269d20912b3bb08bfac +Subproject commit 305c135b1e73b0d457107ff18fb412e9c47ff0f1 diff --git a/sdk/common/src/main/java/io/dataease/auth/filter/TokenFilter.java b/sdk/common/src/main/java/io/dataease/auth/filter/TokenFilter.java index 25f6c9a413..1b9fea4e53 100644 --- a/sdk/common/src/main/java/io/dataease/auth/filter/TokenFilter.java +++ b/sdk/common/src/main/java/io/dataease/auth/filter/TokenFilter.java @@ -9,6 +9,7 @@ import jakarta.servlet.http.HttpServletRequest; import org.apache.commons.lang3.StringUtils; import java.io.IOException; +import java.util.Objects; public class TokenFilter implements Filter { @@ -35,13 +36,13 @@ public class TokenFilter implements Filter { filterChain.doFilter(servletRequest, servletResponse); return; } - String refreshToken = null; + /*String refreshToken = null; if (StringUtils.isNotBlank(refreshToken = ServletUtils.request().getHeader(AuthConstant.REFRESH_TOKEN_KEY))) { ServletUtils.response().addHeader(AuthConstant.REFRESH_TOKEN_KEY, refreshToken); - } + }*/ String executeVersion = null; if (StringUtils.isNotBlank(executeVersion = VersionUtil.getRandomVersion())) { - ServletUtils.response().addHeader(AuthConstant.DE_EXECUTE_VERSION, executeVersion); + Objects.requireNonNull(ServletUtils.response()).addHeader(AuthConstant.DE_EXECUTE_VERSION, executeVersion); } String linkToken = ServletUtils.getHead(AuthConstant.LINK_TOKEN_KEY); if (StringUtils.isNotBlank(linkToken)) { diff --git a/sdk/common/src/main/java/io/dataease/auth/interceptor/CorsInterceptor.java b/sdk/common/src/main/java/io/dataease/auth/interceptor/CorsInterceptor.java index f37bb2eecb..d53e809fcd 100644 --- a/sdk/common/src/main/java/io/dataease/auth/interceptor/CorsInterceptor.java +++ b/sdk/common/src/main/java/io/dataease/auth/interceptor/CorsInterceptor.java @@ -37,6 +37,7 @@ public class CorsInterceptor implements HandlerInterceptor { public void addOriginList() { + busiOriginList.clear(); String className = "io.dataease.api.permissions.embedded.api.EmbeddedApi"; String methodName = "domainList"; if (ObjectUtils.isEmpty(aClass)) { @@ -54,10 +55,8 @@ public class CorsInterceptor implements HandlerInterceptor { if (ObjectUtils.isNotEmpty(result)) { List list = (List) result; if (CollectionUtils.isNotEmpty(list)) { - List strings = list.stream().filter(item -> !busiOriginList.contains(item)).toList(); - busiOriginList.addAll(strings); + busiOriginList.addAll(list.stream().distinct().toList()); } - } } } 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 7d32607b18..d358bc2095 100644 --- a/sdk/common/src/main/java/io/dataease/constant/AuthConstant.java +++ b/sdk/common/src/main/java/io/dataease/constant/AuthConstant.java @@ -13,7 +13,7 @@ public class AuthConstant { public final static String DE_API_PREFIX = "/de2api"; - public final static String REFRESH_TOKEN_KEY = "X-DE-REFRESH-TOKEN"; + // public final static String REFRESH_TOKEN_KEY = "X-DE-REFRESH-TOKEN"; public final static String USER_IMPORT_ERROR_KEY = "USER-IMPORT-ERROR-KEY"; diff --git a/sdk/common/src/main/java/io/dataease/utils/TokenUtils.java b/sdk/common/src/main/java/io/dataease/utils/TokenUtils.java index 41b9cc7b66..4a86db7c39 100644 --- a/sdk/common/src/main/java/io/dataease/utils/TokenUtils.java +++ b/sdk/common/src/main/java/io/dataease/utils/TokenUtils.java @@ -28,8 +28,7 @@ public class TokenUtils { if (StringUtils.length(token) < 100) { DEException.throwException("token is invalid"); } - TokenUserBO tokenUserBO = userBOByToken(token); - return tokenUserBO; + return userBOByToken(token); } public static TokenUserBO validateLinkToken(String linkToken) {