Release 2.2.0-beta9
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<groupId>com.fizzgate</groupId>
|
<groupId>com.fizzgate</groupId>
|
||||||
<artifactId>fizz-bootstrap</artifactId>
|
<artifactId>fizz-bootstrap</artifactId>
|
||||||
<version>2.2.0-beta8</version>
|
<version>2.2.0-beta9</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>fizz-gateway-community</artifactId>
|
<artifactId>fizz-gateway-community</artifactId>
|
||||||
<groupId>com.fizzgate</groupId>
|
<groupId>com.fizzgate</groupId>
|
||||||
<version>2.2.0-beta8</version>
|
<version>2.2.0-beta9</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>fizz-gateway-community</artifactId>
|
<artifactId>fizz-gateway-community</artifactId>
|
||||||
<groupId>com.fizzgate</groupId>
|
<groupId>com.fizzgate</groupId>
|
||||||
<version>2.2.0-beta8</version>
|
<version>2.2.0-beta9</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -17,15 +17,13 @@
|
|||||||
|
|
||||||
package we.filter;
|
package we.filter;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.context.ApplicationContext;
|
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.server.ServerWebExchange;
|
import org.springframework.web.server.ServerWebExchange;
|
||||||
import org.springframework.web.server.WebFilterChain;
|
import org.springframework.web.server.WebFilterChain;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
import we.plugin.FixedPluginFilter;
|
||||||
import we.plugin.FizzPluginFilterChain;
|
import we.plugin.FizzPluginFilterChain;
|
||||||
import we.plugin.PluginFilter;
|
import we.plugin.PluginFilter;
|
||||||
import we.plugin.auth.ApiConfig;
|
import we.plugin.auth.ApiConfig;
|
||||||
@@ -37,6 +35,7 @@ import we.util.WebUtils;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@@ -75,15 +74,22 @@ public class PreprocessFilter extends FizzWebFilter {
|
|||||||
if (authRes instanceof ApiConfig) {
|
if (authRes instanceof ApiConfig) {
|
||||||
ApiConfig ac = (ApiConfig) authRes;
|
ApiConfig ac = (ApiConfig) authRes;
|
||||||
afterAuth(exchange, ac);
|
afterAuth(exchange, ac);
|
||||||
|
m = executeFixedPluginFilters(exchange);
|
||||||
|
m = m.defaultIfEmpty(ReactorUtils.NULL);
|
||||||
if (ac.pluginConfigs == null || ac.pluginConfigs.isEmpty()) {
|
if (ac.pluginConfigs == null || ac.pluginConfigs.isEmpty()) {
|
||||||
return m.flatMap(func(exchange, chain));
|
return m.flatMap(func(exchange, chain));
|
||||||
} else {
|
} else {
|
||||||
|
return m.flatMap(
|
||||||
|
nil -> {
|
||||||
eas.put(FizzPluginFilterChain.WEB_FILTER_CHAIN, chain);
|
eas.put(FizzPluginFilterChain.WEB_FILTER_CHAIN, chain);
|
||||||
return FizzPluginFilterChain.next(exchange);
|
return FizzPluginFilterChain.next(exchange);
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
} else if (authRes == ApiConfigService.Access.YES) {
|
} else if (authRes == ApiConfigService.Access.YES) {
|
||||||
afterAuth(exchange, null);
|
afterAuth(exchange, null);
|
||||||
return m.flatMap(func(exchange, chain));
|
m = executeFixedPluginFilters(exchange);
|
||||||
|
return m.defaultIfEmpty(ReactorUtils.NULL).flatMap(func(exchange, chain));
|
||||||
} else {
|
} else {
|
||||||
String err = null;
|
String err = null;
|
||||||
if (authRes instanceof ApiConfigService.Access) {
|
if (authRes instanceof ApiConfigService.Access) {
|
||||||
@@ -138,4 +144,18 @@ public class PreprocessFilter extends FizzWebFilter {
|
|||||||
return chain.filter(exchange);
|
return chain.filter(exchange);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Mono<Void> executeFixedPluginFilters(ServerWebExchange exchange) {
|
||||||
|
Mono vm = Mono.empty();
|
||||||
|
List<FixedPluginFilter> fixedPluginFilters = FixedPluginFilter.getPluginFilters();
|
||||||
|
for (byte i = 0; i < fixedPluginFilters.size(); i++) {
|
||||||
|
FixedPluginFilter fpf = fixedPluginFilters.get(i);
|
||||||
|
vm = vm.defaultIfEmpty(ReactorUtils.NULL).flatMap(
|
||||||
|
v -> {
|
||||||
|
return fpf.filter(exchange, null, null);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import java.util.*;
|
|||||||
* @author hongqiaowei
|
* @author hongqiaowei
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public abstract class FixedPluginFilter extends PluginFilter {
|
public abstract class FixedPluginFilter extends PluginFilter {
|
||||||
|
|
||||||
private static final Logger log = LoggerFactory.getLogger(FixedPluginFilter.class);
|
private static final Logger log = LoggerFactory.getLogger(FixedPluginFilter.class);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>fizz-gateway-community</artifactId>
|
<artifactId>fizz-gateway-community</artifactId>
|
||||||
<groupId>com.fizzgate</groupId>
|
<groupId>com.fizzgate</groupId>
|
||||||
<version>2.2.0-beta8</version>
|
<version>2.2.0-beta9</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>fizz-gateway-community</artifactId>
|
<artifactId>fizz-gateway-community</artifactId>
|
||||||
<groupId>com.fizzgate</groupId>
|
<groupId>com.fizzgate</groupId>
|
||||||
<version>2.2.0-beta8</version>
|
<version>2.2.0-beta9</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -31,7 +31,7 @@
|
|||||||
<artifactId>fizz-gateway-community</artifactId>
|
<artifactId>fizz-gateway-community</artifactId>
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<description>fizz gateway community</description>
|
<description>fizz gateway community</description>
|
||||||
<version>2.2.0-beta8</version>
|
<version>2.2.0-beta9</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>fizz-common</module>
|
<module>fizz-common</module>
|
||||||
|
|||||||
Reference in New Issue
Block a user