Browse Source

修改内部鉴权处理器,解决header中CustomerId重复的问题

dev_shibei_match
wxz 5 years ago
parent
commit
d3fd2c3c20
  1. 23
      epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java

23
epmet-gateway/src/main/java/com/epmet/auth/InternalAuthProcessor.java

@ -111,17 +111,24 @@ public class InternalAuthProcessor extends AuthProcessor {
builder.header(AppClientConstant.APP,baseTokenDto.getApp()); builder.header(AppClientConstant.APP,baseTokenDto.getApp());
builder.header(AppClientConstant.CLIENT,baseTokenDto.getClient()); builder.header(AppClientConstant.CLIENT,baseTokenDto.getClient());
builder.header(AppClientConstant.USER_ID,baseTokenDto.getUserId()); builder.header(AppClientConstant.USER_ID,baseTokenDto.getUserId());
if (StringUtils.isNotBlank(baseTokenDto.getCustomerId())) {
builder.header(AppClientConstant.CUSTOMER_ID,baseTokenDto.getCustomerId());
}
if (StringUtils.equalsAny(baseTokenDto.getApp(), AppClientConstant.APP_GOV, AppClientConstant.APP_RESI)) {//工作端/居民端 if(StringUtils.isNotBlank(customerId)){
if(StringUtils.isNotBlank(customerId)){ if (StringUtils.equalsAny(baseTokenDto.getApp(), AppClientConstant.APP_GOV, AppClientConstant.APP_RESI, "public")) {//工作端/居民端
exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId); builder.header(AppClientConstant.CUSTOMER_ID, customerId);
} }
} else if (StringUtils.equals(baseTokenDto.getApp(), "public")) {//公众号端
exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId);
} }
//if (StringUtils.isNotBlank(baseTokenDto.getCustomerId())) {
// builder.header(AppClientConstant.CUSTOMER_ID,baseTokenDto.getCustomerId());
//}
//
//if (StringUtils.equalsAny(baseTokenDto.getApp(), AppClientConstant.APP_GOV, AppClientConstant.APP_RESI)) {//工作端/居民端
// if(StringUtils.isNotBlank(customerId)){
// exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId);
// }
//} else if (StringUtils.equals(baseTokenDto.getApp(), "public")) {//公众号端
// exchange.getRequest().mutate().header(AppClientConstant.CUSTOMER_ID, customerId);
//}
ServerHttpRequest build = exchange.getRequest().mutate().build(); ServerHttpRequest build = exchange.getRequest().mutate().build();
return exchange.mutate().request(build).build(); return exchange.mutate().request(build).build();
} }

Loading…
Cancel
Save