Quellcode durchsuchen

新增设备管理系统的相关网关配置

pull/146/head
xiaoying vor 11 Monaten
Ursprung
Commit
7c719d1452
6 geänderte Dateien mit 41 neuen und 3 gelöschten Zeilen
  1. +8
    -1
      src/main/java/com/tuoheng/gateway/commons/CommonsConfig.java
  2. +1
    -0
      src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java
  3. +6
    -0
      src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java
  4. +8
    -0
      src/main/java/com/tuoheng/gateway/utils/GatewayUrlPathUtil.java
  5. +9
    -1
      src/main/resources/application-dev.yml
  6. +9
    -1
      src/main/resources/application-test.yml

+ 8
- 1
src/main/java/com/tuoheng/gateway/commons/CommonsConfig.java Datei anzeigen

@@ -57,13 +57,20 @@ public class CommonsConfig {
* 数字孪生服务接口地址
*/
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;

+ 1
- 0
src/main/java/com/tuoheng/gateway/config/WebSecurityConfig.java Datei anzeigen

@@ -97,6 +97,7 @@ public class WebSecurityConfig {
.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()

+ 6
- 0
src/main/java/com/tuoheng/gateway/constants/AuthorityConstant.java Datei anzeigen

@@ -88,4 +88,10 @@ public class AuthorityConstant {
*/
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";
}

+ 8
- 0
src/main/java/com/tuoheng/gateway/utils/GatewayUrlPathUtil.java Datei anzeigen

@@ -50,6 +50,8 @@ public class GatewayUrlPathUtil {

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

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


/**
* 获取 gateway 路由前缀,匹配url
@@ -99,6 +101,9 @@ public class GatewayUrlPathUtil {
case DIGITALTWIN_ADMIN:
apiPath = "/digitaltwin/admin";
break;
case DMP_ADMIN:
apiPath = "/dmp/admin";
break;
default:
break;
}
@@ -144,6 +149,9 @@ public class GatewayUrlPathUtil {
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();

+ 9
- 1
src/main/resources/application-dev.yml Datei anzeigen

@@ -276,6 +276,13 @@ spring:
- Path=/digitaltwin/admin/**
filters:
- StripPrefix=2
# 设备管理 admin服务
- id: tuoheng-digitaltwin-admin
uri: lb://tuoheng-digitaltwin-admin
predicates:
- Path=/digitaltwin/admin/**
filters:
- StripPrefix=2
# Redis数据源
redis:
# 缓存库默认索引0
@@ -313,4 +320,5 @@ tuoheng:
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
digitaltwin-admin-perUrl: http://192.168.11.11:9180/permission/getRoleIdList
digitaltwin-admin-perUrl: http://192.168.11.11:9180/permission/getRoleIdList
dmp-admin-perUrl: http://192.168.11.11:9190/permission/getRoleIdList

+ 9
- 1
src/main/resources/application-test.yml Datei anzeigen

@@ -276,6 +276,13 @@ spring:
- Path=/digitaltwin/admin/**
filters:
- StripPrefix=2
# 设备管理 admin服务
- id: tuoheng-digitaltwin-admin
uri: lb://tuoheng-digitaltwin-admin
predicates:
- Path=/digitaltwin/admin/**
filters:
- StripPrefix=2
# Redis数据源
redis:
# 缓存库默认索引0
@@ -313,4 +320,5 @@ tuoheng:
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
digitaltwin-admin-perUrl: https://digitaltwin-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

Laden…
Abbrechen
Speichern