|
@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.core.annotation.Order; |
|
|
import org.springframework.core.annotation.Order; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
|
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.web.context.request.RequestAttributes; |
|
|
import org.springframework.web.context.request.RequestAttributes; |
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
import org.springframework.web.context.request.RequestContextHolder; |
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
|
import org.springframework.web.context.request.ServletRequestAttributes; |
|
@ -82,10 +83,10 @@ public class ExternalAppRequestAuthAspect { |
|
|
} else if (signature.getMethod().getAnnotation(InternalAppRequestAuth.class) != null |
|
|
} else if (signature.getMethod().getAnnotation(InternalAppRequestAuth.class) != null |
|
|
&& StringUtils.isNotBlank(request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY))) { |
|
|
&& StringUtils.isNotBlank(request.getHeader(AUTHORIZATION_TOKEN_HEADER_KEY))) { |
|
|
// 走内部应用认证
|
|
|
// 走内部应用认证
|
|
|
String customerId = null; |
|
|
|
|
|
internalAppAuth(signature, point, request); |
|
|
internalAppAuth(signature, point, request); |
|
|
} else { |
|
|
} else { |
|
|
throw new RenException(EpmetErrorCode.UNSUPPORT_AUTH_TYPE.getCode(), EpmetErrorCode.UNSUPPORT_AUTH_TYPE.getMsg()); |
|
|
logger.error("根据header无法找到适用的认证方式"); |
|
|
|
|
|
throw new RenException(EpmetErrorCode.ERR401.getCode(), EpmetErrorCode.ERR401.getMsg()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -101,6 +102,10 @@ public class ExternalAppRequestAuthAspect { |
|
|
BaseTokenDto tokenDTO = getTokenDTO(authorization); |
|
|
BaseTokenDto tokenDTO = getTokenDTO(authorization); |
|
|
|
|
|
|
|
|
Map<String, Object> tokenMap = redisUtils.hGetAll(RedisKeys.getCpUserKey(tokenDTO.getApp(), tokenDTO.getClient(), tokenDTO.getUserId())); |
|
|
Map<String, Object> tokenMap = redisUtils.hGetAll(RedisKeys.getCpUserKey(tokenDTO.getApp(), tokenDTO.getClient(), tokenDTO.getUserId())); |
|
|
|
|
|
if (CollectionUtils.isEmpty(tokenMap)) { |
|
|
|
|
|
logger.error("内部应用认证,redis中没有找到登录缓存信息"); |
|
|
|
|
|
throw new RenException(EpmetErrorCode.ERR10006.getCode(), EpmetErrorCode.ERR10006.getMsg()); |
|
|
|
|
|
} |
|
|
BaseTokenDto baseTokenDto = null; |
|
|
BaseTokenDto baseTokenDto = null; |
|
|
String customerId; |
|
|
String customerId; |
|
|
if ("gov".equals(tokenDTO.getApp())) { |
|
|
if ("gov".equals(tokenDTO.getApp())) { |
|
|