From e8ad669f7c97d45cd23630dc101180a130d6c17e Mon Sep 17 00:00:00 2001 From: dongyukun <1208714201@qq.com> Date: 星期二, 05 十一月 2024 10:04:57 +0800 Subject: [PATCH] tag当前值开发 --- iailab-module-data/iailab-module-data-biz/src/main/java/com/iailab/module/data/api/utils/ApiSecurityUtils.java | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 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 72287f7..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,14 +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.module.data.gateway.entity.ApiAppEntity; -import com.iailab.module.data.gateway.service.ApiAppService; -import com.iailab.module.data.gateway.entity.ApiAppEntity; -import com.iailab.module.data.gateway.service.ApiAppService; +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; @@ -27,8 +26,8 @@ @Component public class ApiSecurityUtils { - @Resource - private ApiAppService apiAppService; + /*@Resource + private ApiAppService apiAppService;*/ @Resource private AdminUserApi adminUserApi; @@ -47,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 不能为空!"); } @@ -62,11 +70,11 @@ throw new RuntimeException("用户不存在"); } AdminUserRespDTO userData = user.getData(); - String username = userData.getUsername(); - ApiAppEntity appInfo = apiAppService.getInfoByAppKey(username); + String username = userData.getUsername();*/ + /*ApiAppEntity appInfo = apiAppService.getInfoByAppKey(username); if (appInfo == null) { throw new RuntimeException("应用未授权"); - } + }*/ //TODO 验证签名 // if(!com.iailab.common.utils.JwtUtils.verify(token, appInfo.getAppSecret())){ // throw new RuntimeException("签名错误"); -- Gitblit v1.9.3