forked from github/dataease
Merge pull request #6955 from dataease/pr@dev-v2@perf_embedded_token_validate
perf: 嵌入式持续校验
This commit is contained in:
commit
5ff9cca7b3
@ -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'])
|
||||
}
|
||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
||||
Subproject commit 31d53d9a7650f4902ba93269d20912b3bb08bfac
|
||||
Subproject commit 305c135b1e73b0d457107ff18fb412e9c47ff0f1
|
@ -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)) {
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user