Fix route forbidden not take effect
This commit is contained in:
@@ -408,7 +408,7 @@ public class ApiConfigService implements ApplicationListener<ContextRefreshedEve
|
|||||||
if (clientCanAccess.isEmpty()) {
|
if (clientCanAccess.isEmpty()) {
|
||||||
StringBuilder b = ThreadContext.getStringBuilder();
|
StringBuilder b = ThreadContext.getStringBuilder();
|
||||||
// b.append("app ").append(app).append(" can't access ").append(JacksonUtils.writeValueAsString(apiConfigs));
|
// b.append("app ").append(app).append(" can't access ").append(JacksonUtils.writeValueAsString(apiConfigs));
|
||||||
b.append("app ").append(app).append(" can't access matching route");
|
b.append("app ").append(app).append(" can't access matching routes");
|
||||||
return Result.fail(b.toString());
|
return Result.fail(b.toString());
|
||||||
}
|
}
|
||||||
ApiConfig bestOne = clientCanAccess.get(0);
|
ApiConfig bestOne = clientCanAccess.get(0);
|
||||||
@@ -431,7 +431,13 @@ public class ApiConfigService implements ApplicationListener<ContextRefreshedEve
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (bestOne.allowAccess) {
|
||||||
return Result.succ(bestOne);
|
return Result.succ(bestOne);
|
||||||
|
} else {
|
||||||
|
StringBuilder b = ThreadContext.getStringBuilder();
|
||||||
|
b.append("app ").append(app).append(" can't access matching route");
|
||||||
|
return Result.fail(b.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Mono<Result<ApiConfig>> auth(ServerWebExchange exchange) {
|
public Mono<Result<ApiConfig>> auth(ServerWebExchange exchange) {
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ public class ServiceConfig {
|
|||||||
Set<ApiConfig> apiConfigs = entry.getValue();
|
Set<ApiConfig> apiConfigs = entry.getValue();
|
||||||
if (pathPattern.equals(path)) {
|
if (pathPattern.equals(path)) {
|
||||||
for (ApiConfig ac : apiConfigs) {
|
for (ApiConfig ac : apiConfigs) {
|
||||||
if (ac.allowAccess) {
|
// if (ac.allowAccess) {
|
||||||
/*if (!clear && !result.isEmpty()) {
|
/*if (!clear && !result.isEmpty()) {
|
||||||
result.clear();
|
result.clear();
|
||||||
clear = true;
|
clear = true;
|
||||||
@@ -144,14 +144,14 @@ public class ServiceConfig {
|
|||||||
result.add(ac);
|
result.add(ac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
/*if (clear && !result.isEmpty()) {
|
/*if (clear && !result.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
} else if (UrlTransformUtils.ANT_PATH_MATCHER.match(pathPattern, path)) {
|
} else if (UrlTransformUtils.ANT_PATH_MATCHER.match(pathPattern, path)) {
|
||||||
for (ApiConfig ac : apiConfigs) {
|
for (ApiConfig ac : apiConfigs) {
|
||||||
if (ac.allowAccess) {
|
// if (ac.allowAccess) {
|
||||||
if (dedicatedLineRequest) {
|
if (dedicatedLineRequest) {
|
||||||
if (ac.dedicatedLine) {
|
if (ac.dedicatedLine) {
|
||||||
result.add(ac);
|
result.add(ac);
|
||||||
@@ -161,7 +161,7 @@ public class ServiceConfig {
|
|||||||
result.add(ac);
|
result.add(ac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // end for
|
} // end for
|
||||||
|
|||||||
Reference in New Issue
Block a user