|
37 | 37 | import org.apache.logging.log4j.LogManager; |
38 | 38 | import org.apache.logging.log4j.Logger; |
39 | 39 | import org.bouncycastle.jce.provider.BouncyCastleProvider; |
| 40 | +import org.springdoc.core.GroupedOpenApi; |
40 | 41 | import org.springframework.beans.factory.annotation.Autowired; |
41 | 42 | import org.springframework.boot.SpringApplication; |
42 | 43 | import org.springframework.boot.actuate.health.Health; |
|
71 | 72 | import java.nio.file.Files; |
72 | 73 | import java.nio.file.Paths; |
73 | 74 | import java.security.Security; |
| 75 | +import java.util.Arrays; |
| 76 | +import java.util.HashSet; |
74 | 77 | import java.util.List; |
75 | 78 | import java.util.Objects; |
76 | 79 | import java.util.Properties; |
| 80 | +import java.util.Set; |
77 | 81 | import java.util.concurrent.Executor; |
78 | 82 |
|
79 | 83 | import static eu.openanalytics.containerproxy.api.ApiSecurityService.PROP_API_SECURITY_HIDE_SPEC_DETAILS; |
@@ -345,4 +349,24 @@ private static void setDefaultProperties(SpringApplication app) { |
345 | 349 | System.setProperty("jdk.serialSetFilterAfterRead", "true"); |
346 | 350 | } |
347 | 351 |
|
| 352 | + @Bean |
| 353 | + public GroupedOpenApi groupOpenApi() { |
| 354 | + return GroupedOpenApi.builder() |
| 355 | + .group("v1") |
| 356 | + .addOpenApiCustomiser(openApi -> { |
| 357 | + Set<String> endpoints = new HashSet<>(Arrays.asList("/app_direct_i/**", "/app_direct/**", "/app_proxy/{proxyId}/**", "/error")); |
| 358 | + openApi.getPaths().entrySet().stream().filter(p -> endpoints.contains(p.getKey())) |
| 359 | + .forEach(p -> { |
| 360 | + p.getValue().setHead(null); |
| 361 | + p.getValue().setPost(null); |
| 362 | + p.getValue().setDelete(null); |
| 363 | + p.getValue().setParameters(null); |
| 364 | + p.getValue().setOptions(null); |
| 365 | + p.getValue().setPut(null); |
| 366 | + p.getValue().setPatch(null); |
| 367 | + }); |
| 368 | + }) |
| 369 | + .build(); |
| 370 | + } |
| 371 | + |
348 | 372 | } |
0 commit comments