|
|
@ -15,6 +15,7 @@ import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.web.server.ServerWebExchange; |
|
|
|
|
|
|
|
/** |
|
|
|
* jwt 认证处理器 |
|
|
@ -31,7 +32,7 @@ public class ExtAppJwtAuthProcessor extends ExtAppAuthProcessor { |
|
|
|
private RedisUtils redisUtils; |
|
|
|
|
|
|
|
@Override |
|
|
|
public void auth(String appId, String token, Long ts) { |
|
|
|
public void auth(String appId, String token, Long ts, ServerWebExchange exchange) { |
|
|
|
String secret; |
|
|
|
if (StringUtils.isBlank(secret = getTokenFromCache(appId))) { |
|
|
|
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), String.format("根据AppId:【%s】没有找到对应的秘钥", appId)); |
|
|
@ -65,6 +66,9 @@ public class ExtAppJwtAuthProcessor extends ExtAppAuthProcessor { |
|
|
|
logger.error("AppId不对应,token外部的:{}, token内部解析出来的:{}", appId, appIdIn); |
|
|
|
throw new RenException(EpmetErrorCode.OPER_EXTERNAL_APP_AUTH_ERROR.getCode(), "AppId不匹配"); |
|
|
|
} |
|
|
|
|
|
|
|
// 添加客户ID等到请求头
|
|
|
|
exchange.getRequest().mutate().header("CustomerId", customerId); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|