升级Spring Boot到2.5.x,升级Spring Cloud到2020.x
This commit is contained in:
@@ -9,8 +9,6 @@
|
||||
<artifactId>zlt-gateway</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<!-- zuul -->
|
||||
<module>zuul-gateway</module>
|
||||
<!-- spring cloud gateway -->
|
||||
<module>sc-gateway</module>
|
||||
</modules>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-ribbon-spring-boot-starter</artifactId>
|
||||
<artifactId>zlt-loadbalancer-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
@@ -89,6 +89,10 @@
|
||||
<groupId>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth</groupId>
|
||||
<artifactId>spring-security-oauth2</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.central;
|
||||
|
||||
import com.central.common.ribbon.annotation.EnableBaseFeignInterceptor;
|
||||
import com.central.common.lb.annotation.EnableBaseFeignInterceptor;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
+12
-4
@@ -1,7 +1,7 @@
|
||||
package com.central.gateway.auth;
|
||||
|
||||
import com.central.common.model.SysMenu;
|
||||
import com.central.gateway.feign.MenuService;
|
||||
import com.central.gateway.feign.AsynMenuService;
|
||||
import com.central.oauth2.common.service.impl.DefaultPermissionServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.server.reactive.ServerHttpRequest;
|
||||
@@ -14,7 +14,9 @@ import org.springframework.web.server.ServerWebExchange;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
* url权限认证
|
||||
@@ -29,7 +31,7 @@ import java.util.List;
|
||||
@Component
|
||||
public class PermissionAuthManager extends DefaultPermissionServiceImpl implements ReactiveAuthorizationManager<AuthorizationContext> {
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
private AsynMenuService asynMenuService;
|
||||
|
||||
@Override
|
||||
public Mono<AuthorizationDecision> check(Mono<Authentication> authentication, AuthorizationContext authorizationContext) {
|
||||
@@ -43,6 +45,12 @@ public class PermissionAuthManager extends DefaultPermissionServiceImpl implemen
|
||||
|
||||
@Override
|
||||
public List<SysMenu> findMenuByRoleCodes(String roleCodes) {
|
||||
return menuService.findByRoleCodes(roleCodes);
|
||||
Future<List<SysMenu>> futureResult = asynMenuService.findByRoleCodes(roleCodes);
|
||||
try {
|
||||
return futureResult.get();
|
||||
} catch (Exception e) {
|
||||
log.error("asynMenuService.findMenuByRoleCodes-error", e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
+19
-14
@@ -1,14 +1,19 @@
|
||||
package com.central.gateway.config;
|
||||
|
||||
import com.central.common.config.DefaultAsycTaskConfig;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
* 线程池配置、启用异步
|
||||
* @Async quartz 需要使用
|
||||
*/
|
||||
@Configuration
|
||||
public class AsycTaskExecutorConfig extends DefaultAsycTaskConfig {
|
||||
|
||||
}
|
||||
package com.central.gateway.config;
|
||||
|
||||
import com.central.common.config.DefaultAsycTaskConfig;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 线程池配置、启用异步
|
||||
*
|
||||
* @author zlt
|
||||
* @version 1.0
|
||||
* @date 2021/8/8
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Configuration
|
||||
public class AsycTaskExecutorConfig extends DefaultAsycTaskConfig {
|
||||
|
||||
}
|
||||
@@ -29,7 +29,7 @@ public class CorsConfig {
|
||||
// cookie跨域
|
||||
config.setAllowCredentials(Boolean.TRUE);
|
||||
config.addAllowedMethod(ALL);
|
||||
config.addAllowedOrigin(ALL);
|
||||
config.addAllowedOriginPattern(ALL);
|
||||
config.addAllowedHeader(ALL);
|
||||
// 配置前端js允许访问的自定义响应头
|
||||
config.addExposedHeader("setToken");
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.central.gateway.feign;
|
||||
|
||||
import com.central.common.model.SysMenu;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.AsyncResult;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
* 异步Menu服务
|
||||
*
|
||||
* @author zlt
|
||||
* @version 1.0
|
||||
* @date 2021/8/8
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Component
|
||||
public class AsynMenuService {
|
||||
@Lazy
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
|
||||
@Async
|
||||
public Future<List<SysMenu>> findByRoleCodes(String roleCodes) {
|
||||
List<SysMenu> result = menuService.findByRoleCodes(roleCodes);
|
||||
return new AsyncResult<>(result);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@ package com.central.gateway.feign.fallback;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.central.gateway.feign.MenuService;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
+4
-2
@@ -6,9 +6,9 @@ import com.central.common.constant.ConfigConstants;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.cloud.client.ServiceInstance;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||
import org.springframework.cloud.gateway.config.LoadBalancerProperties;
|
||||
/*import org.springframework.cloud.gateway.config.LoadBalancerProperties;
|
||||
import org.springframework.cloud.gateway.filter.LoadBalancerClientFilter;
|
||||
import org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient;
|
||||
import org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient;*/
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.server.ServerWebExchange;
|
||||
|
||||
@@ -25,6 +25,7 @@ import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.G
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
/*
|
||||
@Component
|
||||
@ConditionalOnProperty(name = ConfigConstants.CONFIG_RIBBON_ISOLATION_ENABLED, havingValue = "true")
|
||||
public class LbIsolationFilter extends LoadBalancerClientFilter {
|
||||
@@ -45,3 +46,4 @@ public class LbIsolationFilter extends LoadBalancerClientFilter {
|
||||
return super.choose(exchange);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
FROM openjdk:8u292
|
||||
|
||||
LABEL MAINTAINER=Andy
|
||||
WORKDIR /apps
|
||||
ADD target/zuul-gateway.jar /apps/
|
||||
CMD ["java","-jar","zuul-gateway.jar"]
|
||||
# docker run --name zuul-gateway \
|
||||
# -e spring_cloud_nacos_server_addr=10.0.0.12:8848 \
|
||||
# -e zlt_datasource_ip=10.0.0.12 \
|
||||
# -e zlt_datasource_username=root \
|
||||
# -e zlt_datasource_password=redhat \
|
||||
# -e spring_redis_host=10.0.0.12 \
|
||||
# -d zuul-gateway:4.5
|
||||
@@ -1,150 +0,0 @@
|
||||
<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>
|
||||
<parent>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-gateway</artifactId>
|
||||
<version>4.6.0</version>
|
||||
</parent>
|
||||
<artifactId>zuul-gateway</artifactId>
|
||||
<description>zuul网关</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 公共实体类模块 -->
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-auth-client-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-ribbon-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-sentinel-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zlt</groupId>
|
||||
<artifactId>zlt-redis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-sentinel-gateway</artifactId>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<!-- 移除tomcat容器-->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- 替换undertow容器 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!-- swagger -->
|
||||
<dependency>
|
||||
<groupId>com.github.zlt2000</groupId>
|
||||
<artifactId>swagger-butler-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>eu.bitwalker</groupId>
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-validator</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.spotify</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<imageName>${docker.image.prefix}/${project.artifactId}</imageName>
|
||||
<imageTags>
|
||||
<imageTag>${project.version}</imageTag>
|
||||
<imageTag>latest</imageTag>
|
||||
</imageTags>
|
||||
<forceTags>true</forceTags>
|
||||
<baseImage>${docker.baseImage}</baseImage>
|
||||
<volumes>${docker.volumes}</volumes>
|
||||
<env>
|
||||
<JAVA_OPTS>${docker.java.opts}</JAVA_OPTS>
|
||||
</env>
|
||||
<entryPoint>["sh","-c","java $JAVA_OPTS ${docker.java.security.egd} -jar /${project.build.finalName}.jar"]</entryPoint>
|
||||
<resources>
|
||||
<resource>
|
||||
<targetPath>/</targetPath>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<include>${project.build.finalName}.jar</include>
|
||||
</resource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.central;
|
||||
|
||||
import com.central.common.ribbon.annotation.EnableBaseFeignInterceptor;
|
||||
import com.central.common.ribbon.annotation.EnableFeignInterceptor;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
*/
|
||||
@EnableZuulProxy
|
||||
@EnableFeignClients
|
||||
@EnableBaseFeignInterceptor
|
||||
@EnableDiscoveryClient
|
||||
@SpringBootApplication
|
||||
public class GatewayApp {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(GatewayApp.class, args);
|
||||
}
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
package com.central.gateway.config;
|
||||
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
|
||||
/**
|
||||
* 跨域配置
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2018/8/9 15:59
|
||||
*/
|
||||
@Configuration
|
||||
public class CorsConfigration {
|
||||
|
||||
@Bean
|
||||
public CorsFilter corsFilter() {
|
||||
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||
CorsConfiguration config = new CorsConfiguration();
|
||||
// #允许向该服务器提交请求的URI,*表示全部允许
|
||||
config.addAllowedOrigin(CorsConfiguration.ALL);
|
||||
// 允许cookies跨域
|
||||
config.setAllowCredentials(true);
|
||||
// #允许访问的头信息,*表示全部
|
||||
config.addAllowedHeader(CorsConfiguration.ALL);
|
||||
// 允许提交请求的方法,*表示全部允许
|
||||
config.addAllowedMethod(CorsConfiguration.ALL);
|
||||
source.registerCorsConfiguration("/**", config);
|
||||
return new CorsFilter(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置过滤器
|
||||
*/
|
||||
@Bean
|
||||
public FilterRegistrationBean someFilterRegistration() {
|
||||
FilterRegistrationBean<CorsFilter> registration = new FilterRegistrationBean<>();
|
||||
registration.setFilter(corsFilter());
|
||||
registration.addUrlPatterns("/*");
|
||||
registration.setName("corsFilter");
|
||||
registration.setOrder(Ordered.HIGHEST_PRECEDENCE);
|
||||
return registration;
|
||||
}
|
||||
}
|
||||
-45
@@ -1,45 +0,0 @@
|
||||
package com.central.gateway.config;
|
||||
|
||||
import com.alibaba.cloud.nacos.NacosConfigProperties;
|
||||
import com.central.gateway.route.nacos.NacosDynRouteLocator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletPath;
|
||||
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 动态路由配置
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2019/8/21
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(prefix = "zlt.gateway.dynamicRoute", name = "enabled", havingValue = "true")
|
||||
public class DynamicZuulRouteConfig {
|
||||
@Autowired
|
||||
private ZuulProperties zuulProperties;
|
||||
|
||||
@Autowired
|
||||
private DispatcherServletPath dispatcherServletPath;
|
||||
|
||||
/**
|
||||
* Nacos实现方式
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(prefix = "zlt.gateway.dynamicRoute", name = "dataType", havingValue = "nacos", matchIfMissing = true)
|
||||
public class NacosZuulRoute {
|
||||
@Autowired
|
||||
private NacosConfigProperties nacosConfigProperties;
|
||||
|
||||
@Autowired
|
||||
private ApplicationEventPublisher publisher;
|
||||
|
||||
@Bean
|
||||
public NacosDynRouteLocator nacosDynRouteLocator() {
|
||||
return new NacosDynRouteLocator(nacosConfigProperties, publisher, dispatcherServletPath.getPrefix(), zuulProperties);
|
||||
}
|
||||
}
|
||||
}
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
package com.central.gateway.config;
|
||||
|
||||
import com.central.common.config.DefaultPasswordConfig;
|
||||
import com.central.oauth2.common.config.DefaultResourceServerConf;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
|
||||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
*/
|
||||
@Configuration
|
||||
@EnableResourceServer
|
||||
@Import({DefaultPasswordConfig.class})
|
||||
public class ResourceServerConfiguration extends DefaultResourceServerConf {
|
||||
@Override
|
||||
public HttpSecurity setAuthenticate(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.AuthorizedUrl authorizedUrl) {
|
||||
return authorizedUrl.access("@permissionService.hasPermission(request, authentication)").and();
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.central.gateway.config;
|
||||
|
||||
import com.didispace.swagger.butler.EnableSwaggerButler;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* swagger 聚合文档配置
|
||||
* zuul routers 映射具体服务的/v2/api-docs swagger
|
||||
*
|
||||
* @author 作者 owen E-mail: 624191343@qq.com
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwaggerButler
|
||||
public class SwaggerConfig {
|
||||
|
||||
}
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
package com.central.gateway.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* zuul路由实体
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2019/8/21
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class ZuulRouteEntity {
|
||||
/**
|
||||
* The ID of the route (the same as its map key by default).
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* The path (pattern) for the route, e.g. /foo/**.
|
||||
*/
|
||||
private String path;
|
||||
/**
|
||||
* The service ID (if any) to map to this route. You can specify a
|
||||
* physical URL or a service, but not both.
|
||||
*/
|
||||
private String serviceId;
|
||||
/**
|
||||
* A full physical URL to map to the route. An alternative is to use a
|
||||
* service ID and service discovery to find the physical address.
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* Flag to determine whether the prefix for this route (the path, minus
|
||||
* pattern patcher) should be stripped before forwarding.
|
||||
*/
|
||||
private boolean stripPrefix = true;
|
||||
/**
|
||||
* Flag to indicate that this route should be retryable (if supported).
|
||||
* Generally retry requires a service ID and ribbon.
|
||||
*/
|
||||
private Boolean retryable;
|
||||
|
||||
private String apiName;
|
||||
|
||||
private boolean enabled = true;
|
||||
|
||||
private boolean customSensitiveHeaders = true;
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.central.gateway.feign;
|
||||
|
||||
import com.central.common.constant.ServiceNameConstants;
|
||||
import com.central.common.model.SysMenu;
|
||||
import com.central.gateway.feign.fallback.MenuServiceFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zlt
|
||||
*/
|
||||
@FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = MenuServiceFallbackFactory.class, decode404 = true)
|
||||
public interface MenuService {
|
||||
/**
|
||||
* 角色菜单列表
|
||||
* @param roleCodes
|
||||
*/
|
||||
@GetMapping(value = "/menus/{roleCodes}")
|
||||
List<SysMenu> findByRoleCodes(@PathVariable("roleCodes") String roleCodes);
|
||||
}
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
package com.central.gateway.feign.fallback;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.central.gateway.feign.MenuService;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* menuService降级工场
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2019/1/18
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MenuServiceFallbackFactory implements FallbackFactory<MenuService> {
|
||||
@Override
|
||||
public MenuService create(Throwable throwable) {
|
||||
return roleIds -> {
|
||||
log.error("调用findByRoleCodes异常:{}", roleIds, throwable);
|
||||
return CollectionUtil.newArrayList();
|
||||
};
|
||||
}
|
||||
}
|
||||
-79
@@ -1,79 +0,0 @@
|
||||
package com.central.gateway.filter.pre;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.central.common.utils.AddrUtil;
|
||||
import com.central.log.monitor.PointUtil;
|
||||
import com.netflix.zuul.ZuulFilter;
|
||||
import com.netflix.zuul.context.RequestContext;
|
||||
import eu.bitwalker.useragentutils.UserAgent;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* 请求统计分析埋点过滤器
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2019/5/6
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class RequestStatisticsFilter extends ZuulFilter {
|
||||
@Override
|
||||
public String filterType() {
|
||||
return FilterConstants.PRE_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int filterOrder() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldFilter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object run() {
|
||||
RequestContext ctx = RequestContext.getCurrentContext();
|
||||
HttpServletRequest req = ctx.getRequest();
|
||||
UserAgent userAgent = UserAgent.parseUserAgentString(req.getHeader("User-Agent"));
|
||||
|
||||
//埋点
|
||||
PointUtil.debug("0", "request-statistics",
|
||||
"ip=" + AddrUtil.getRemoteAddr(req)
|
||||
+ "&browser=" + getBrowser(userAgent.getBrowser().getName())
|
||||
+ "&operatingSystem=" + getOperatingSystem(userAgent.getOperatingSystem().getName()));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getBrowser(String browser) {
|
||||
if (StrUtil.isNotEmpty(browser)) {
|
||||
if (browser.contains("CHROME")) {
|
||||
return "CHROME";
|
||||
} else if (browser.contains("FIREFOX")) {
|
||||
return "FIREFOX";
|
||||
} else if (browser.contains("SAFARI")) {
|
||||
return "SAFARI";
|
||||
} else if (browser.contains("EDGE")) {
|
||||
return "EDGE";
|
||||
}
|
||||
}
|
||||
return browser;
|
||||
}
|
||||
|
||||
private String getOperatingSystem(String operatingSystem) {
|
||||
if (StrUtil.isNotEmpty(operatingSystem)) {
|
||||
if (operatingSystem.contains("MAC_OS_X")) {
|
||||
return "MAC_OS_X";
|
||||
} else if (operatingSystem.contains("ANDROID")) {
|
||||
return "ANDROID";
|
||||
}
|
||||
}
|
||||
return operatingSystem;
|
||||
}
|
||||
}
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
package com.central.gateway.filter.pre;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.central.common.constant.CommonConstant;
|
||||
import com.central.log.properties.TraceProperties;
|
||||
import com.netflix.zuul.ZuulFilter;
|
||||
import com.netflix.zuul.context.RequestContext;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.FORM_BODY_WRAPPER_FILTER_ORDER;
|
||||
|
||||
/**
|
||||
* 生成日志链路追踪id,并传入header中
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2019/8/13
|
||||
*/
|
||||
@Component
|
||||
public class TraceFilter extends ZuulFilter {
|
||||
@Autowired
|
||||
private TraceProperties traceProperties;
|
||||
|
||||
@Override
|
||||
public String filterType() {
|
||||
return FilterConstants.PRE_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int filterOrder() {
|
||||
return FORM_BODY_WRAPPER_FILTER_ORDER - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldFilter() {
|
||||
//根据配置控制是否开启过滤器
|
||||
return traceProperties.getEnable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object run() {
|
||||
//链路追踪id
|
||||
String traceId = IdUtil.fastSimpleUUID();
|
||||
MDC.put(CommonConstant.LOG_TRACE_ID, traceId);
|
||||
RequestContext ctx = RequestContext.getCurrentContext();
|
||||
ctx.addZuulRequestHeader(CommonConstant.TRACE_ID_HEADER, traceId);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
package com.central.gateway.filter.pre;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.central.common.constant.SecurityConstants;
|
||||
import com.central.common.model.SysUser;
|
||||
import com.central.oauth2.common.util.AuthUtils;
|
||||
import com.netflix.zuul.ZuulFilter;
|
||||
import com.netflix.zuul.context.RequestContext;
|
||||
import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
|
||||
import org.springframework.security.authentication.AnonymousAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.FORM_BODY_WRAPPER_FILTER_ORDER;
|
||||
|
||||
/**
|
||||
* 将认证用户的相关信息放入header中, 后端服务可以直接读取使用
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2018/11/20
|
||||
* <p>
|
||||
* Blog: https://zlt2000.gitee.io
|
||||
* Github: https://github.com/zlt2000
|
||||
*/
|
||||
@Component
|
||||
public class UserInfoHeaderFilter extends ZuulFilter {
|
||||
@Override
|
||||
public String filterType() {
|
||||
return FilterConstants.PRE_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int filterOrder() {
|
||||
return FORM_BODY_WRAPPER_FILTER_ORDER - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldFilter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object run() {
|
||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||
if (authentication != null && !(authentication instanceof AnonymousAuthenticationToken)) {
|
||||
Object principal = authentication.getPrincipal();
|
||||
RequestContext ctx = RequestContext.getCurrentContext();
|
||||
//客户端模式只返回一个clientId
|
||||
if (principal instanceof SysUser) {
|
||||
SysUser user = (SysUser)principal;
|
||||
ctx.addZuulRequestHeader(SecurityConstants.USER_ID_HEADER, String.valueOf(user.getId()));
|
||||
ctx.addZuulRequestHeader(SecurityConstants.USER_HEADER, user.getUsername());
|
||||
}
|
||||
OAuth2Authentication oauth2Authentication = (OAuth2Authentication)authentication;
|
||||
String clientId = oauth2Authentication.getOAuth2Request().getClientId();
|
||||
ctx.addZuulRequestHeader(SecurityConstants.TENANT_HEADER, clientId);
|
||||
ctx.addZuulRequestHeader(SecurityConstants.ROLE_HEADER, CollectionUtil.join(authentication.getAuthorities(), ","));
|
||||
String accountType = AuthUtils.getAccountType(oauth2Authentication.getUserAuthentication());
|
||||
ctx.addZuulRequestHeader(SecurityConstants.ACCOUNT_TYPE_HEADER, accountType);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
package com.central.gateway.route;
|
||||
|
||||
import org.springframework.cloud.netflix.zuul.filters.RefreshableRouteLocator;
|
||||
import org.springframework.cloud.netflix.zuul.filters.SimpleRouteLocator;
|
||||
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
|
||||
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties.ZuulRoute;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 扩展 {@link SimpleRouteLocator} 实现动态路由
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2019/8/21
|
||||
*/
|
||||
public abstract class AbstractDynRouteLocator extends SimpleRouteLocator implements RefreshableRouteLocator {
|
||||
private ZuulProperties properties;
|
||||
|
||||
public AbstractDynRouteLocator(String servletPath, ZuulProperties properties) {
|
||||
super(servletPath, properties);
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新路由
|
||||
*/
|
||||
@Override
|
||||
public void refresh() {
|
||||
doRefresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, ZuulRoute> locateRoutes() {
|
||||
LinkedHashMap<String, ZuulRoute> routesMap = new LinkedHashMap<>();
|
||||
// 从application.properties中加载静态路由信息
|
||||
routesMap.putAll(super.locateRoutes());
|
||||
// 从数据源中加载动态路由信息
|
||||
routesMap.putAll(loadDynamicRoute());
|
||||
// 优化一下配置
|
||||
LinkedHashMap<String, ZuulRoute> values = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, ZuulRoute> entry : routesMap.entrySet()) {
|
||||
String path = entry.getKey();
|
||||
// Prepend with slash if not already present.
|
||||
if (!path.startsWith("/")) {
|
||||
path = "/" + path;
|
||||
}
|
||||
if (StringUtils.hasText(this.properties.getPrefix())) {
|
||||
path = this.properties.getPrefix() + path;
|
||||
if (!path.startsWith("/")) {
|
||||
path = "/" + path;
|
||||
}
|
||||
}
|
||||
values.put(path, entry.getValue());
|
||||
}
|
||||
return values;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载路由配置,由子类去实现
|
||||
*/
|
||||
public abstract Map<String, ZuulRoute> loadDynamicRoute();
|
||||
}
|
||||
-113
@@ -1,113 +0,0 @@
|
||||
package com.central.gateway.route.nacos;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.cloud.nacos.NacosConfigProperties;
|
||||
import com.alibaba.nacos.api.config.listener.Listener;
|
||||
import com.alibaba.nacos.api.exception.NacosException;
|
||||
import com.central.common.utils.JsonUtil;
|
||||
import com.central.gateway.config.ZuulRouteEntity;
|
||||
import com.central.gateway.route.AbstractDynRouteLocator;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.netflix.zuul.RoutesRefreshedEvent;
|
||||
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
|
||||
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties.ZuulRoute;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
* Nacos动态路由实现类
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2019/8/22
|
||||
*/
|
||||
@Slf4j
|
||||
public class NacosDynRouteLocator extends AbstractDynRouteLocator {
|
||||
private static final String ZUUL_DATA_ID = "zuul-routes";
|
||||
private static final String ZUUL_GROUP_ID = "ZUUL_GATEWAY";
|
||||
|
||||
private NacosConfigProperties nacosConfigProperties;
|
||||
|
||||
private ApplicationEventPublisher publisher;
|
||||
|
||||
private NacosDynRouteLocator locator;
|
||||
|
||||
@Setter
|
||||
private List<ZuulRouteEntity> zuulRouteEntities;
|
||||
|
||||
public NacosDynRouteLocator(NacosConfigProperties nacosConfigProperties, ApplicationEventPublisher publisher,
|
||||
String servletPath, ZuulProperties properties) {
|
||||
super(servletPath, properties);
|
||||
this.nacosConfigProperties = nacosConfigProperties;
|
||||
this.publisher = publisher;
|
||||
this.locator = this;
|
||||
addListener();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加Nacos监听
|
||||
*/
|
||||
private void addListener() {
|
||||
try {
|
||||
nacosConfigProperties.configServiceInstance().addListener(ZUUL_DATA_ID, ZUUL_GROUP_ID, new Listener() {
|
||||
@Override
|
||||
public Executor getExecutor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveConfigInfo(String configInfo) {
|
||||
//赋值路由信息
|
||||
locator.setZuulRouteEntities(getListByStr(configInfo));
|
||||
RoutesRefreshedEvent routesRefreshedEvent = new RoutesRefreshedEvent(locator);
|
||||
publisher.publishEvent(routesRefreshedEvent);
|
||||
}
|
||||
});
|
||||
} catch (NacosException e) {
|
||||
log.error("nacos-addListener-error", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ZuulProperties.ZuulRoute> loadDynamicRoute() {
|
||||
Map<String, ZuulRoute> routes = new LinkedHashMap<>();
|
||||
if (zuulRouteEntities == null) {
|
||||
zuulRouteEntities = getNacosConfig();
|
||||
}
|
||||
for (ZuulRouteEntity result : zuulRouteEntities) {
|
||||
if (StrUtil.isBlank(result.getPath()) || !result.isEnabled()) {
|
||||
continue;
|
||||
}
|
||||
ZuulRoute zuulRoute = new ZuulRoute();
|
||||
BeanUtil.copyProperties(result, zuulRoute);
|
||||
routes.put(zuulRoute.getPath(), zuulRoute);
|
||||
}
|
||||
return routes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询zuul的路由配置
|
||||
*/
|
||||
private List<ZuulRouteEntity> getNacosConfig() {
|
||||
try {
|
||||
String content = nacosConfigProperties.configServiceInstance().getConfig(ZUUL_DATA_ID, ZUUL_GROUP_ID,5000);
|
||||
return getListByStr(content);
|
||||
} catch (NacosException e) {
|
||||
log.error("listenerNacos-error", e);
|
||||
}
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
|
||||
public List<ZuulRouteEntity> getListByStr(String content) {
|
||||
if (StrUtil.isNotEmpty(content)) {
|
||||
return JsonUtil.toList(content, ZuulRouteEntity.class);
|
||||
}
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
}
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.central.gateway.service.impl;
|
||||
|
||||
import com.central.common.model.SysMenu;
|
||||
import com.central.gateway.feign.MenuService;
|
||||
import com.central.oauth2.common.service.impl.DefaultPermissionServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请求权限判断service
|
||||
*
|
||||
* @author zlt
|
||||
* @date 2018/10/28
|
||||
*/
|
||||
@Slf4j
|
||||
@Service("permissionService")
|
||||
public class PermissionServiceImpl extends DefaultPermissionServiceImpl {
|
||||
@Resource
|
||||
private MenuService menuService;
|
||||
|
||||
@Override
|
||||
public List<SysMenu> findMenuByRoleCodes(String roleCodes) {
|
||||
return menuService.findByRoleCodes(roleCodes);
|
||||
}
|
||||
|
||||
public boolean hasPermission(HttpServletRequest request, Authentication authentication) {
|
||||
return hasPermission(authentication, request.getMethod(), request.getRequestURI());
|
||||
}
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"properties": [
|
||||
{
|
||||
"name": "zlt.gateway.dynamicRoute.enabled",
|
||||
"description": "是否开启动态路由.",
|
||||
"type": "java.lang.Boolean",
|
||||
"defaultValue": false
|
||||
},
|
||||
{
|
||||
"name": "zlt.gateway.dynamicRoute.dataType",
|
||||
"description": "动态路由的数据类型.",
|
||||
"type": "java.lang.String",
|
||||
"defaultValue": "nacos"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
#spring:
|
||||
# sentinel动态配置规则
|
||||
# cloud:
|
||||
# sentinel:
|
||||
# zuul:
|
||||
# enabled: true
|
||||
# order:
|
||||
# pre: 2000
|
||||
# post: 500
|
||||
# error: -100
|
||||
# filter:
|
||||
# enabled: false
|
||||
# datasource:
|
||||
# 限流
|
||||
# ds1:
|
||||
# nacos:
|
||||
# server-addr: ${spring.cloud.nacos.server-addr}
|
||||
# dataId: ${spring.application.name}-sentinel-gw-flow
|
||||
# groupId: DEFAULT_GROUP
|
||||
# rule-type: gw-flow
|
||||
# api分组
|
||||
# ds2:
|
||||
# nacos:
|
||||
# server-addr: ${spring.cloud.nacos.server-addr}
|
||||
# dataId: ${spring.application.name}-sentinel-gw-api-group
|
||||
# groupId: DEFAULT_GROUP
|
||||
# rule-type: gw-api-group
|
||||
|
||||
zlt:
|
||||
oauth2:
|
||||
token:
|
||||
store:
|
||||
type: redis
|
||||
security:
|
||||
ignore:
|
||||
# 忽略认证的地址
|
||||
httpUrls: >
|
||||
/api-uaa/oauth/**,
|
||||
/api-uaa/validata/**,
|
||||
/api-uaa/css/**,
|
||||
/api-uaa/images/**,
|
||||
/api-uaa/js/**,
|
||||
/api-user/users-anon/**,
|
||||
/login.html,
|
||||
/user/login
|
||||
auth:
|
||||
urlPermission:
|
||||
#是否开启url级别权限
|
||||
enable: false
|
||||
#配置只进行登录认证,不进行url权限认证的api
|
||||
ignoreUrls: >
|
||||
/api-user/menus/current,
|
||||
/api-user/users/current,
|
||||
/api-log/requestStat
|
||||
#白名单
|
||||
includeClientIds:
|
||||
- webApp
|
||||
renew:
|
||||
#是否开启token自动续签(目前只有redis实现)
|
||||
enable: true
|
||||
#白名单
|
||||
includeClientIds:
|
||||
- webApp
|
||||
gateway:
|
||||
#网关动态路由
|
||||
dynamicRoute:
|
||||
enabled: true
|
||||
|
||||
|
||||
zuul:
|
||||
ribbon-isolation-strategy: thread
|
||||
ribbon:
|
||||
eager-load:
|
||||
enabled: true
|
||||
threadPool:
|
||||
useSeparateThreadPools: true
|
||||
threadPoolKeyPrefix: api-gateway
|
||||
#关闭重试
|
||||
retryable: false
|
||||
ignored-headers: Access-Control-Allow-Credentials,Access-Control-Allow-Origin,Access-Control-Allow-Methods
|
||||
add-host-header: true
|
||||
routes:
|
||||
auth:
|
||||
path: /api-uaa/**
|
||||
service-id: uaa-server
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
auth-login-page:
|
||||
path: /login.html
|
||||
service-id: uaa-server
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
auth-login-process:
|
||||
path: /user/login
|
||||
service-id: uaa-server
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
auth-login-token:
|
||||
path: /oauth/token
|
||||
service-id: uaa-server
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
auth-login-authorize:
|
||||
path: /oauth/authorize
|
||||
service-id: uaa-server
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
auth-check-process:
|
||||
path: /oauth/check_token
|
||||
service-id: uaa-server
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
user:
|
||||
path: /api-user/**
|
||||
service-id: user-center
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
file:
|
||||
path: /api-file/**
|
||||
service-id: file-center
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
log:
|
||||
path: /api-log/**
|
||||
service-id: log-center
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
generator:
|
||||
path: /api-generator/**
|
||||
service-id: code-generator
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
search:
|
||||
path: /api-search/**
|
||||
service-id: search-center
|
||||
strip-prefix: true
|
||||
sensitive-headers: '*'
|
||||
custom-sensitive-headers: true
|
||||
ssl-hostname-validation-enabled: false
|
||||
|
||||
hystrix:
|
||||
threadpool:
|
||||
default:
|
||||
coreSize: 100
|
||||
maximumSize: 2000
|
||||
allowMaximumSizeToDivergeFromCoreSize: true
|
||||
maxQueueSize: -1
|
||||
command:
|
||||
default:
|
||||
execution:
|
||||
isolation:
|
||||
thread:
|
||||
timeoutInMilliseconds: 60000
|
||||
|
||||
swagger:
|
||||
butler:
|
||||
auto-generate-from-zuul-routes: true
|
||||
generate-routes: user,file
|
||||
apiDocsPath: v2/api-docs
|
||||
@@ -1,9 +0,0 @@
|
||||
server:
|
||||
port: 9900
|
||||
undertow:
|
||||
buffer-size: 1024
|
||||
direct-buffers: true
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: api-gateway
|
||||
@@ -1,9 +0,0 @@
|
||||
-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjmgfejBXsPYynAIPczHA
|
||||
eEvTDfAVaNKQudyI7VszdezbHDM1CStCIgwiMmLd7QYf1SrrmQoqxhcSRbhjE3ej
|
||||
RF5qzhtx3kmepdpMrQptcsLjRkixaxCc4E2k6Us5707gGwbhoaTrRit5F2MnAdLY
|
||||
C1TS3WwnO/hQfqUcAglbK8yrJ4AwAv0DAoIUSWnWqzuniV1SYbdV57uswxUssoWy
|
||||
sEfPz+nv1ZLRs6Wz4eQ5Myqx2+CjWc9F8iXa2PV8Rmjms3dVbWcLUpCP18Dfzp8l
|
||||
n8vF9LfYB7UaLSpfJe6FFF6+vCg4JHfo12djTUgwGjauMF3e9mmjU83KIoQS66lp
|
||||
AQIDAQAB
|
||||
-----END PUBLIC KEY-----
|
||||
Reference in New Issue
Block a user