<version>1.18.22</version> | <version>1.18.22</version> | ||||
</dependency> | </dependency> | ||||
<dependency> | |||||
<groupId>org.apache.skywalking</groupId> | |||||
<artifactId>apm-toolkit-logback-1.x</artifactId> | |||||
<version>9.0.0</version> | |||||
</dependency> | |||||
<dependency> | |||||
<groupId>org.apache.skywalking</groupId> | |||||
<artifactId>apm-toolkit-trace</artifactId> | |||||
<version>9.0.0</version> | |||||
</dependency> | |||||
</dependencies> | </dependencies> | ||||
<!-- 构建环境变量 --> | <!-- 构建环境变量 --> |
* 机场系统接口地址 | * 机场系统接口地址 | ||||
*/ | */ | ||||
public static String airportPermissionUrl; | public static String airportPermissionUrl; | ||||
/** | |||||
* 全时空系统接口地址 | |||||
*/ | |||||
public static String spacetimePermissionUrl; | |||||
@Value("${tuoheng.hhz-admin-perUrl}") | @Value("${tuoheng.hhz-admin-perUrl}") | ||||
hhzPermissionUrl = url; | hhzPermissionUrl = url; | ||||
} | } | ||||
@Value("${tuoheng.spacetime-admin-perUrl}") | |||||
public void setSpacetimePermissionUrl(String url) { | |||||
spacetimePermissionUrl = url; | |||||
} | |||||
@Value("${tuoheng.freeway-admin-perUrl}") | @Value("${tuoheng.freeway-admin-perUrl}") | ||||
public void setFreewayPermissionUrl(String url) { | public void setFreewayPermissionUrl(String url) { | ||||
freewayPermissionUrl = url; | freewayPermissionUrl = url; |
.pathMatchers("/weptsp/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_WEPTSP_ADMIN) | .pathMatchers("/weptsp/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_WEPTSP_ADMIN) | ||||
.pathMatchers("/airmonitor/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_AIRMONITOR_ADMIN) | .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("/alert/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_ALERT_ADMIN) | ||||
.pathMatchers("/spacetime/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_SPACETIME_ADMIN) | |||||
.pathMatchers("/airport/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_AIRPORT_ADMIN) | .pathMatchers("/airport/admin/**").hasAnyAuthority(AuthorityConstant.SCOPE_ADMIN, AuthorityConstant.SCOPE_TUOHNEG_AIRPORT_ADMIN) | ||||
.pathMatchers("/oidc/admin/user/**").authenticated() | .pathMatchers("/oidc/admin/user/**").authenticated() | ||||
.pathMatchers("/api/inspection/**").authenticated() | .pathMatchers("/api/inspection/**").authenticated() |
*/ | */ | ||||
public static final String SCOPE_TUOHNEG_AIRPORT_ADMIN = "SCOPE_tuoheng-airport-admin"; | public static final String SCOPE_TUOHNEG_AIRPORT_ADMIN = "SCOPE_tuoheng-airport-admin"; | ||||
//public static final String SCOPE_TUOHNEG_ALERT_MP= "SCOPE_tuoheng-alert-mp"; | //public static final String SCOPE_TUOHNEG_ALERT_MP= "SCOPE_tuoheng-alert-mp"; | ||||
/** | |||||
* Spacetime 用户权限 | |||||
*/ | |||||
public static final String SCOPE_TUOHNEG_SPACETIME_ADMIN = "SCOPE_tuoheng-spacetime-admin"; | |||||
//public static final String SCOPE_TUOHNEG_ALERT_MP= "SCOPE_tuoheng-alert-mp"; | |||||
} | } |
private static final String AIRPORT_ADMIN = "tuoheng-airport-admin"; | private static final String AIRPORT_ADMIN = "tuoheng-airport-admin"; | ||||
private static final String SPACETIME_ADMIN = "tuoheng-spacetime-admin"; | |||||
/** | /** | ||||
* 获取 gateway 路由前缀,匹配url | * 获取 gateway 路由前缀,匹配url | ||||
case ALERT_ADMIN: | case ALERT_ADMIN: | ||||
apiPath = "/alert/admin"; | apiPath = "/alert/admin"; | ||||
break; | break; | ||||
case SPACETIME_ADMIN: | |||||
apiPath = "/spacetime/admin"; | |||||
break; | |||||
default: | default: | ||||
break; | break; | ||||
} | } | ||||
if (clientId.equals(AIRPORT_ADMIN)) { | if (clientId.equals(AIRPORT_ADMIN)) { | ||||
url = CommonsConfig.airportPermissionUrl; | url = CommonsConfig.airportPermissionUrl; | ||||
} | } | ||||
if (clientId.equals(SPACETIME_ADMIN)) { | |||||
url = CommonsConfig.spacetimePermissionUrl; | |||||
} | |||||
log.info("getRoleIdByApiUrlPermission -url:{},token:{}", url, token); | log.info("getRoleIdByApiUrlPermission -url:{},token:{}", url, token); | ||||
if (StringUtils.isNotBlank(url)) { | if (StringUtils.isNotBlank(url)) { | ||||
HttpHeaders resultRequestHeader = new HttpHeaders(); | HttpHeaders resultRequestHeader = new HttpHeaders(); |
- Path=/alert/admin/** | - Path=/alert/admin/** | ||||
filters: | filters: | ||||
- StripPrefix=2 | - StripPrefix=2 | ||||
# 全时空影像系统 admin服务 | |||||
- id: tuoheng-spacetime-admin | |||||
uri: lb://tuoheng-spacetime-admin | |||||
predicates: | |||||
- Path=/spacetime/admin/** | |||||
filters: | |||||
- StripPrefix=2 | |||||
# Redis数据源 | # Redis数据源 | ||||
redis: | redis: | ||||
# 缓存库默认索引0 | # 缓存库默认索引0 | ||||
waterway-admin-perUrl: http://192.168.11.11:9120/permission/getRoleIdList | waterway-admin-perUrl: http://192.168.11.11:9120/permission/getRoleIdList | ||||
weptsp-admin-perUrl: http://192.168.11.11:9140/permission/getRoleIdList | weptsp-admin-perUrl: http://192.168.11.11:9140/permission/getRoleIdList | ||||
airmonitor-admin-perUrl: http://192.168.11.11:9130/permission/getRoleIdList | airmonitor-admin-perUrl: http://192.168.11.11:9130/permission/getRoleIdList | ||||
telecomumale-admin-perUrl: http://192.168.11.11:9150/permission/getRoleIdList | |||||
telecomumale-admin-perUrl: http://192.168.11.11:9150/permission/getRoleIdList | |||||
spacetime-admin-perUrl: http://192.168.11.11:9170/permission/getRoleIdList |
- Path=/alert/admin/** | - Path=/alert/admin/** | ||||
filters: | filters: | ||||
- StripPrefix=2 | - StripPrefix=2 | ||||
# 全时空影像系统 admin服务 | |||||
- id: tuoheng-spacetime-admin | |||||
uri: lb://tuoheng-spacetime-admin | |||||
predicates: | |||||
- Path=/spacetime/admin/** | |||||
filters: | |||||
- StripPrefix=2 | |||||
# Redis数据源 | # Redis数据源 | ||||
redis: | redis: | ||||
# 缓存库默认索引0 | # 缓存库默认索引0 | ||||
airmonitor-admin-perUrl: https://airmonitor.t-aaron.com/permission/getRoleIdList | airmonitor-admin-perUrl: https://airmonitor.t-aaron.com/permission/getRoleIdList | ||||
weptsp-admin-perUrl: https://weptsp.t-aaron.com/permission/getRoleIdList | weptsp-admin-perUrl: https://weptsp.t-aaron.com/permission/getRoleIdList | ||||
telecomumale-admin-perUrl: https://telecomumale.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 | |||||
alert-admin-perUrl: https://alert.t-aaron.com/permission/getRoleIdList | |||||
spacetime-admin-perUrl: https://spacetime.t-aaron.com/permission/getRoleIdList |
- Path=/alert/admin/** | - Path=/alert/admin/** | ||||
filters: | filters: | ||||
- StripPrefix=2 | - StripPrefix=2 | ||||
# 全时空影像系统 admin服务 | |||||
- id: tuoheng-spacetime-admin | |||||
uri: lb://tuoheng-spacetime-admin | |||||
predicates: | |||||
- Path=/spacetime/admin/** | |||||
filters: | |||||
- StripPrefix=2 | |||||
# Redis数据源 | # Redis数据源 | ||||
redis: | redis: | ||||
# 缓存库默认索引0 | # 缓存库默认索引0 | ||||
waterway-admin-perUrl: https://waterway-test.t-aaron.com/permission/getRoleIdList | waterway-admin-perUrl: https://waterway-test.t-aaron.com/permission/getRoleIdList | ||||
weptsp-admin-perUrl: https://weptsp-test.t-aaron.com/permission/getRoleIdList | weptsp-admin-perUrl: https://weptsp-test.t-aaron.com/permission/getRoleIdList | ||||
airmonitor-admin-perUrl: https://airmonitor-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 | |||||
telecomumale-admin-perUrl: https://telecomumale-test.t-aaron.com/permission/getRoleIdList | |||||
spacetime-admin-perUrl: https://spacetime-test.t-aaron.com/permission/getRoleIdList |
<appender-ref ref="LOG_FILE" /> | <appender-ref ref="LOG_FILE" /> | ||||
</appender> | </appender> | ||||
<!--skywalking日志上报--> | |||||
<appender name="grpc-log" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender"> | |||||
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> | |||||
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.mdc.TraceIdMDCPatternLogbackLayout"> | |||||
<Pattern>[th-gateway] %d{yyyy-MM-dd HH:mm:ss.SSS} [%X{tid}] [%thread] %-5level %logger{36} -%msg%n</Pattern> | |||||
</layout> | |||||
</encoder> | |||||
</appender> | |||||
<logger name="com.tuoheng" level="DEBUG" additivity="false"> | <logger name="com.tuoheng" level="DEBUG" additivity="false"> | ||||
<appender-ref ref="console" /> | <appender-ref ref="console" /> | ||||
<appender-ref ref="file.async" /> | <appender-ref ref="file.async" /> | ||||
<root level="INFO"> | <root level="INFO"> | ||||
<appender-ref ref="console" /> | <appender-ref ref="console" /> | ||||
<appender-ref ref="file.async" /> | <appender-ref ref="file.async" /> | ||||
<appender-ref ref="grpc-log" /> | |||||
</root> | </root> | ||||
</configuration> | </configuration> |