fix: bypass auth for aslan stats endpoint
This commit is contained in:
parent
c3d5784b91
commit
2f5615ad61
@ -50,6 +50,10 @@ import reactor.core.publisher.Mono;
|
||||
@RequiredArgsConstructor
|
||||
public class AuthGlobalFilter implements GlobalFilter, Ordered {
|
||||
|
||||
private static final List<String> FORCE_IGNORE_PATHS = List.of(
|
||||
"/console/datav/aslan/integrated-statistics"
|
||||
);
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
private final GatewayProperties gatewayProperties;
|
||||
private final AuthEndpointService authEndpointService;
|
||||
@ -211,9 +215,16 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
|
||||
private boolean isIgnoreMatcherPath(ServerWebExchange exchange) {
|
||||
String url = exchange.getRequest().getURI().getRawPath();
|
||||
log.debug(url);
|
||||
if (matchIgnorePath(FORCE_IGNORE_PATHS, url)) {
|
||||
return true;
|
||||
}
|
||||
List<String> ignorePaths = gatewayProperties.getIgnorePaths();
|
||||
log.debug(ignorePaths.toString());
|
||||
for (String ignoreUrl : ignorePaths) {
|
||||
return matchIgnorePath(ignorePaths, url);
|
||||
}
|
||||
|
||||
private boolean matchIgnorePath(List<String> ignorePaths, String url) {
|
||||
for (String ignoreUrl : Optional.ofNullable(ignorePaths).orElse(List.of())) {
|
||||
if (pathMatcher.match(ignoreUrl, url)) {
|
||||
log.debug("true : {}{}",url, ignoreUrl);
|
||||
return true;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user