Commit 0ddd3304 authored by 李健华's avatar 李健华

判断生成的token不包含租户和头部不含租户,默认租户为羊小咩

parent 0bc6d068
...@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.model.LoginProperties; ...@@ -7,6 +7,7 @@ import cn.quantgroup.xyqb.model.LoginProperties;
import cn.quantgroup.xyqb.model.session.SessionStruct; import cn.quantgroup.xyqb.model.session.SessionStruct;
import cn.quantgroup.xyqb.session.XyqbSessionContextHolder; import cn.quantgroup.xyqb.session.XyqbSessionContextHolder;
import cn.quantgroup.xyqb.util.IpUtil; import cn.quantgroup.xyqb.util.IpUtil;
import cn.quantgroup.xyqb.util.TenantUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
...@@ -96,12 +97,12 @@ public class PasswordFreeAccessValidateAdvisor { ...@@ -96,12 +97,12 @@ public class PasswordFreeAccessValidateAdvisor {
String tenantId = request.getHeader(Constants.X_AUTH_TENANT); String tenantId = request.getHeader(Constants.X_AUTH_TENANT);
LoginProperties loginProperties = session.getValues().getLoginProperties(); LoginProperties loginProperties = session.getValues().getLoginProperties();
if (!Objects.isNull(loginProperties.getTenantId())) { if (!Objects.isNull(loginProperties.getTenantId())) {
if (!loginProperties.getTenantId().toString().equals(tenantId)) { if (!loginProperties.getTenantId().toString().equals(tenantId) && !TenantUtil.TENANT_DEFAULT.toString().equals(tenantId)) {
log.info("非法请求 - 错误租户, token={}, phoneNo={}, userId={}, clientIp={}, tenantId={}, loginTenantId={}", token, phoneNo, userId, clientIp, tenantId, loginProperties.getTenantId().toString()); log.info("非法请求 - 错误租户, token={}, phoneNo={}, userId={}, clientIp={}, tenantId={}, loginTenantId={}", token, phoneNo, userId, clientIp, tenantId, loginProperties.getTenantId().toString());
return false; return false;
} }
} else { } else {
if(!StringUtils.isBlank(tenantId)) { if(!StringUtils.isBlank(tenantId) && !TenantUtil.TENANT_DEFAULT.toString().equals(tenantId)) {
log.info("非法请求 - 错误租户, token={}, phoneNo={}, userId={}, clientIp={}, tenantId={}", token, phoneNo, userId, clientIp, tenantId); log.info("非法请求 - 错误租户, token={}, phoneNo={}, userId={}, clientIp={}, tenantId={}", token, phoneNo, userId, clientIp, tenantId);
return false; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment