From d41f14d2986b46da9dd7742f6df63d9725cd29f3 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期二, 29 十月 2024 17:08:36 +0800 Subject: [PATCH] 数据采集 --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/utils/ApiSecurityUtils.java | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/utils/ApiSecurityUtils.java b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/utils/ApiSecurityUtils.java index 774c1e4..016cb99 100644 --- a/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/utils/ApiSecurityUtils.java +++ b/iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/utils/ApiSecurityUtils.java @@ -5,10 +5,13 @@ import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.security.core.LoginUser; import com.iailab.framework.security.core.util.SecurityFrameworkUtils; +import com.iailab.framework.tenant.core.context.TenantContextHolder; import com.iailab.module.system.api.user.AdminUserApi; import com.iailab.module.system.api.user.dto.AdminUserRespDTO; import org.apache.commons.lang3.StringUtils; + import javax.annotation.Resource; + import org.springframework.stereotype.Component; import org.springframework.util.ObjectUtils; @@ -43,9 +46,18 @@ return token; } + private void setTenantId(HttpServletRequest httpRequest) { + String tenantId = httpRequest.getHeader(Constant.HEAD_TENANT_ID); + + if (StringUtils.isBlank(tenantId)) { + TenantContextHolder.setTenantId(Long.parseLong(tenantId)); + } + } + public void validate(HttpServletRequest httpRequest) throws Exception { - String token = getRequestToken(httpRequest); + setTenantId(httpRequest); + /*String token = getRequestToken(httpRequest); if (StringUtils.isBlank(token)) { throw new Exception("token 不能为空!"); } @@ -58,7 +70,7 @@ throw new RuntimeException("用户不存在"); } AdminUserRespDTO userData = user.getData(); - String username = userData.getUsername(); + String username = userData.getUsername();*/ /*ApiAppEntity appInfo = apiAppService.getInfoByAppKey(username); if (appInfo == null) { throw new RuntimeException("应用未授权"); -- Gitblit v1.9.3