| | |
| | | */ |
| | | package com.vci.ubcs.auth.utils; |
| | | |
| | | import com.vci.ubcs.system.cache.NacosConfigCache; |
| | | import lombok.SneakyThrows; |
| | | import com.vci.ubcs.common.constant.TenantConstant; |
| | | import org.springblade.core.launch.constant.TokenConstant; |
| | |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.utils.*; |
| | | import com.vci.ubcs.system.entity.Tenant; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.BadCredentialsException; |
| | | import org.springframework.security.oauth2.common.exceptions.UnapprovedClientAuthenticationException; |
| | | import org.springframework.security.oauth2.common.exceptions.UserDeniedAuthorizationException; |
| | |
| | | public final static String LICENSE = TokenConstant.LICENSE; |
| | | public final static String LICENSE_NAME = TokenConstant.LICENSE_NAME; |
| | | public final static String STRATEGYUPDATESTATUS = "strategyUpdateStatus"; |
| | | public final static String TENANTNAME = "tenantName"; |
| | | public final static String DEPTNAME = "deptName"; |
| | | public final static String EMAIL = "email"; |
| | | public final static String SECRETGRADE = "secretGrade"; |
| | | |
| | | public final static String DEPT_HEADER_KEY = "Dept-Id"; |
| | | public final static String ROLE_HEADER_KEY = "Role-Id"; |
| | |
| | | public final static String PASSWORD_KEY = "password"; |
| | | public final static String GRANT_TYPE_KEY = "grant_type"; |
| | | public final static String REFRESH_TOKEN_KEY = "refresh_token"; |
| | | public final static String USER_LOCK = "当前登录用户已被停用,请联系管理解封账号。"; |
| | | |
| | | private static BladeTenantProperties tenantProperties; |
| | | |
| | |
| | | if (tenant == null || tenant.getId() == null) { |
| | | throw new UserDeniedAuthorizationException(TokenUtil.USER_HAS_NO_TENANT); |
| | | } |
| | | if (StringUtil.equalsIgnoreCase(tenant.getTenantId(), BladeConstant.ADMIN_TENANT_ID)) { |
| | | if (StringUtil.equalsIgnoreCase(tenant.getTenantId(), NacosConfigCache.getAdminUserInfo().getTenantId())) { |
| | | return false; |
| | | } |
| | | if (getTenantProperties().getLicense()) { |