Browse Source

Merge branch 'dev' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_voice

dev_shibei_match
zxc 5 years ago
parent
commit
6d4fd28de6
  1. 2
      epmet-gateway/deploy/docker-compose-dev.yml
  2. 2
      epmet-gateway/pom.xml
  3. 42
      epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java

2
epmet-gateway/deploy/docker-compose-dev.yml

@ -2,7 +2,7 @@ version: "3.7"
services:
epmet-gateway-server:
container_name: epmet-gateway-server-dev
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.15
image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.16
ports:
- "8080:8080"
network_mode: host # 使用现有网络

2
epmet-gateway/pom.xml

@ -2,7 +2,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<version>0.3.15</version>
<version>0.3.16</version>
<parent>
<groupId>com.epmet</groupId>
<artifactId>epmet-cloud</artifactId>

42
epmet-gateway/src/main/java/com/epmet/filter/CpAuthGatewayFilterFactory.java

@ -76,6 +76,31 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory<CpA
String customerId = "";
if (baseTokenDto != null) {
if (AppClientConstant.APP_RESI.equals(baseTokenDto.getApp())) {
// 居民端
TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, TokenDto.class);
if (resiTokenDto != null) {
customerId = resiTokenDto.getCustomerId();
baseTokenDto = resiTokenDto;
}
} else if (AppClientConstant.APP_GOV.equals(baseTokenDto.getApp())) {
// 政府端
GovTokenDto govTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, GovTokenDto.class);
if (govTokenDto != null) {
customerId = govTokenDto.getCustomerId();
baseTokenDto = govTokenDto;
}
} else if(AppClientConstant.APP_OPER.equals(baseTokenDto.getApp())){
//运营端
TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, TokenDto.class);
if (resiTokenDto != null) {
customerId = resiTokenDto.getCustomerId();
baseTokenDto = resiTokenDto;
}
}
}
//需要认证
if (needAuth(requestUri)) {
if (StringUtils.isBlank(token)) {
@ -83,22 +108,7 @@ public class CpAuthGatewayFilterFactory extends AbstractGatewayFilterFactory<CpA
}
// 校验token
try {
if (AppClientConstant.APP_RESI.equals(baseTokenDto.getApp())) {
// 居民端
TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, TokenDto.class);
validateTokenDto(resiTokenDto, token);
customerId = resiTokenDto.getCustomerId();
} else if (AppClientConstant.APP_GOV.equals(baseTokenDto.getApp())) {
// 政府端
GovTokenDto govTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, GovTokenDto.class);
validateTokenDto(govTokenDto, token);
customerId = govTokenDto.getCustomerId();
} else if(AppClientConstant.APP_OPER.equals(baseTokenDto.getApp())){
//运营端
TokenDto resiTokenDto = getLoginUserInfoByToken(token, jwtTokenUtils, cpUserDetailRedis, TokenDto.class);
validateTokenDto(resiTokenDto, token);
customerId = resiTokenDto.getCustomerId();
}
validateTokenDto(baseTokenDto, token);
} catch (RenException e) {
return response(exchange,new Result<>().error(e.getCode(),e.getMsg()));
}

Loading…
Cancel
Save