Browse Source

Merge branch 'release' of gitadmin/tuoheng_gateway into master

master
xuziqing 10 months ago
parent
commit
899a6788a4
8 changed files with 105 additions and 4 deletions
  1. +17
    -1
      src/main/java/com/tuoheng/gateway/commons/CommonsConfig.java
  2. +4
    -0
      src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java
  3. +12
    -0
      src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java
  4. +5
    -0
      src/main/java/com/tuoheng/gateway/constants/PermitPathConstant.java
  5. +16
    -0
      src/main/java/com/tuoheng/gateway/utils/GatewayUrlPathUtil.java
  6. +17
    -1
      src/main/resources/application-dev.yml
  7. +17
    -1
      src/main/resources/application-prod.yml
  8. +17
    -1
      src/main/resources/application-test.yml

+ 17
- 1
src/main/java/com/tuoheng/gateway/commons/CommonsConfig.java View File

@@ -53,13 +53,24 @@ public class CommonsConfig {
* 全时空系统接口地址
*/
public static String spacetimePermissionUrl;
/**
* 数字孪生服务接口地址
*/
public static String digitaltwinPermissionUrl;
/**
* 设备管理服务接口地址
*/
public static String dmpPermissionUrl;


@Value("${tuoheng.hhz-admin-perUrl}")
public void setHhzPermissionUrl(String url) {
hhzPermissionUrl = url;
}

@Value("${tuoheng.dmp-admin-perUrl}")
public void setDmpPermissionUrl(String url) {
dmpPermissionUrl = url;
}
@Value("${tuoheng.spacetime-admin-perUrl}")
public void setSpacetimePermissionUrl(String url) {
spacetimePermissionUrl = url;
@@ -99,4 +110,9 @@ public class CommonsConfig {
airportPermissionUrl = url;
}

@Value("${tuoheng.digitaltwin-admin-perUrl}")
public void setDigitaltwinPermissionUrl(String url) {
digitaltwinPermissionUrl = url;
}

}

+ 4
- 0
src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java View File

@@ -67,6 +67,7 @@ public class WebSecurityConfig {
String[] telecomumalePermitPath = PermitPathConstant.telecomumaleUrlStr;
String[] alertPermitPath = PermitPathConstant.alertleUrlStr;
String[] airportPermitPath = PermitPathConstant.airportUrlStr;
String[] oidcPermitPath = PermitPathConstant.oidcUrlStr;
httpSecurity
.authorizeExchange()
//.pathMatchers(OAUTH_PATH).hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_DSP_MP, AuthorityConstant.SCOPE_TUOHNEG_DSP_WEB)
@@ -79,6 +80,7 @@ public class WebSecurityConfig {
.pathMatchers(telecomumalePermitPath).permitAll()
.pathMatchers(alertPermitPath).permitAll()
.pathMatchers(airportPermitPath).permitAll()
.pathMatchers(oidcPermitPath).permitAll()
.pathMatchers("/pilot/miniprogram/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_PILOT_MP)
.pathMatchers("/pilot/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_PILOT_ADMIN)
.pathMatchers("/hhz/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_HHZ_ADMIN)
@@ -94,6 +96,8 @@ public class WebSecurityConfig {
.pathMatchers("/airmonitor/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_AIRMONITOR_ADMIN)
.pathMatchers("/alert/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_ALERT_ADMIN)
.pathMatchers("/spacetime/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_SPACETIME_ADMIN)
.pathMatchers("/digitaltwin/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_DIGITALTWIN_ADMIN)
.pathMatchers("/dmp/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_DMP_ADMIN)
.pathMatchers("/airport/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_AIRPORT_ADMIN)
.pathMatchers("/oidc/admin/user/**").authenticated()
.pathMatchers("/api/inspection/**").authenticated()

+ 12
- 0
src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java View File

@@ -82,4 +82,16 @@ public class AuthorityConstant {
*/
public static final String SCOPE_TUOHNEG_SPACETIME_ADMIN = "SCOPE_tuoheng-spacetime-admin";
//public static final String SCOPE_TUOHNEG_ALERT_MP= "SCOPE_tuoheng-alert-mp";

/**
* Digitaltwin 用户权限
*/
public static final String SCOPE_TUOHNEG_DIGITALTWIN_ADMIN = "SCOPE_tuoheng-digitaltwin-admin";
//public static final String SCOPE_TUOHNEG_ALERT_MP= "SCOPE_tuoheng-alert-mp";

/**
* Digitaltwin 用户权限
*/
public static final String SCOPE_TUOHNEG_DMP_ADMIN = "SCOPE_tuoheng-dmp-admin";
//public static final String SCOPE_TUOHNEG_DMP_MP= "SCOPE_tuoheng-dmp-mp";
}

+ 5
- 0
src/main/java/com/tuoheng/gateway/constants/PermitPathConstant.java View File

@@ -20,6 +20,7 @@ public class PermitPathConstant {
"/hhz/admin/taskFile/**",
"/hhz/admin/flightdata/**",
"/hhz/admin/tenant/**",
"/hhz/admin/feedback/import/**",
"/hhz/admin/dsp/**",
"/hhz/admin/common/**",
"/hhz/api/tenant/**",
@@ -118,4 +119,8 @@ public class PermitPathConstant {
"/airport/admin/common/**",
"/airport/admin/airportStatus/index/**"
};

public static String oidcUrlStr[] = {
"/oidc/admin/third/redirect/**"
};
}

+ 16
- 0
src/main/java/com/tuoheng/gateway/utils/GatewayUrlPathUtil.java View File

@@ -48,6 +48,10 @@ public class GatewayUrlPathUtil {

private static final String SPACETIME_ADMIN = "tuoheng-spacetime-admin";

private static final String DIGITALTWIN_ADMIN = "tuoheng-digitaltwin-admin";

private static final String DMP_ADMIN = "tuoheng-dmp-admin";


/**
* 获取 gateway 路由前缀,匹配url
@@ -94,6 +98,12 @@ public class GatewayUrlPathUtil {
case SPACETIME_ADMIN:
apiPath = "/spacetime/admin";
break;
case DIGITALTWIN_ADMIN:
apiPath = "/digitaltwin/admin";
break;
case DMP_ADMIN:
apiPath = "/dmp/admin";
break;
default:
break;
}
@@ -136,6 +146,12 @@ public class GatewayUrlPathUtil {
if (clientId.equals(SPACETIME_ADMIN)) {
url = CommonsConfig.spacetimePermissionUrl;
}
if (clientId.equals(DIGITALTWIN_ADMIN)) {
url = CommonsConfig.digitaltwinPermissionUrl;
}
if (clientId.equals(DMP_ADMIN)) {
url = CommonsConfig.dmpPermissionUrl;
}
log.info("getRoleIdByApiUrlPermission -url:{},token:{}", url, token);
if (StringUtils.isNotBlank(url)) {
HttpHeaders resultRequestHeader = new HttpHeaders();

+ 17
- 1
src/main/resources/application-dev.yml View File

@@ -269,6 +269,20 @@ spring:
- Path=/spacetime/admin/**
filters:
- StripPrefix=2
# 数字孪生服务 admin服务
- id: tuoheng-digitaltwin-admin
uri: lb://tuoheng-digitaltwin-admin
predicates:
- Path=/digitaltwin/admin/**
filters:
- StripPrefix=2
# 设备管理 admin服务
- id: tuoheng-dmp-admin
uri: lb://tuoheng-dmp-admin
predicates:
- Path=/dmp/admin/**
filters:
- StripPrefix=2
# Redis数据源
redis:
# 缓存库默认索引0
@@ -305,4 +319,6 @@ tuoheng:
weptsp-admin-perUrl: http://192.168.11.11:9140/permission/getRoleIdList
airmonitor-admin-perUrl: http://192.168.11.11:9130/permission/getRoleIdList
telecomumale-admin-perUrl: http://192.168.11.11:9150/permission/getRoleIdList
spacetime-admin-perUrl: http://192.168.11.11:9170/permission/getRoleIdList
spacetime-admin-perUrl: http://192.168.11.11:9170/permission/getRoleIdList
digitaltwin-admin-perUrl: http://192.168.11.11:9180/permission/getRoleIdList
dmp-admin-perUrl: http://192.168.11.11:9190/permission/getRoleIdList

+ 17
- 1
src/main/resources/application-prod.yml View File

@@ -261,6 +261,20 @@ spring:
- Path=/spacetime/admin/**
filters:
- StripPrefix=2
# 数字孪生服务 admin服务
- id: tuoheng-digitaltwin-admin
uri: lb://tuoheng-digitaltwin-admin
predicates:
- Path=/digitaltwin/admin/**
filters:
- StripPrefix=2
# 设备管理 admin服务
- id: tuoheng-dmp-admin
uri: lb://tuoheng-dmp-admin
predicates:
- Path=/dmp/admin/**
filters:
- StripPrefix=2
# Redis数据源
redis:
# 缓存库默认索引0
@@ -297,4 +311,6 @@ tuoheng:
weptsp-admin-perUrl: https://weptsp.t-aaron.com/permission/getRoleIdList
telecomumale-admin-perUrl: https://telecomumale.t-aaron.com/permission/getRoleIdList
alert-admin-perUrl: https://alert.t-aaron.com/permission/getRoleIdList
spacetime-admin-perUrl: https://spacetime.t-aaron.com/permission/getRoleIdList
spacetime-admin-perUrl: https://spacetime.t-aaron.com/permission/getRoleIdList
digitaltwin-admin-perUrl: https://digitaltwin.t-aaron.com/permission/getRoleIdList
dmp-admin-perUrl: https://dmp.t-aaron.com/permission/getRoleIdList

+ 17
- 1
src/main/resources/application-test.yml View File

@@ -269,6 +269,20 @@ spring:
- Path=/spacetime/admin/**
filters:
- StripPrefix=2
# 数字孪生服务 admin服务
- id: tuoheng-digitaltwin-admin
uri: lb://tuoheng-digitaltwin-admin
predicates:
- Path=/digitaltwin/admin/**
filters:
- StripPrefix=2
# 设备管理 admin服务
- id: tuoheng-dmp-admin
uri: lb://tuoheng-dmp-admin
predicates:
- Path=/dmp/admin/**
filters:
- StripPrefix=2
# Redis数据源
redis:
# 缓存库默认索引0
@@ -305,4 +319,6 @@ tuoheng:
weptsp-admin-perUrl: https://weptsp-test.t-aaron.com/permission/getRoleIdList
airmonitor-admin-perUrl: https://airmonitor-test.t-aaron.com/permission/getRoleIdList
telecomumale-admin-perUrl: https://telecomumale-test.t-aaron.com/permission/getRoleIdList
spacetime-admin-perUrl: https://spacetime-test.t-aaron.com/permission/getRoleIdList
spacetime-admin-perUrl: https://spacetime-test.t-aaron.com/permission/getRoleIdList
digitaltwin-admin-perUrl: https://digitaltwin-test.t-aaron.com/permission/getRoleIdList
dmp-admin-perUrl: https://dmp-test.t-aaron.com/permission/getRoleIdList

Loading…
Cancel
Save