| | |
| | | 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; |
| | | |
| | |
| | | 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 不能为空!"); |
| | | } |
| | |
| | | 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("应用未授权"); |