perf: 嵌入式持续校验

This commit is contained in:
fit2cloud-chenyw 2023-12-01 14:25:19 +08:00
parent 93a7b23180
commit 8a5230f7a7
6 changed files with 11 additions and 12 deletions

View File

@ -116,10 +116,10 @@ service.interceptors.response.use(
response: AxiosResponse<any> & { 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'])
}

@ -1 +1 @@
Subproject commit 31d53d9a7650f4902ba93269d20912b3bb08bfac
Subproject commit 305c135b1e73b0d457107ff18fb412e9c47ff0f1

View File

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

View File

@ -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<String> list = (List<String>) result;
if (CollectionUtils.isNotEmpty(list)) {
List<String> strings = list.stream().filter(item -> !busiOriginList.contains(item)).toList();
busiOriginList.addAll(strings);
busiOriginList.addAll(list.stream().distinct().toList());
}
}
}
}

View File

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

View File

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