diff --git a/NOTICE b/NOTICE index 272ebcd4e84050880e376d8db47a4988981ccc40..442340903b2613bed655981bd66b55f4b6cb2ac5 100644 --- a/NOTICE +++ b/NOTICE @@ -39,6 +39,7 @@ The following software have components provided under the terms of this license: - Maven Monitor (from https://repo1.maven.org/maven2/org/apache/maven/maven-monitor) - Maven Plugin Descriptor Model (from https://repo1.maven.org/maven2/org/apache/maven/maven-plugin-descriptor) - Maven Plugin Parameter Documenter API (from https://repo1.maven.org/maven2/org/apache/maven/maven-plugin-parameter-documenter) +- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -361,6 +362,7 @@ The following software have components provided under the terms of this license: - Asynchronous Http Client Netty Utils (from https://repo1.maven.org/maven2/org/asynchttpclient/async-http-client-netty-utils) - AutoValue Annotations (from https://github.com/google/auto/tree/master/value, https://repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations) - BSON (from http://bsonspec.org, https://bsonspec.org) +- BSON Record Codec (from https://www.mongodb.com/) - Bean Validation API (from http://beanvalidation.org) - Brave (from https://repo1.maven.org/maven2/io/zipkin/brave/brave) - Brave Instrumentation: Http Adapters (from https://repo1.maven.org/maven2/io/zipkin/brave/brave-instrumentation-http) @@ -394,7 +396,9 @@ The following software have components provided under the terms of this license: - Expression Language 3.0 (from http://el-spec.java.net, http://uel.java.net, https://projects.eclipse.org/projects/ee4j.el) - FindBugs-jsr305 (from http://findbugs.sourceforge.net/) - Flapdoodle Embedded MongoDB (from http://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo) +- Flapdoodle Embedded MongoDB Package Resolver (from http://github.com/flapdoodle-oss/de.flapdoodle.embed.mongo.packageresolver) - Flapdoodle Embedded Process Util (from http://github.com/flapdoodle-oss/de.flapdoodle.embed.process) +- Flapdoodle OS Detection Library (from http://github.com/flapdoodle-oss/de.flapdoodle.os) - GSON extensions to the Google HTTP Client Library for Java. (from https://repo1.maven.org/maven2/com/google/http-client/google-http-client-gson) - Google APIs Client Library for Java (from https://repo1.maven.org/maven2/com/google/api-client/google-api-client) - Google App Engine extensions to the Google HTTP Client Library for Java. (from https://repo1.maven.org/maven2/com/google/http-client/google-http-client-appengine) @@ -466,6 +470,8 @@ The following software have components provided under the terms of this license: - KeePassJava2 :: Simple (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-simple) - Kotlin Stdlib (from https://kotlinlang.org/, https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib) - Kotlin Stdlib Common (from https://kotlinlang.org/) +- Kotlin Stdlib Jdk7 (from https://kotlinlang.org/) +- Kotlin Stdlib Jdk8 (from https://kotlinlang.org/) - Lang (from https://repo1.maven.org/maven2/commons-lang/commons-lang) - LatencyUtils (from http://latencyutils.github.io/LatencyUtils/) - MapStruct Core (from http://mapstruct.org/mapstruct/, https://repo1.maven.org/maven2/org/mapstruct/mapstruct) @@ -484,6 +490,7 @@ The following software have components provided under the terms of this license: - Maven Repository Metadata Model (from https://repo1.maven.org/maven2/org/apache/maven/maven-repository-metadata) - Maven Settings (from https://repo1.maven.org/maven2/org/apache/maven/maven-settings) - Metrics Core (from https://repo1.maven.org/maven2/io/dropwizard/metrics/metrics-core) +- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -505,6 +512,7 @@ The following software have components provided under the terms of this license: - Netty/Common (from https://repo1.maven.org/maven2/io/netty/netty-common) - Netty/Handler (from https://repo1.maven.org/maven2/io/netty/netty-handler) - Netty/Handler/Proxy (from https://repo1.maven.org/maven2/io/netty/netty-handler-proxy) +- Netty/Incubator/Codec/Classes/Quic (from https://repo1.maven.org/maven2/io/netty/incubator/netty-incubator-codec-classes-quic) - Netty/Resolver (from https://repo1.maven.org/maven2/io/netty/netty-resolver) - Netty/Resolver/DNS (from https://repo1.maven.org/maven2/io/netty/netty-resolver-dns) - Netty/Resolver/DNS/Classes/MacOS (from https://repo1.maven.org/maven2/io/netty/netty-resolver-dns-classes-macos) @@ -585,6 +593,7 @@ The following software have components provided under the terms of this license: - Spring Web (from http://www.springframework.org, https://github.com/spring-projects/spring-framework, https://repo1.maven.org/maven2/org/springframework/spring-web) - Spring Web MVC (from https://github.com/spring-projects/spring-framework, https://repo1.maven.org/maven2/org/springframework/spring-webmvc) - Spring WebFlux (from https://github.com/spring-projects/spring-framework) +- Swagger UI (from http://webjars.org) - Vavr (from http://vavr.io, https://www.vavr.io) - Vavr Match (from http://vavr.io) - Woodstox (from https://github.com/FasterXML/woodstox) @@ -640,6 +649,9 @@ The following software have components provided under the terms of this license: - spring-security-oauth2-core (from http://spring.io/spring-security, https://spring.io/projects/spring-security, https://spring.io/spring-security) - spring-security-oauth2-jose (from http://spring.io/spring-security, https://spring.io/projects/spring-security, https://spring.io/spring-security) - spring-security-test (from http://spring.io/spring-security, https://spring.io/projects/spring-security, https://spring.io/spring-security) +- springdoc-openapi-common (from https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-common) +- springdoc-openapi-ui (from https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-ui) +- springdoc-openapi-webmvc-core (from https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-webmvc-core) - springfox-bean-validators (from https://github.com/springfox/springfox) - springfox-boot-starter (from https://github.com/springfox/springfox) - springfox-core (from https://github.com/springfox/springfox) @@ -654,9 +666,9 @@ The following software have components provided under the terms of this license: - springfox-swagger-ui (from https://github.com/springfox/springfox) - springfox-swagger2 (from https://github.com/springfox/springfox) - swagger-annotations (from https://repo1.maven.org/maven2/io/swagger/core/v3/swagger-annotations, https://repo1.maven.org/maven2/io/swagger/swagger-annotations) -- swagger-core (from https://repo1.maven.org/maven2/io/swagger/swagger-core) +- swagger-core (from https://repo1.maven.org/maven2/io/swagger/core/v3/swagger-core, https://repo1.maven.org/maven2/io/swagger/swagger-core) - swagger-jaxrs (from https://repo1.maven.org/maven2/io/swagger/swagger-jaxrs) -- swagger-models (from https://repo1.maven.org/maven2/io/swagger/core/v3/swagger-models) +- swagger-models (from https://repo1.maven.org/maven2/io/swagger/core/v3/swagger-models, https://repo1.maven.org/maven2/io/swagger/swagger-models) - tomcat-embed-core (from http://tomcat.apache.org/) - tomcat-embed-el (from http://tomcat.apache.org/, https://tomcat.apache.org/) - tomcat-embed-websocket (from http://tomcat.apache.org/, https://tomcat.apache.org/) @@ -712,6 +724,7 @@ The following software have components provided under the terms of this license: - Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api) - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca) - Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) +- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -734,6 +747,7 @@ Beerware ======================================================================== The following software have components provided under the terms of this license: +- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -759,6 +773,7 @@ CC-BY-4.0 ======================================================================== The following software have components provided under the terms of this license: +- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -828,10 +843,12 @@ The following software have components provided under the terms of this license: - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca) - Jakarta Bean Validation API (from https://beanvalidation.org) - Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) +- Logback Classic Module (from http://logback.qos.ch, https://repo1.maven.org/maven2/ch/qos/logback/logback-classic) - Logback Contrib :: JSON :: Classic (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-json-classic) - Logback Contrib :: JSON :: Core (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-json-core) - Logback Contrib :: Jackson (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-jackson) - Logback Core Module (from http://logback.qos.ch, https://repo1.maven.org/maven2/ch/qos/logback/logback-core) +- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -953,8 +970,6 @@ The following software have components provided under the terms of this license: ======================================================================== JSON ======================================================================== -The following software have components provided under the terms of this license: - - JSON in Java (from https://github.com/douglascrockford/JSON-java) ======================================================================== @@ -974,10 +989,12 @@ The following software have components provided under the terms of this license: - Java Native Access Platform (from https://github.com/java-native-access/jna) - Javassist (from http://www.javassist.org/) - Lang (from https://repo1.maven.org/maven2/commons-lang/commons-lang) +- Logback Classic Module (from http://logback.qos.ch, https://repo1.maven.org/maven2/ch/qos/logback/logback-classic) - Logback Contrib :: JSON :: Classic (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-json-classic) - Logback Contrib :: JSON :: Core (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-json-core) - Logback Contrib :: Jackson (from https://repo1.maven.org/maven2/ch/qos/logback/contrib/logback-jackson) - Logback Core Module (from http://logback.qos.ch, https://repo1.maven.org/maven2/ch/qos/logback/logback-core) +- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Log4j 2 Appender (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -988,9 +1005,17 @@ LGPL-2.1-or-later The following software have components provided under the terms of this license: - Java Native Access (from https://github.com/java-native-access/jna, https://github.com/twall/jna, https://repo1.maven.org/maven2/net/java/dev/jna/jna) +- Java Native Access Platform (from https://github.com/java-native-access/jna) - Javassist (from http://www.javassist.org/) - SnakeYAML (from http://code.google.com/p/snakeyaml/, http://www.snakeyaml.org, https://bitbucket.org/snakeyaml/snakeyaml) +======================================================================== +LGPL-3.0-only +======================================================================== +The following software have components provided under the terms of this license: + +- Logback Classic Module (from http://logback.qos.ch, https://repo1.maven.org/maven2/ch/qos/logback/logback-classic) + ======================================================================== MIT ======================================================================== @@ -1018,6 +1043,7 @@ The following software have components provided under the terms of this license: - Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec) - Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java) - Java JWT (from http://www.jwt.io, https://github.com/auth0/java-jwt) +- Microsoft Application Insights Java Agent (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Core (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Spring Boot starter (from https://github.com/Microsoft/ApplicationInsights-Java) - Microsoft Application Insights Java SDK Web Module (from https://github.com/Microsoft/ApplicationInsights-Java) @@ -1055,6 +1081,7 @@ The following software have components provided under the terms of this license: - msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java) - msal4j-persistence-extension (from https://github.com/AzureAD/microsoft-authentication-extensions-for-java) - qpid-proton-j-extensions (from https://github.com/Azure/qpid-proton-j-extensions) +- webjars-locator-core (from http://webjars.org) ======================================================================== MPL-1.1 @@ -1140,6 +1167,13 @@ The following software have components provided under the terms of this license: - Guava: Google Core Libraries for Java (from http://code.google.com/p/guava-libraries, https://github.com/google/guava, https://repo1.maven.org/maven2/com/google/guava/guava) - MongoDB Java Driver (from http://mongodb.org/, http://www.mongodb.org, https://www.mongodb.com/) +======================================================================== +bzip2-1.0.6 +======================================================================== +The following software have components provided under the terms of this license: + +- Apache Commons Compress (from http://commons.apache.org/compress/, http://commons.apache.org/proper/commons-compress/, https://commons.apache.org/proper/commons-compress/) + ======================================================================== cc-pd ======================================================================== @@ -1162,6 +1196,8 @@ The following software have components provided under the terms of this license: - Bouncy Castle Provider (from http://www.bouncycastle.org/java.html, https://www.bouncycastle.org/java.html) - Guava: Google Core Libraries for Java (from http://code.google.com/p/guava-libraries, https://github.com/google/guava, https://repo1.maven.org/maven2/com/google/guava/guava) - HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/) +- JBoss Logging 3 (from http://www.jboss.org) +- JSON in Java (from https://github.com/douglascrockford/JSON-java) - JTidy (from http://jtidy.sourceforge.net) - LatencyUtils (from http://latencyutils.github.io/LatencyUtils/) - PostgreSQL JDBC Driver diff --git a/devops/azure/chart/templates/istio-auth-policy.yaml b/devops/azure/chart/templates/istio-auth-policy.yaml index c74fcb629638cced0b6113d26ab3b58eee8ccc06..f2be799bcb00072723ae26ecbc2cf65a5bdd9cdb 100644 --- a/devops/azure/chart/templates/istio-auth-policy.yaml +++ b/devops/azure/chart/templates/istio-auth-policy.yaml @@ -34,4 +34,7 @@ spec: "*/swagger","*/swagger-ui.html","*/swagger-resources", "*/actuator/health", "*/_ah/readiness_check", "*/_ah/liveness_check", "/api/{{ .Chart.Name }}/v1/swagger-resources/*", - "/api/{{ .Chart.Name }}/v1/webjars/*"] + "/api/{{ .Chart.Name }}/v1/webjars/*", + "/api/{{ .Chart.Name }}/v1/swagger-ui/index.css", + "/api/{{ .Chart.Name }}/v1/swagger-ui/swagger-initializer.js", + "/api/{{ .Chart.Name }}/v1/v3/api-docs/swagger-config"] diff --git a/legal-core/pom.xml b/legal-core/pom.xml index 6e86920f8c03db7c4ec269cb308df148e94d7ef7..06d7b2a422cc16f70388251322a6f12277eb840f 100644 --- a/legal-core/pom.xml +++ b/legal-core/pom.xml @@ -16,7 +16,7 @@ <description>Legal service core</description> <properties> - <jackson-databind.version>2.13.2.2</jackson-databind.version> + <jackson-databind.version>2.13.4</jackson-databind.version> <jackson.version>2.13.2</jackson.version> <spring-webmvc.version>5.3.22</spring-webmvc.version> </properties> @@ -64,7 +64,7 @@ <dependency> <groupId>com.google.api.grpc</groupId> <artifactId>proto-google-common-protos</artifactId> - <version>1.16.0</version> + <version>2.9.6</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> @@ -108,7 +108,7 @@ <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-text</artifactId> - <version>1.9</version> + <version>1.10.0</version> </dependency> <!--explicitly load latest compatible version with security fix in it--> diff --git a/legal-core/src/main/java/org/opengroup/osdu/legal/middleware/GlobalErrorHandler.java b/legal-core/src/main/java/org/opengroup/osdu/legal/middleware/GlobalErrorHandler.java index 901ec513499a64a373a2ebc626ff27763e473c70..d20504fe2c7dc325815996d7a012b9800d826194 100644 --- a/legal-core/src/main/java/org/opengroup/osdu/legal/middleware/GlobalErrorHandler.java +++ b/legal-core/src/main/java/org/opengroup/osdu/legal/middleware/GlobalErrorHandler.java @@ -1,6 +1,7 @@ package org.opengroup.osdu.legal.middleware; import com.google.gson.Gson; +import io.swagger.v3.oas.annotations.Hidden; import org.opengroup.osdu.core.common.model.http.AppException; import org.springframework.boot.web.servlet.error.ErrorController; import org.springframework.http.HttpStatus; @@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +@Hidden @RestController public class GlobalErrorHandler implements ErrorController { @@ -34,9 +36,4 @@ public class GlobalErrorHandler implements ErrorController { throw new AppException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Server error", "An unknown error has occurred."); } - @Override - public String getErrorPath() { - return "/error"; - } - } \ No newline at end of file diff --git a/legal-core/src/main/java/org/opengroup/osdu/legal/swagger/SpringfoxSwaggerHostResolver.java b/legal-core/src/main/java/org/opengroup/osdu/legal/swagger/SpringfoxSwaggerHostResolver.java deleted file mode 100644 index 7addb2c112382e6be197fc4069376d2a8f58e67c..0000000000000000000000000000000000000000 --- a/legal-core/src/main/java/org/opengroup/osdu/legal/swagger/SpringfoxSwaggerHostResolver.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.opengroup.osdu.legal.swagger; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.core.Ordered; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; -import io.swagger.v3.oas.models.servers.Server; -import io.swagger.v3.oas.models.OpenAPI; -import springfox.documentation.oas.web.OpenApiTransformationContext; -import springfox.documentation.oas.web.WebMvcOpenApiTransformationFilter; -import springfox.documentation.spi.DocumentationType; - -@Component -@Order(Ordered.LOWEST_PRECEDENCE) -public class SpringfoxSwaggerHostResolver implements WebMvcOpenApiTransformationFilter { - - public boolean supports(DocumentationType delimiter) { - return delimiter == DocumentationType.OAS_30; - } - - public OpenAPI transform(OpenApiTransformationContext<HttpServletRequest> context) { - OpenAPI swagger = context.getSpecification(); - - Server server = swagger.getServers().get(0); - if (server.getUrl().contains(":443")) { - // via the gateway - server.setUrl(server.getUrl().replace(":443", "")); - } - - return swagger; - } - -} diff --git a/legal-core/src/main/java/org/opengroup/osdu/legal/swagger/SwaggerConfiguration.java b/legal-core/src/main/java/org/opengroup/osdu/legal/swagger/SwaggerConfiguration.java new file mode 100644 index 0000000000000000000000000000000000000000..6b91728909d1e6456cf04b078ae2448493691428 --- /dev/null +++ b/legal-core/src/main/java/org/opengroup/osdu/legal/swagger/SwaggerConfiguration.java @@ -0,0 +1,53 @@ +package org.opengroup.osdu.legal.swagger; + +import io.swagger.v3.oas.models.servers.Server; +import org.springframework.context.annotation.Configuration; +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.parameters.Parameter; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import org.opengroup.osdu.core.common.model.http.DpsHeaders; +import org.springdoc.core.customizers.OperationCustomizer; +import org.springframework.context.annotation.Bean; + +import javax.servlet.ServletContext; +import java.util.Collections; +import org.springframework.context.annotation.Profile; + +@Configuration +@Profile("!noswagger") +public class SwaggerConfiguration { + + @Bean + public OpenAPI openApi(ServletContext servletContext) { + Server server = new Server().url(servletContext.getContextPath()); + return new OpenAPI() + .servers(Collections.singletonList(server)) + .info(new Info() + .title("Legal Service") + .version("1.0")) + .components(new Components() + .addSecuritySchemes("Authorization", + new SecurityScheme() + .type(SecurityScheme.Type.HTTP) + .scheme("bearer") + .bearerFormat("Authorization") + .in(SecurityScheme.In.HEADER) + .name("Authorization"))) + .addSecurityItem( + new SecurityRequirement() + .addList("Authorization")); + } + + @Bean + public OperationCustomizer customize() { + return (operation, handlerMethod) -> operation.addParametersItem( + new Parameter() + .in("header") + .required(true) + .description("Data Partition Id") + .name(DpsHeaders.DATA_PARTITION_ID)); + } +} \ No newline at end of file diff --git a/legal-core/src/main/java/org/opengroup/osdu/legal/swagger/SwaggerDocumentationConfig.java b/legal-core/src/main/java/org/opengroup/osdu/legal/swagger/SwaggerDocumentationConfig.java deleted file mode 100644 index a29e3e793b064bfc4c9408676227c9cbf877ff3b..0000000000000000000000000000000000000000 --- a/legal-core/src/main/java/org/opengroup/osdu/legal/swagger/SwaggerDocumentationConfig.java +++ /dev/null @@ -1,69 +0,0 @@ -package org.opengroup.osdu.legal.swagger; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.opengroup.osdu.core.common.model.http.DpsHeaders; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; - -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiKey; -import springfox.documentation.service.AuthorizationScope; -import springfox.documentation.service.ParameterType; -import springfox.documentation.service.RequestParameter; -import springfox.documentation.service.SecurityReference; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spi.service.contexts.SecurityContext; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.builders.RequestParameterBuilder; -import springfox.documentation.oas.annotations.EnableOpenApi; - -@Configuration -@EnableOpenApi -public class SwaggerDocumentationConfig { - public static final String AUTHORIZATION_HEADER = "Authorization"; - public static final String DEFAULT_INCLUDE_PATTERN = "/.*"; - - @Bean - public Docket api() { - RequestParameterBuilder builder = new RequestParameterBuilder(); - List<RequestParameter> parameters = new ArrayList<>(); - builder.name(DpsHeaders.DATA_PARTITION_ID) - .description("tenant") - .in(ParameterType.HEADER) - .required(true) - .build(); - parameters.add(builder.build()); - return new Docket(DocumentationType.OAS_30) - .globalRequestParameters(parameters) - .select() - .apis(RequestHandlerSelectors.basePackage("org.opengroup.osdu.legal.api")) - .build() - .securityContexts(Collections.singletonList(securityContext())) - .securitySchemes(Collections.singletonList(apiKey())); - } - - private ApiKey apiKey() { - return new ApiKey(AUTHORIZATION_HEADER, AUTHORIZATION_HEADER, "header"); - } - - private SecurityContext securityContext() { - return SecurityContext.builder() - .securityReferences(defaultAuth()) - .operationSelector(o -> PathSelectors.regex(DEFAULT_INCLUDE_PATTERN).test(o.requestMappingPattern())) - .build(); - } - - List<SecurityReference> defaultAuth() { - AuthorizationScope authorizationScope - = new AuthorizationScope("global", "accessEverything"); - AuthorizationScope[] authorizationScopes = - new AuthorizationScope[]{authorizationScope}; - return Collections.singletonList( - new SecurityReference(AUTHORIZATION_HEADER, authorizationScopes)); - } -} diff --git a/pom.xml b/pom.xml index 963a791b85f1648e608e41e7dc072f30bad87060..39e2a4edebcfb7b5dad2f115465bfd84091840f4 100644 --- a/pom.xml +++ b/pom.xml @@ -8,13 +8,13 @@ <maven.compiler.source>1.8</maven.compiler.source> <docker.image.prefix>opendes</docker.image.prefix> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <os-core-common.version>0.17.0-rc4</os-core-common.version> - <snakeyaml.version>1.26</snakeyaml.version> + <os-core-common.version>0.18.0-rc3</os-core-common.version> + <snakeyaml.version>1.31</snakeyaml.version> <resilience4jVersion>1.7.0</resilience4jVersion> - <springfox.version>3.0.0</springfox.version> + <openapi.version>1.6.9</openapi.version> <log4j.version>2.17.1</log4j.version> <json-smart.version>2.4.7</json-smart.version> - <jackson-databind.version>2.13.2.2</jackson-databind.version> + <jackson-databind.version>2.13.4</jackson-databind.version> <jackson.version>2.13.2</jackson.version> </properties> @@ -65,14 +65,14 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> - <version>2.4.12</version> + <version>2.7.2</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> - <version>2.4.12</version> + <version>2.7.2</version> </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> @@ -146,11 +146,11 @@ <dependencies> <!--Swagger--> - <dependency> - <groupId>io.springfox</groupId> - <artifactId>springfox-boot-starter</artifactId> - <version>${springfox.version}</version> - </dependency> + <dependency> + <groupId>org.springdoc</groupId> + <artifactId>springdoc-openapi-ui</artifactId> + <version>${openapi.version}</version> + </dependency> </dependencies> <profiles> diff --git a/provider/legal-aws/src/test/resources/application.properties b/provider/legal-aws/src/test/resources/application.properties index 70c98bd5e1c683589b902b6aae7309478085af37..19fdcc67f13da8796588047e65a1353b0c325214 100644 --- a/provider/legal-aws/src/test/resources/application.properties +++ b/provider/legal-aws/src/test/resources/application.properties @@ -3,4 +3,7 @@ spring.data.mongodb.port=27019 #testing context configuration spring.main.allow-bean-definition-overriding=true -repository.implementation=mongodb \ No newline at end of file +repository.implementation=mongodb +spring.profiles.active=noswagger +spring.mongodb.embedded.version=3.5.5 + diff --git a/provider/legal-azure/pom.xml b/provider/legal-azure/pom.xml index c9b48d276f8da5792175784902c8eb6e392291e8..8221ff709a9d74bc5054a37857985a07a1d3dae4 100644 --- a/provider/legal-azure/pom.xml +++ b/provider/legal-azure/pom.xml @@ -31,7 +31,7 @@ <azure.appservice.plan /> <azure.appservice.appname /> <azure.appservice.subscription /> - <osdu.corelibazure.version>0.16.0</osdu.corelibazure.version> + <osdu.corelibazure.version>0.18.0-rc4</osdu.corelibazure.version> <osdu.legal-core.version>0.18.0-SNAPSHOT</osdu.legal-core.version> <javax.inject.version>1</javax.inject.version> <javax.servlet-api.version>4.0.1</javax.servlet-api.version> diff --git a/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/security/WhoamiController.java b/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/security/WhoamiController.java index d3eb5ba7c72021b9a25c30a39e5bc7fe8fcc0013..33d3094ae9081893cb7863dce036e36e2192e4e3 100644 --- a/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/security/WhoamiController.java +++ b/provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/security/WhoamiController.java @@ -14,6 +14,7 @@ package org.opengroup.osdu.legal.azure.security; +import io.swagger.v3.oas.annotations.Hidden; import lombok.NoArgsConstructor; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; @@ -22,6 +23,7 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +@Hidden @NoArgsConstructor @Controller public class WhoamiController { diff --git a/provider/legal-azure/src/main/resources/application.properties b/provider/legal-azure/src/main/resources/application.properties index ea16ef66843ef2d7b8291beaed3cacc2cd8bd30e..a326c5be037ca818305110baf3a258d800df9c7a 100644 --- a/provider/legal-azure/src/main/resources/application.properties +++ b/provider/legal-azure/src/main/resources/application.properties @@ -72,3 +72,8 @@ tenantInfo.container.name=TenantInfo # Disable keyVault for actuator health check management.health.azure-key-vault.enabled=false management.server.port=8081 + +#Swagger config +springdoc.swagger-ui.tagsSorter=alpha +springdoc.swagger-ui.operationsSorter=alpha +springdoc.swagger-ui.doc-expansion=none