From 1e5956bac49f3bf2dfe048c4670cf3b5d2e00921 Mon Sep 17 00:00:00 2001 From: Yunhua Koglin <kogliny@amazon.com> Date: Tue, 19 Mar 2024 14:28:45 +0000 Subject: [PATCH] spring 6 upgrade --- NOTICE | 205 ++++-------- pom.xml | 50 +-- provider/register-aws/pom.xml | 44 +-- .../provider/aws/action/AwsActionRepo.java | 2 +- .../provider/aws/config/AwsServiceConfig.java | 2 +- .../provider/aws/ddms/AwsDdmsRepo.java | 2 +- .../AwsSubscriberTestListenerApi.java | 14 +- .../aws/subscriber/AwsSubscriptionRepo.java | 2 +- .../provider/aws/subscriber/KmsHelper.java | 4 +- .../aws/subscriber/TopicsRepositoryImpl.java | 2 +- .../AwsSubscriberTestListenerApiTest.java | 38 +-- provider/register-azure/pom.xml | 71 ++-- .../azure/di/AzureBootstrapConfig.java | 4 +- .../azure/di/AzureTenantIdConfig.java | 4 +- .../security/AzureIstioSecurityConfig.java | 29 +- provider/register-gc/docs/anthos/README.md | 144 ++++----- provider/register-gc/pom.xml | 284 ++++++++-------- .../register-gc/src/main/appengine/app.yaml | 42 --- .../provider/gcp/RegisterApplication.java | 2 +- .../provider/gcp/api/SubscriberApiGcp.java | 4 +- .../api/test/SubscriberListenerTestApi.java | 10 +- .../gcp/logging/AppengineLogFactory.java | 46 --- .../gcp/security/GSuiteSecurityConfig.java | 30 +- .../provider/gcp/subscriber/OsmAccess.java | 2 +- .../gcp/subscriber/model/SubscriptionDto.java | 37 ++- .../src/main/resources/logback.xml | 38 --- provider/register-ibm/pom.xml | 11 +- .../provider/ibm/RegisterApplication.java | 2 +- .../provider/ibm/api/SubscriptionApi.java | 33 +- .../datastore/DatastoreMultiTenantAccess.java | 2 +- .../ibm/security/IBMSecurityConfig.java | 38 ++- register-core/pom.xml | 70 ++-- .../action/model/CreateActionDto.java | 8 +- .../action/model/TestActionRequest.java | 4 +- .../model/validators/FilterValidator.java | 4 +- .../action/model/validators/ValidFilter.java | 4 +- .../osdu/register/api/ActionApi.java | 305 ++++++++++-------- .../opengroup/osdu/register/api/DdmsApi.java | 287 +++++++++------- .../osdu/register/api/SubscriberApi.java | 8 +- .../api/test/GsaSubscriberListenerApi.java | 8 +- .../api/test/SubscriberListenerApi.java | 6 +- .../osdu/register/ddms/model/Ddms.java | 10 +- .../ddms/model/RegisteredInterface.java | 9 +- .../validators/OpenApi3SpecValidator.java | 6 +- .../RegisteredInterfacesValidator.java | 13 +- .../model/validators/ValidOpenApi3Spec.java | 9 +- .../validators/ValidRegisteredInterfaces.java | 9 +- .../middleware/AuthorizationFilter.java | 13 +- .../middleware/GlobalExceptionMapper.java | 7 +- .../register/middleware/RegisterFilter.java | 23 +- .../subscriber/model/Subscription.java | 7 +- .../model/validators/SecretValidator.java | 18 +- .../model/validators/ValidSecret.java | 10 +- .../register/utils/ServiceRequestInfo.java | 5 +- .../osdu/register/utils/UriResolver.java | 2 +- .../osdu/register/api/SubscriberApiTest.java | 2 +- .../validators/OpenApi3SpecValidatorTest.java | 20 +- .../RegisteredInterfacesValidatorTest.java | 7 +- .../middleware/AuthorizationFilterTest.java | 8 +- .../middleware/RegisterFilterTest.java | 30 +- .../osdu/register/utils/Helpers.java | 6 +- .../utils/ServiceRequestInfoTest.java | 5 +- testing/pom.xml | 9 +- testing/register-test-aws/pom.xml | 16 +- testing/register-test-azure/pom.xml | 36 ++- testing/register-test-baremetal/pom.xml | 14 +- testing/register-test-core/pom.xml | 28 +- testing/register-test-gc/pom.xml | 30 +- testing/register-test-ibm/pom.xml | 16 +- 69 files changed, 1109 insertions(+), 1161 deletions(-) delete mode 100644 provider/register-gc/src/main/appengine/app.yaml delete mode 100644 provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/logging/AppengineLogFactory.java delete mode 100644 provider/register-gc/src/main/resources/logback.xml diff --git a/NOTICE b/NOTICE index b32b3b2a3..30cc98224 100644 --- a/NOTICE +++ b/NOTICE @@ -15,14 +15,12 @@ Apache-1.1 ======================================================================== The following software have components provided under the terms of this license: -- Apache Geronimo JMS Spec 2.0 (from http://geronimo.apache.org/maven/${siteId}/${version}) - AspectJ Weaver (from http://www.aspectj.org, https://www.eclipse.org/aspectj/) - 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) - Proton-J (from https://repo1.maven.org/maven2/org/apache/qpid/proton-j) -- QpidJMS Client (from https://repo1.maven.org/maven2/org/apache/qpid/qpid-jms-client) ======================================================================== Apache-2.0 @@ -32,10 +30,6 @@ The following software have components provided under the terms of this license: - AMQP 1.0 JMS Spring Boot AutoConfiguration (from https://repo1.maven.org/maven2/org/amqphub/spring/amqp-10-jms-spring-boot-autoconfigure) - AMQP 1.0 JMS Spring Boot Starter (from https://repo1.maven.org/maven2/org/amqphub/spring/amqp-10-jms-spring-boot-starter) - API Common (from https://github.com/googleapis, https://github.com/googleapis/api-common-java, https://repo1.maven.org/maven2/com/google/api/api-common) -- ASM Analysis (from http://asm.ow2.io/) -- ASM Commons (from http://asm.ow2.io/, https://repo1.maven.org/maven2/org/ow2/asm/asm-commons) -- ASM Tree (from http://asm.ow2.io/) -- ASM Util (from http://asm.ow2.io/) - ASM based accessors helper used by json-smart (from https://urielch.github.io/) - AWS Java SDK for AWS KMS (from https://aws.amazon.com/sdkforjava) - AWS Java SDK for AWS Lambda (from https://aws.amazon.com/sdkforjava) @@ -58,7 +52,6 @@ The following software have components provided under the terms of this license: - Apache Commons Lang (from https://commons.apache.org/proper/commons-lang/) - Apache Commons Logging (from http://commons.apache.org/logging/, http://commons.apache.org/proper/commons-logging/, https://commons.apache.org/proper/commons-logging/) - Apache Commons Validator (from http://commons.apache.org/proper/commons-validator/, http://jakarta.apache.org/commons/${pom.artifactId.substring(8)}/, https://repo1.maven.org/maven2/commons-validator/commons-validator) -- Apache Geronimo JMS Spec 2.0 (from http://geronimo.apache.org/maven/${siteId}/${version}) - Apache Groovy (from http://groovy-lang.org, http://groovy.codehaus.org/, https://groovy-lang.org) - Apache HTTP transport v2 for the Google HTTP Client Library for Java. (from https://repo1.maven.org/maven2/com/google/http-client/google-http-client-apache-v2) - Apache HttpClient (from http://hc.apache.org/httpcomponents-client, http://hc.apache.org/httpcomponents-client-ga, https://repo1.maven.org/maven2/org/apache/httpcomponents/client5/httpclient5) @@ -75,6 +68,7 @@ The following software have components provided under the terms of this license: - Asynchronous Http Client (from https://repo1.maven.org/maven2/org/asynchttpclient/async-http-client) - 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/main/value, https://github.com/google/auto/tree/master/value, https://repo1.maven.org/maven2/com/google/auto/value/auto-value-annotations) +- Awaitility (from http://awaitility.org) - BSON (from http://bsonspec.org, https://bsonspec.org) - BSON Record Codec (from <https://www.mongodb.com/>, https://www.mongodb.com/) - Bean Validation API (from http://beanvalidation.org) @@ -84,12 +78,11 @@ The following software have components provided under the terms of this license: - Byte Buddy (without dependencies) (from https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy) - Byte Buddy Java agent (from https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy-agent) - ClassMate (from http://github.com/cowtowncoder/java-classmate) -- Cloud Key Management Service (KMS) API v1-rev20240131-2.0.0 (from https://repo1.maven.org/maven2/com/google/apis/google-api-services-cloudkms) +- Cloud Key Management Service (KMS) API v1-rev20240219-2.0.0 (from https://repo1.maven.org/maven2/com/google/apis/google-api-services-cloudkms) - Collections (from https://repo1.maven.org/maven2/commons-collections/commons-collections) - Commons Digester (from http://commons.apache.org/digester/) - Converter: Jackson (from https://github.com/square/retrofit, https://repo1.maven.org/maven2/com/squareup/retrofit2/converter-jackson) - Core functionality for the Reactor Netty library (from https://github.com/reactor/reactor-netty) -- Expression Language 3.0 API (from http://uel-spec.java.net, http://uel.java.net) - FindBugs-jsr305 (from http://findbugs.sourceforge.net/) - GAX (Google Api eXtensions) for Java (Core) (from https://github.com/googleapis, https://github.com/googleapis/gax-java, https://repo1.maven.org/maven2/com/google/api/gax) - GAX (Google Api eXtensions) for Java (HTTP JSON) (from <https://repo1.maven.org/maven2/com/google/api/gax-httpjson>, https://repo1.maven.org/maven2/com/google/api/gax-httpjson) @@ -110,9 +103,7 @@ The following software have components provided under the terms of this license: - Guava ListenableFuture only (from https://repo1.maven.org/maven2/com/google/guava/listenablefuture) - 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) - HTTP functionality for the Reactor Netty library (from https://github.com/reactor/reactor-netty) -- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/) - Hibernate Validator (from https://repo1.maven.org/maven2/org/hibernate/hibernate-validator, https://repo1.maven.org/maven2/org/hibernate/validator/hibernate-validator) -- Hibernate Validator Engine - Relocation Artifact (from https://repo1.maven.org/maven2/org/hibernate/hibernate-validator) - HikariCP (from https://github.com/brettwooldridge/HikariCP) - Hop (from https://github.com/rabbitmq/hop, https://www.rabbitmq.com) - IBM COS Java SDK for Amazon S3 (from https://github.com/ibm/ibm-cos-sdk-java) @@ -138,13 +129,15 @@ The following software have components provided under the terms of this license: - Jackson datatype: Joda (from http://wiki.fasterxml.com/JacksonModuleJoda, https://github.com/FasterXML/jackson-datatype-joda) - Jackson datatype: jdk8 (from https://repo1.maven.org/maven2/com/fasterxml/jackson/datatype/jackson-datatype-jdk8) - Jackson module: Afterburner (from http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson-modules-base) -- Jackson module: JAXB Annotations (from http://github.com/FasterXML/jackson-module-jaxb-annotations, http://wiki.fasterxml.com/JacksonJAXBAnnotations, https://github.com/FasterXML/jackson-modules-base) - Jackson-annotations (from http://github.com/FasterXML/jackson, http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson) - Jackson-core (from http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson-core) - Jackson-dataformat-XML (from http://wiki.fasterxml.com/JacksonExtensionXmlDataBinding, https://github.com/FasterXML/jackson-dataformat-xml) - Jackson-dataformat-YAML (from https://github.com/FasterXML/jackson, https://github.com/FasterXML/jackson-dataformats-text) - Jackson-module-parameter-names (from https://repo1.maven.org/maven2/com/fasterxml/jackson/module/jackson-module-parameter-names) +- Jakarta Dependency Injection (from https://github.com/eclipse-ee4j/injection-api) +- Jakarta Expression Language API (from https://projects.eclipse.org/projects/ee4j.el) - Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api) +- Jakarta Servlet (from https://projects.eclipse.org/projects/ee4j.servlet) - Jakarta Validation API (from https://beanvalidation.org) - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) - Java Native Access (from https://github.com/java-native-access/jna, https://github.com/twall/jna) @@ -154,12 +147,6 @@ The following software have components provided under the terms of this license: - Javassist (from http://www.javassist.org/, https://www.javassist.org/) - JetBrains Java Annotations (from https://github.com/JetBrains/java-annotations) - Joda-Time (from http://joda-time.sourceforge.net, http://www.joda.org/joda-time/, https://www.joda.org/joda-time/) -- KeePassJava2 :: All (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2) -- KeePassJava2 :: DOM (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-dom) -- KeePassJava2 :: JAXB (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-jaxb) -- KeePassJava2 :: KDB (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-kdb) -- KeePassJava2 :: KDBX (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/KeePassJava2-kdbx) -- 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/>, https://kotlinlang.org/) @@ -173,6 +160,7 @@ The following software have components provided under the terms of this license: - Microsoft Azure Java Core Library (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure Netty HTTP Client Library (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (from https://github.com/Azure/azure-sdk-for-java) +- Microsoft Azure client library for Identity (from https://github.com/Azure/azure-sdk-for-java) - Mockito (from http://mockito.org, https://github.com/mockito/mockito) - MongoDB Driver (from https://www.mongodb.com/) - MongoDB Java Driver (from http://mongodb.org/, http://www.mongodb.org, https://www.mongodb.com/) @@ -190,6 +178,8 @@ The following software have components provided under the terms of this license: - 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) +- Netty/TomcatNative [BoringSSL - Static] (from https://github.com/netty/netty-tcnative/netty-tcnative-boringssl-static/) +- Netty/TomcatNative [OpenSSL - Classes] (from https://repo1.maven.org/maven2/io/netty/netty-tcnative-classes) - Netty/Transport (from https://repo1.maven.org/maven2/io/netty/netty-transport) - Netty/Transport/Classes/Epoll (from https://repo1.maven.org/maven2/io/netty/netty-transport-classes-epoll) - Netty/Transport/Classes/KQueue (from https://repo1.maven.org/maven2/io/netty/netty-transport-classes-kqueue) @@ -205,7 +195,6 @@ The following software have components provided under the terms of this license: - OkHttp URLConnection (from https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp-urlconnection, https://square.github.io/okhttp/) - Okio (from https://github.com/square/okio/, https://repo1.maven.org/maven2/com/squareup/okio/okio) - OpenCensus (from https://github.com/census-instrumentation/opencensus-java, https://github.com/census-instrumentation/opencensus-proto) -- PWDB :: Database (from https://repo1.maven.org/maven2/org/linguafranca/pwdb/database) - PostgreSQL JDBC Driver - PowerMock (from http://www.powermock.org, https://repo1.maven.org/maven2/org/powermock/powermock-api-mockito) - Prometheus Java Simpleclient (from <https://repo1.maven.org/maven2/io/prometheus/simpleclient>, https://repo1.maven.org/maven2/io/prometheus/simpleclient) @@ -233,7 +222,6 @@ The following software have components provided under the terms of this license: - Spring Boot AutoConfigure (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-autoconfigure, https://spring.io/projects/spring-boot) - Spring Boot Dependencies (from http://projects.spring.io/spring-boot/, https://spring.io/projects/spring-boot) - Spring Boot JDBC Starter (from http://projects.spring.io/spring-boot/, https://spring.io/projects/spring-boot) -- Spring Boot Jersey Starter (from http://projects.spring.io/spring-boot/, https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-jersey, https://spring.io/projects/spring-boot) - Spring Boot Json Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-json, https://spring.io/projects/spring-boot) - Spring Boot Log4j 2 Starter (from http://projects.spring.io/spring-boot/, https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-log4j2, https://spring.io/projects/spring-boot) - Spring Boot Logging Starter (from http://projects.spring.io/spring-boot/, https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-logging, https://spring.io/projects/spring-boot) @@ -267,13 +255,10 @@ The following software have components provided under the terms of this license: - 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>, 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) - Zipkin Reporter Brave (from https://repo1.maven.org/maven2/io/zipkin/reporter2/zipkin-reporter-brave) - Zipkin Reporter: Core (from https://repo1.maven.org/maven2/io/zipkin/reporter2/zipkin-reporter) - Zipkin v2 (from https://repo1.maven.org/maven2/io/zipkin/zipkin2/zipkin) -- aalto-xml (from https://github.com/FasterXML/aalto-xml, https://repo1.maven.org/maven2/com/fasterxml/aalto-xml) - datastore-v1-proto-client (from https://repo1.maven.org/maven2/com/google/cloud/datastore/datastore-v1-proto-client) - error-prone annotations (from https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations) - grpc-google-cloud-datastore-admin-v1 (from https://github.com/googleapis/java-datastore/grpc-google-cloud-datastore-admin-v1) @@ -291,19 +276,18 @@ The following software have components provided under the terms of this license: - io.grpc:grpc-stub (from https://github.com/grpc/grpc-java) - io.grpc:grpc-xds (from https://github.com/grpc/grpc-java) - jackson-databind (from http://github.com/FasterXML/jackson, http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson) -- jakarta.inject (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/jakarta.inject) - java-cloudant (from https://cloudant.com) - javatuples (from http://www.javatuples.org) - javax.annotation API (from http://jcp.org/en/jsr/detail?id=250) - javax.inject (from http://code.google.com/p/atinject/, https://repo1.maven.org/maven2/org/glassfish/hk2/external/javax.inject) - jersey-core-common (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common) -- jersey-core-server (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-server) -- jersey-ext-bean-validation (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-bean-validation) -- jersey-media-json-jackson (from https://repo1.maven.org/maven2/org/glassfish/jersey/media/jersey-media-json-jackson) - jose4j (from https://bitbucket.org/b_c/jose4j/) - json-path (from http://code.google.com/p/json-path/, https://github.com/jayway/JsonPath) - lettuce (from http://github.com/mp911de/lettuce/wiki, https://github.com/lettuce-io/lettuce-core/wiki) +- micrometer-commons (from https://github.com/micrometer-metrics/micrometer) - micrometer-core (from https://github.com/micrometer-metrics/micrometer) +- micrometer-jakarta9 (from https://github.com/micrometer-metrics/micrometer) +- micrometer-observation (from https://github.com/micrometer-metrics/micrometer) - micrometer-registry-azure-monitor (from https://github.com/micrometer-metrics/micrometer) - micrometer-registry-prometheus (from <https://github.com/micrometer-metrics/micrometer>, https://github.com/micrometer-metrics/micrometer) - org.apiguardian:apiguardian-api (from https://github.com/apiguardian-team/apiguardian) @@ -322,13 +306,16 @@ The following software have components provided under the terms of this license: - spring-security-oauth2-client (from http://spring.io/spring-security, https://spring.io/projects/spring-security, https://spring.io/spring-security) - 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) -- springdoc-openapi-common (from <https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-common>, https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-common) -- springdoc-openapi-ui (from https://github.com/springdoc/springdoc-openapi, 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>, https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-webmvc-core) +- springdoc-openapi-starter-common (from https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-starter-common) +- springdoc-openapi-starter-webmvc-api (from https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-starter-webmvc-api) +- springdoc-openapi-starter-webmvc-ui (from https://repo1.maven.org/maven2/org/springdoc/springdoc-openapi-starter-webmvc-ui) - swagger-annotations (from https://repo1.maven.org/maven2/io/swagger/core/v3/swagger-annotations, https://repo1.maven.org/maven2/io/swagger/swagger-annotations) +- swagger-annotations-jakarta (from https://repo1.maven.org/maven2/io/swagger/core/v3/swagger-annotations-jakarta) - swagger-core (from https://repo1.maven.org/maven2/io/swagger/core/v3/swagger-core, https://repo1.maven.org/maven2/io/swagger/swagger-core) +- swagger-core-jakarta (from https://repo1.maven.org/maven2/io/swagger/core/v3/swagger-core-jakarta) - 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, https://repo1.maven.org/maven2/io/swagger/swagger-models) +- swagger-models-jakarta (from https://repo1.maven.org/maven2/io/swagger/core/v3/swagger-models-jakarta) - tomcat-annotations-api (from http://tomcat.apache.org/, https://tomcat.apache.org/) - tomcat-embed-core (from http://tomcat.apache.org/) - tomcat-embed-el (from http://tomcat.apache.org/, https://tomcat.apache.org/) @@ -349,7 +336,6 @@ The following software have components provided under the terms of this license: - PostgreSQL JDBC Driver - Stax2 API (from http://github.com/FasterXML/stax2-api) - jersey-core-common (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common) -- jersey-core-server (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-server) ======================================================================== BSD-3-Clause @@ -357,13 +343,8 @@ BSD-3-Clause The following software have components provided under the terms of this license: - API Common (from https://github.com/googleapis, https://github.com/googleapis/api-common-java, https://repo1.maven.org/maven2/com/google/api/api-common) -- ASM Analysis (from http://asm.ow2.io/) -- ASM Commons (from http://asm.ow2.io/, https://repo1.maven.org/maven2/org/ow2/asm/asm-commons) - ASM Core (from http://asm.ow2.io/, http://asm.ow2.org/) -- ASM Tree (from http://asm.ow2.io/) -- ASM Util (from http://asm.ow2.io/) - AspectJ Weaver (from http://www.aspectj.org, https://www.eclipse.org/aspectj/) -- Class Model for Hk2 (from https://repo1.maven.org/maven2/org/glassfish/hk2/class-model) - FindBugs-jsr305 (from http://findbugs.sourceforge.net/) - GAX (Google Api eXtensions) for Java (Core) (from https://github.com/googleapis, https://github.com/googleapis/gax-java, https://repo1.maven.org/maven2/com/google/api/gax) - GAX (Google Api eXtensions) for Java (HTTP JSON) (from <https://repo1.maven.org/maven2/com/google/api/gax-httpjson>, https://repo1.maven.org/maven2/com/google/api/gax-httpjson) @@ -372,13 +353,13 @@ The following software have components provided under the terms of this license: - Google Auth Library for Java - Credentials (from https://repo1.maven.org/maven2/com/google/auth/google-auth-library-credentials) - Google Auth Library for Java - OAuth2 HTTP (from https://repo1.maven.org/maven2/com/google/auth/google-auth-library-oauth2-http) - Google OAuth Client Library for Java (from https://repo1.maven.org/maven2/com/google/oauth-client/google-oauth-client) -- HK2 Implementation Utilities (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-utils) -- HK2 core module (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-core) - Hamcrest (from http://hamcrest.org/JavaHamcrest/) - Hamcrest Core (from http://hamcrest.org/, http://hamcrest.org/JavaHamcrest/, https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core) - Jackson module: Afterburner (from http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson-modules-base) - Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://github.com/jakartaee/jaf-api, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api) - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca) +- Jakarta Expression Language API (from https://projects.eclipse.org/projects/ee4j.el) +- Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms) - Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api) - 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) - Lucene Core (from https://repo1.maven.org/maven2/org/apache/lucene/lucene-core) @@ -392,17 +373,9 @@ The following software have components provided under the terms of this license: - Protocol Buffers [Util] (from https://repo1.maven.org/maven2/com/google/protobuf/protobuf-java-util) - RE2/J (from http://github.com/google/re2j) - Redisson (from http://redisson.org) -- ServiceLocator Default Implementation (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-locator) - Spring Core (from http://www.springframework.org, https://github.com/spring-projects/spring-framework, https://repo1.maven.org/maven2/org/springframework/spring-core) - ThreeTen backport (from https://github.com/ThreeTen/threetenbp, https://www.threeten.org/threetenbp) -- aopalliance-repackaged (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/aopalliance-repackaged) -- jakarta.inject (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/jakarta.inject) -- jersey-container-servlet (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet) -- jersey-core-client (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-client) - jersey-core-common (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common) -- jersey-core-server (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-server) -- jersey-ext-bean-validation (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-bean-validation) -- jersey-media-json-jackson (from https://repo1.maven.org/maven2/org/glassfish/jersey/media/jersey-media-json-jackson) ======================================================================== Beerware @@ -414,6 +387,13 @@ The following software have components provided under the terms of this license: - 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) +======================================================================== +BouncyCastle +======================================================================== +The following software have components provided under the terms of this license: + +- Microsoft Azure client library for Identity (from https://github.com/Azure/azure-sdk-for-java) + ======================================================================== CC-BY-2.5 ======================================================================== @@ -441,20 +421,10 @@ The following software have components provided under the terms of this license: - HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/) - Hibernate Validator (from https://repo1.maven.org/maven2/org/hibernate/hibernate-validator, https://repo1.maven.org/maven2/org/hibernate/validator/hibernate-validator) - LatencyUtils (from http://latencyutils.github.io/LatencyUtils/) -- MongoDB Java Driver (from http://mongodb.org/, http://www.mongodb.org, https://www.mongodb.com/) - Netty/Common (from https://repo1.maven.org/maven2/io/netty/netty-common) - Prometheus Java Simpleclient (from <https://repo1.maven.org/maven2/io/prometheus/simpleclient>, https://repo1.maven.org/maven2/io/prometheus/simpleclient) - RabbitMQ Java Client (from http://www.rabbitmq.com, https://www.rabbitmq.com) -- jersey-container-servlet (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet) -- jersey-container-servlet-core (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet-core) -- jersey-core-client (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-client) - jersey-core-common (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common) -- jersey-core-server (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-server) -- jersey-ext-bean-validation (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-bean-validation) -- jersey-ext-entity-filtering (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-entity-filtering) -- jersey-inject-hk2 (from https://repo1.maven.org/maven2/org/glassfish/jersey/inject/jersey-hk2) -- jersey-media-json-jackson (from https://repo1.maven.org/maven2/org/glassfish/jersey/media/jersey-media-json-jackson) -- jersey-spring5 (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-spring5) - reactive-streams (from http://www.reactive-streams.org/) ======================================================================== @@ -463,11 +433,9 @@ CDDL-1.0 The following software have components provided under the terms of this license: - Apache Log4j Core (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core) -- Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://github.com/jakartaee/jaf-api, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api) - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) - JavaBeans Activation Framework (from <http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp>, http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp, https://repo1.maven.org/maven2/com/sun/activation/javax.activation) - JavaMail API jar (from https://repo1.maven.org/maven2/javax/mail/javax.mail-api) -- OSGi resource locator (from https://repo1.maven.org/maven2/org/glassfish/hk2/osgi-resource-locator) - javax.annotation API (from http://jcp.org/en/jsr/detail?id=250) ======================================================================== @@ -475,15 +443,10 @@ CDDL-1.1 ======================================================================== The following software have components provided under the terms of this license: -- Expression Language 3.0 API (from http://uel-spec.java.net, http://uel.java.net) -- HK2 Spring Bridge (from https://repo1.maven.org/maven2/org/glassfish/hk2/spring-bridge) -- HK2 module of HK2 itself (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2) -- Jakarta Servlet (from https://javaee.github.io/servlet-spec/, https://projects.eclipse.org/projects/ee4j.servlet) - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) - JavaBeans Activation Framework (from <http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp>, http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp, https://repo1.maven.org/maven2/com/sun/activation/javax.activation) - JavaMail API (from https://repo1.maven.org/maven2/com/sun/mail/javax.mail) - JavaMail API jar (from https://repo1.maven.org/maven2/javax/mail/javax.mail-api) -- Run Level Service (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-runlevel) - javax.annotation API (from http://jcp.org/en/jsr/detail?id=250) - tomcat-embed-core (from http://tomcat.apache.org/) @@ -506,10 +469,6 @@ EPL-1.0 ======================================================================== The following software have components provided under the terms of this license: -- AspectJ Weaver (from http://www.aspectj.org, https://www.eclipse.org/aspectj/) -- JUnit Jupiter API (from http://junit.org/junit5/, https://junit.org/junit5/) -- JUnit Jupiter Engine (from http://junit.org/junit5/, https://junit.org/junit5/) -- JUnit Jupiter Params (from http://junit.org/junit5/, https://junit.org/junit5/) - 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) @@ -518,9 +477,6 @@ The following software have components provided under the terms of this license: - 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) -- aopalliance-repackaged (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/aopalliance-repackaged) -- jersey-core-server (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-server) -- jersey-media-json-jackson (from https://repo1.maven.org/maven2/org/glassfish/jersey/media/jersey-media-json-jackson) - jsonoverlay (from https://github.com/RepreZen/JsonOverlay) - openapi-parser (from https://github.com/RepreZen/KaiZen-OpenAPI-Parser) @@ -530,10 +486,6 @@ EPL-2.0 The following software have components provided under the terms of this license: - AspectJ Weaver (from http://www.aspectj.org, https://www.eclipse.org/aspectj/) -- Class Model for Hk2 (from https://repo1.maven.org/maven2/org/glassfish/hk2/class-model) -- HK2 API module (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-api) -- HK2 Implementation Utilities (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-utils) -- HK2 core module (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-core) - JUnit Jupiter (Aggregator) (from https://junit.org/junit5/) - JUnit Jupiter API (from http://junit.org/junit5/, https://junit.org/junit5/) - JUnit Jupiter Engine (from http://junit.org/junit5/, https://junit.org/junit5/) @@ -542,23 +494,14 @@ The following software have components provided under the terms of this license: - JUnit Platform Engine API (from http://junit.org/junit5/, https://junit.org/junit5/) - Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://github.com/jakartaee/jaf-api, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api) - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca) +- Jakarta Expression Language API (from https://projects.eclipse.org/projects/ee4j.el) +- Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms) - Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api) +- Jakarta Servlet (from https://projects.eclipse.org/projects/ee4j.servlet) - Jakarta 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) - OSGi resource locator (from https://repo1.maven.org/maven2/org/glassfish/hk2/osgi-resource-locator) -- ServiceLocator Default Implementation (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-locator) -- aopalliance-repackaged (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/aopalliance-repackaged) -- jakarta.inject (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/jakarta.inject) -- jersey-container-servlet (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet) -- jersey-container-servlet-core (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet-core) -- jersey-core-client (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-client) - jersey-core-common (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common) -- jersey-core-server (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-server) -- jersey-ext-bean-validation (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-bean-validation) -- jersey-ext-entity-filtering (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-entity-filtering) -- jersey-inject-hk2 (from https://repo1.maven.org/maven2/org/glassfish/jersey/inject/jersey-hk2) -- jersey-media-json-jackson (from https://repo1.maven.org/maven2/org/glassfish/jersey/media/jersey-media-json-jackson) -- jersey-spring5 (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-spring5) - jsonoverlay (from https://github.com/RepreZen/JsonOverlay) ======================================================================== @@ -566,25 +509,10 @@ GPL-2.0-only ======================================================================== The following software have components provided under the terms of this license: -- Class Model for Hk2 (from https://repo1.maven.org/maven2/org/glassfish/hk2/class-model) -- Expression Language 3.0 API (from http://uel-spec.java.net, http://uel.java.net) -- HK2 Implementation Utilities (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-utils) -- HK2 core module (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-core) +- Jakarta Expression Language API (from https://projects.eclipse.org/projects/ee4j.el) +- Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms) - Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api) - JavaMail API jar (from https://repo1.maven.org/maven2/javax/mail/javax.mail-api) -- OSGi resource locator (from https://repo1.maven.org/maven2/org/glassfish/hk2/osgi-resource-locator) -- ServiceLocator Default Implementation (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-locator) -- aopalliance-repackaged (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/aopalliance-repackaged) -- jakarta.inject (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/jakarta.inject) -- jersey-container-servlet (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet) -- jersey-container-servlet-core (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet-core) -- jersey-core-client (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-client) -- jersey-core-server (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-server) -- jersey-ext-bean-validation (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-bean-validation) -- jersey-ext-entity-filtering (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-entity-filtering) -- jersey-inject-hk2 (from https://repo1.maven.org/maven2/org/glassfish/jersey/inject/jersey-hk2) -- jersey-media-json-jackson (from https://repo1.maven.org/maven2/org/glassfish/jersey/media/jersey-media-json-jackson) -- jersey-spring5 (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-spring5) - tomcat-embed-core (from http://tomcat.apache.org/) ======================================================================== @@ -592,42 +520,30 @@ GPL-2.0-with-classpath-exception ======================================================================== The following software have components provided under the terms of this license: -- Class Model for Hk2 (from https://repo1.maven.org/maven2/org/glassfish/hk2/class-model) -- Expression Language 3.0 API (from http://uel-spec.java.net, http://uel.java.net) -- HK2 Implementation Utilities (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-utils) -- HK2 core module (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-core) - Jackson-core (from http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson-core) - Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://github.com/jakartaee/jaf-api, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api) - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca) +- Jakarta Expression Language API (from https://projects.eclipse.org/projects/ee4j.el) +- Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms) - Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api) +- Jakarta Servlet (from https://projects.eclipse.org/projects/ee4j.servlet) - Jakarta 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) - Java Architecture for XML Binding (from http://jaxb.java.net/, https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api) - JavaBeans Activation Framework (from <http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp>, http://java.sun.com/javase/technologies/desktop/javabeans/jaf/index.jsp, https://repo1.maven.org/maven2/com/sun/activation/javax.activation) - JavaMail API jar (from https://repo1.maven.org/maven2/javax/mail/javax.mail-api) - OSGi resource locator (from https://repo1.maven.org/maven2/org/glassfish/hk2/osgi-resource-locator) -- ServiceLocator Default Implementation (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-locator) -- aopalliance-repackaged (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/aopalliance-repackaged) -- jakarta.inject (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/jakarta.inject) - javax.annotation API (from http://jcp.org/en/jsr/detail?id=250) -- jersey-container-servlet (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet) -- jersey-container-servlet-core (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet-core) -- jersey-core-client (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-client) - jersey-core-common (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common) -- jersey-core-server (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-server) -- jersey-ext-bean-validation (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-bean-validation) -- jersey-ext-entity-filtering (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-entity-filtering) -- jersey-inject-hk2 (from https://repo1.maven.org/maven2/org/glassfish/jersey/inject/jersey-hk2) -- jersey-media-json-jackson (from https://repo1.maven.org/maven2/org/glassfish/jersey/media/jersey-media-json-jackson) -- jersey-spring5 (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-spring5) - tomcat-embed-core (from http://tomcat.apache.org/) ======================================================================== -GPL-3.0-or-later +GPL-3.0-only ======================================================================== The following software have components provided under the terms of this license: -- aopalliance-repackaged (from https://repo1.maven.org/maven2/org/glassfish/hk2/external/aopalliance-repackaged) +- Jakarta Expression Language API (from https://projects.eclipse.org/projects/ee4j.el) +- Jakarta Messaging API (from https://projects.eclipse.org/projects/ee4j.jms) ======================================================================== ISC @@ -636,13 +552,6 @@ The following software have components provided under the terms of this license: - Spring Security - Core (from http://spring.io/spring-security, https://repo1.maven.org/maven2/org/springframework/security/spring-security-core, https://spring.io/projects/spring-security, https://spring.io/spring-security) -======================================================================== -ImageMagick -======================================================================== -The following software have components provided under the terms of this license: - -- aalto-xml (from https://github.com/FasterXML/aalto-xml, https://repo1.maven.org/maven2/com/fasterxml/aalto-xml) - ======================================================================== LGPL-2.1-only ======================================================================== @@ -674,9 +583,8 @@ The following software have components provided under the terms of this license: - AWS Java SDK for AWS Lambda (from https://aws.amazon.com/sdkforjava) - Animal Sniffer Annotations (from https://repo1.maven.org/maven2/org/codehaus/mojo/animal-sniffer-annotations) +- Apache HttpClient Cache (from http://hc.apache.org/httpcomponents-client, http://hc.apache.org/httpcomponents-client-ga) - Apache Log4j API (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api) -- Apache Log4j JUL Adapter (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-jul) -- Apache Log4j SLF4J Binding (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-slf4j-impl) - Apache Log4j to SLF4J Adapter (from https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-to-slf4j) - Azure Java Client Authentication Library for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java) - Azure Java Client Runtime for ARM (from https://github.com/Azure/autorest-clientruntime-for-java) @@ -684,7 +592,6 @@ The following software have components provided under the terms of this license: - Azure Spring Boot AutoConfigure (from https://github.com/Azure/azure-sdk-for-java, https://github.com/Microsoft/azure-spring-boot) - Azure Spring Boot Starter for Azure AD Spring Security Integration (from https://github.com/Azure/azure-sdk-for-java) - Checker Qual (from https://checkerframework.org) -- ClassGraph (from https://github.com/classgraph/classgraph) - JUL to SLF4J bridge (from http://www.slf4j.org) - Jackson-core (from http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson-core) - Java Client Runtime for AutoRest (from https://github.com/Azure/autorest-clientruntime-for-java) @@ -695,6 +602,7 @@ The following software have components provided under the terms of this license: - 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) - Microsoft Azure Java Core Library (from https://github.com/Azure/azure-sdk-for-java) +- Microsoft Azure Java JSON Library (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure Netty HTTP Client Library (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure SDK annotations (from https://github.com/Microsoft/java-api-annotations) - Microsoft Azure SDK for EventGrid Management (from https://github.com/Azure/azure-sdk-for-java) @@ -712,28 +620,19 @@ The following software have components provided under the terms of this license: - Netty/Codec/HTTP (from https://repo1.maven.org/maven2/io/netty/netty-codec-http) - Netty/Common (from https://repo1.maven.org/maven2/io/netty/netty-common) - Project Lombok (from http://projectlombok.org, https://projectlombok.org) -- QpidJMS Client (from https://repo1.maven.org/maven2/org/apache/qpid/qpid-jms-client) - SLF4J API Module (from http://www.slf4j.org) -- Spongy Castle (from http://rtyley.github.io/spongycastle/) - Spring Data for Azure Cosmos DB SQL API (from https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos, https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/spring/azure-spring-data-cosmos) +- System Stubs Core (from https://repo1.maven.org/maven2/uk/org/webcompere/system-stubs-core) +- System Stubs JUnit4 (from https://repo1.maven.org/maven2/uk/org/webcompere/system-stubs-junit4) - adal4j (from https://github.com/AzureAD/azure-activedirectory-library-for-java) -- jersey-container-servlet (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet) -- jersey-container-servlet-core (from https://repo1.maven.org/maven2/org/glassfish/jersey/containers/jersey-container-servlet-core) -- jersey-core-client (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-client) - jersey-core-common (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-common) -- jersey-core-server (from https://repo1.maven.org/maven2/org/glassfish/jersey/core/jersey-server) -- jersey-ext-bean-validation (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-bean-validation) -- jersey-ext-entity-filtering (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-entity-filtering) -- jersey-inject-hk2 (from https://repo1.maven.org/maven2/org/glassfish/jersey/inject/jersey-hk2) -- jersey-media-json-jackson (from https://repo1.maven.org/maven2/org/glassfish/jersey/media/jersey-media-json-jackson) -- jersey-spring5 (from https://repo1.maven.org/maven2/org/glassfish/jersey/ext/jersey-spring5) +- micrometer-commons (from https://github.com/micrometer-metrics/micrometer) - micrometer-core (from https://github.com/micrometer-metrics/micrometer) - mockito-inline (from http://mockito.org, https://github.com/mockito/mockito) - mockito-junit-jupiter (from https://github.com/mockito/mockito) - 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>, http://webjars.org) ======================================================================== MPL-1.1 @@ -770,12 +669,20 @@ The following software have components provided under the terms of this license: - Netty/Codec (from https://repo1.maven.org/maven2/io/netty/netty-codec) +======================================================================== +efsl-1.0 +======================================================================== +The following software have components provided under the terms of this license: + +- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api) + ======================================================================== gpl-2.0-classpath ======================================================================== The following software have components provided under the terms of this license: - Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca) +- Jakarta RESTful WS API (from https://github.com/eclipse-ee4j/jaxrs-api) - Jakarta Validation API (from https://beanvalidation.org) ======================================================================== @@ -783,8 +690,16 @@ public-domain ======================================================================== The following software have components provided under the terms of this license: -- Apache Groovy (from http://groovy-lang.org, http://groovy.codehaus.org/, https://groovy-lang.org) - HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/) - JSON in Java (from https://github.com/douglascrockford/JSON-java) -- Microsoft Azure client library for Blob Storage (from https://github.com/Azure/azure-sdk-for-java) - PostgreSQL JDBC Driver + +======================================================================== +unknown +======================================================================== +The following software have components provided under the terms of this license: + +- AspectJ Weaver (from http://www.aspectj.org, https://www.eclipse.org/aspectj/) +- JUnit Jupiter API (from http://junit.org/junit5/, https://junit.org/junit5/) +- JUnit Jupiter Engine (from http://junit.org/junit5/, https://junit.org/junit5/) +- JUnit Jupiter Params (from http://junit.org/junit5/, https://junit.org/junit5/) diff --git a/pom.xml b/pom.xml index 0bd63e69a..62a45cb7c 100644 --- a/pom.xml +++ b/pom.xml @@ -29,13 +29,15 @@ <maven.compiler.target>17</maven.compiler.target> <maven.compiler.source>17</maven.compiler.source> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <openapi.version>1.6.14</openapi.version> - <osdu.os.core.common-version>0.25.0</osdu.os.core.common-version> + <openapi.version>2.3.0</openapi.version> + <os-core-common-spring6.version>0.26.0-rc2</os-core-common-spring6.version> <log4j2.version>2.17.1</log4j2.version> <gson.version>2.8.9</gson.version> <json-smart.version>2.5.0</json-smart.version> <netty.version>4.1.97.Final</netty.version> <guava.version>32.1.2-jre</guava.version> + <spring-boot.version>3.2.3</spring-boot.version> + <spring-security.version>6.2.2</spring-security.version> </properties> <licenses> @@ -67,41 +69,36 @@ <type>pom</type> <scope>import</scope> </dependency> - <dependency> + <!-- <dependency> <groupId> org.apache.logging.log4j</groupId> <artifactId>log4j-bom</artifactId> <version>${log4j2.version}</version> <type>pom</type> <scope>import</scope> - </dependency> + </dependency> --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> - <version>2.7.17</version> + <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-to-slf4j</artifactId> - <version>${log4j2.version}</version> - </dependency> - <dependency> + <!-- <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> <version>${log4j2.version}</version> - </dependency> + </dependency> --> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>os-core-common</artifactId> - <version>${osdu.os.core.common-version}</version> + <artifactId>os-core-common-spring6</artifactId> + <version>${os-core-common-spring6.version}</version> <exclusions> - <exclusion> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - </exclusion> - </exclusions> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>com.google.code.gson</groupId> @@ -116,7 +113,7 @@ <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> - <version>5.7.11</version> + <version>${spring-security.version}</version> </dependency> </dependencies> </dependencyManagement> @@ -135,18 +132,18 @@ <!-- swagger dependency --> <dependency> <groupId>org.springdoc</groupId> - <artifactId>springdoc-openapi-ui</artifactId> + <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId> <version>${openapi.version}</version> </dependency> <dependency> <groupId>org.springframework.plugin</groupId> <artifactId>spring-plugin-core</artifactId> - <version>2.0.0.RELEASE</version> + <version>3.0.0</version> </dependency> <dependency> <groupId>org.springframework.plugin</groupId> <artifactId>spring-plugin-metadata</artifactId> - <version>2.0.0.RELEASE</version> + <version>3.0.0</version> <exclusions> <exclusion> <groupId>org.springframework.plugin</groupId> @@ -162,7 +159,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> - <version>2.1.9.RELEASE</version> + <version>${spring-boot.version}</version> <executions> <execution> <id>build-info</id> @@ -199,7 +196,10 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.11.0</version> - <configuration> + <configuration> + <compilerArgs> + <arg>-parameters</arg> + </compilerArgs> <source>${maven.compiler.source}</source> <target>${maven.compiler.target}</target> </configuration> diff --git a/provider/register-aws/pom.xml b/provider/register-aws/pom.xml index a73bb2138..15fe2488d 100644 --- a/provider/register-aws/pom.xml +++ b/provider/register-aws/pom.xml @@ -28,10 +28,8 @@ <relativePath>../../pom.xml</relativePath> </parent> <properties> - <log4j2.version>2.17.1</log4j2.version> - <jackson-databind.version>2.15.2</jackson-databind.version> - <jackson.version>2.15.2</jackson.version> - <spring-webmvc.version>5.3.24</spring-webmvc.version> + <jackson-databind.version>2.16.1</jackson-databind.version> + <jackson.version>2.16.1</jackson.version> </properties> <dependencyManagement> @@ -45,29 +43,15 @@ </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>os-core-common</artifactId> - <version>${osdu.os.core.common-version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-to-slf4j</artifactId> - <version>${log4j2.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-api</artifactId> - <version>${log4j2.version}</version> + <artifactId>os-core-common-spring6</artifactId> + <version>${os-core-common-spring6.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> - <version>5.8.9</version> + <version>${spring-security.version}</version> </dependency> </dependencies> </dependencyManagement> @@ -96,7 +80,7 @@ <dependency> <groupId>org.opengroup.osdu.core.aws</groupId> <artifactId>os-core-lib-aws</artifactId> - <version>0.26.0-rc2</version> + <version>0.26.0-spring6-rc1</version> </dependency> <dependency> <groupId>commons-io</groupId> @@ -117,7 +101,8 @@ </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>os-core-common</artifactId> + <artifactId>os-core-common-spring6</artifactId> + <version>${os-core-common-spring6.version}</version> <exclusions> <exclusion> <groupId>com.fasterxml.jackson.core</groupId> @@ -129,35 +114,36 @@ <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> + <version>${spring-security.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> + <version>${spring-boot.version}</version> <scope>test</scope> </dependency> <!-- Third party Apache 2.0 license packages --> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - <version>${spring-webmvc.version}</version> - </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> + <version>${spring-boot.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> + <version>${spring-boot.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-client</artifactId> + <version>${spring-security.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-jose</artifactId> + <version>${spring-security.version}</version> </dependency> <dependency> <groupId>junit</groupId> @@ -168,6 +154,7 @@ <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-inline</artifactId> + <version>5.2.0</version> <scope>test</scope> </dependency> @@ -184,6 +171,7 @@ <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> <executions> <execution> <goals> diff --git a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/action/AwsActionRepo.java b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/action/AwsActionRepo.java index 9d0e57a71..7ade3ce19 100644 --- a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/action/AwsActionRepo.java +++ b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/action/AwsActionRepo.java @@ -29,7 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/config/AwsServiceConfig.java b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/config/AwsServiceConfig.java index 8bdfe8825..575bcfd8a 100644 --- a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/config/AwsServiceConfig.java +++ b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/config/AwsServiceConfig.java @@ -27,7 +27,7 @@ import org.opengroup.osdu.register.provider.aws.subscriber.KmsConfig; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; @Component public class AwsServiceConfig { diff --git a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/ddms/AwsDdmsRepo.java b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/ddms/AwsDdmsRepo.java index 79ee4679d..59b969782 100644 --- a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/ddms/AwsDdmsRepo.java +++ b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/ddms/AwsDdmsRepo.java @@ -28,7 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.util.List; @Repository diff --git a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/push_api/AwsSubscriberTestListenerApi.java b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/push_api/AwsSubscriberTestListenerApi.java index a1aa587d1..493b9f266 100644 --- a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/push_api/AwsSubscriberTestListenerApi.java +++ b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/push_api/AwsSubscriberTestListenerApi.java @@ -13,7 +13,6 @@ // limitations under the License. package org.opengroup.osdu.register.provider.aws.push_api; - import com.amazonaws.services.sns.AmazonSNS; import com.amazonaws.services.sns.model.ConfirmSubscriptionRequest; import com.fasterxml.jackson.annotation.JsonProperty; @@ -36,10 +35,9 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.annotation.RequestScope; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.validation.constraints.NotBlank; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotBlank; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; @@ -65,10 +63,9 @@ public class AwsSubscriberTestListenerApi { private JaxRsDpsLog logger; @Autowired private AwsServiceConfig awsConfig; - private String readMessage(HttpServletRequest request) throws IOException { - Scanner scan = new Scanner(request.getInputStream()); + Scanner scan = new Scanner(request.getInputStream()); StringBuilder builder = new StringBuilder(); while (scan.hasNextLine()) { builder.append(scan.nextLine()); @@ -93,7 +90,8 @@ public class AwsSubscriberTestListenerApi { } @GetMapping("/aws/challenge/{count}") - public ResponseEntity<?> testCrc(@RequestParam("crc") @NotBlank String crc, @RequestParam("hmac") @NotBlank String hmac) { + public ResponseEntity<?> testCrc(@RequestParam("crc") @NotBlank String crc, + @RequestParam("hmac") @NotBlank String hmac) { try { signatureService.verifyHmacSignature(hmac, this.serviceConfig.getSubscriberSecret()); } catch (SignatureServiceException e) { diff --git a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/AwsSubscriptionRepo.java b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/AwsSubscriptionRepo.java index b8c86da8a..a204ea476 100644 --- a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/AwsSubscriptionRepo.java +++ b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/AwsSubscriptionRepo.java @@ -29,7 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Repository; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Base64; diff --git a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/KmsHelper.java b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/KmsHelper.java index 9e865b821..1409075f8 100644 --- a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/KmsHelper.java +++ b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/KmsHelper.java @@ -21,8 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired; import com.amazonaws.services.kms.*; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; -import javax.inject.Inject; +import jakarta.annotation.PostConstruct; +import jakarta.inject.Inject; import java.nio.ByteBuffer; import java.util.Collections; diff --git a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/TopicsRepositoryImpl.java b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/TopicsRepositoryImpl.java index b27c688f8..5580cda55 100644 --- a/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/TopicsRepositoryImpl.java +++ b/provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/TopicsRepositoryImpl.java @@ -26,7 +26,7 @@ import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Repository; -import javax.inject.Inject; +import jakarta.inject.Inject; import java.util.ArrayList; import java.util.List; diff --git a/provider/register-aws/src/test/java/org/opengroup/osdu/register/provider/aws/push_api/AwsSubscriberTestListenerApiTest.java b/provider/register-aws/src/test/java/org/opengroup/osdu/register/provider/aws/push_api/AwsSubscriberTestListenerApiTest.java index 1f9cbcaf4..6b08f47e1 100644 --- a/provider/register-aws/src/test/java/org/opengroup/osdu/register/provider/aws/push_api/AwsSubscriberTestListenerApiTest.java +++ b/provider/register-aws/src/test/java/org/opengroup/osdu/register/provider/aws/push_api/AwsSubscriberTestListenerApiTest.java @@ -19,9 +19,9 @@ import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.test.util.ReflectionTestUtils; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -69,7 +69,8 @@ public class AwsSubscriberTestListenerApiTest { @Test public void should_reject_subscription_hmac_invalid() throws IOException, SignatureServiceException { - // Generate an invalid Subscription Message request with the wrong hmac signature + // Generate an invalid Subscription Message request with the wrong hmac + // signature String TEST_WRONG_SECRET = "456def"; String invalidHmac = signatureService.getSignedSignature(TEST_URL, TEST_WRONG_SECRET); HttpServletRequest mockedRequest = mockChallengeHttpRequest("", invalidHmac); @@ -112,7 +113,8 @@ public class AwsSubscriberTestListenerApiTest { assertEquals(HttpStatus.BAD_REQUEST, response.getStatusCode()); } - // Helper method to generate a mock request so it can be consumed transparently by the private methods of + // Helper method to generate a mock request so it can be consumed transparently + // by the private methods of // AwsSubscriberTestListenerApi private HttpServletRequest mockChallengeHttpRequest(String message, String hmac) throws IOException { HttpServletRequest mockedRequest = Mockito.mock(HttpServletRequest.class); @@ -120,24 +122,24 @@ public class AwsSubscriberTestListenerApiTest { // Mock the hmac Mockito.when(mockedRequest.getParameter("hmac")).thenReturn(hmac); - // The following block mocks `request.getInputStream` so `AwsSubscriberTestListenerApi.readMessage` can return the message + // The following block mocks `request.getInputStream` so + // `AwsSubscriberTestListenerApi.readMessage` can return the message byte[] myBinaryMessage = message.getBytes(); ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(myBinaryMessage); ServletInputStream mockServletInputStream = Mockito.mock(ServletInputStream.class); - Mockito.when(mockServletInputStream.read(ArgumentMatchers.any(), anyInt(), anyInt())).thenAnswer(new Answer<Integer>() { - @Override - public Integer answer(InvocationOnMock invocationOnMock) throws Throwable { - Object[] args = invocationOnMock.getArguments(); - byte[] output = (byte[]) args[0]; - int offset = (int) args[1]; - int length = (int) args[2]; - return byteArrayInputStream.read(output, offset, length); - } - }); + Mockito.when(mockServletInputStream.read(ArgumentMatchers.any(), anyInt(), anyInt())) + .thenAnswer(new Answer<Integer>() { + @Override + public Integer answer(InvocationOnMock invocationOnMock) throws Throwable { + Object[] args = invocationOnMock.getArguments(); + byte[] output = (byte[]) args[0]; + int offset = (int) args[1]; + int length = (int) args[2]; + return byteArrayInputStream.read(output, offset, length); + } + }); Mockito.when(mockedRequest.getInputStream()).thenReturn(mockServletInputStream); return mockedRequest; } } - - diff --git a/provider/register-azure/pom.xml b/provider/register-azure/pom.xml index 32964e837..b4e6e5b58 100644 --- a/provider/register-azure/pom.xml +++ b/provider/register-azure/pom.xml @@ -27,20 +27,20 @@ <artifactId>register-azure</artifactId> <description>Register service on Azure</description> <packaging>jar</packaging> - + <properties> - <osdu.corelibazure.version>0.26.0-rc5</osdu.corelibazure.version> + <osdu.corelibazure.version>0.26.0-rc6</osdu.corelibazure.version> <junit-jupiter.version>5.6.0</junit-jupiter.version> <mockito-junit-jupiter.version>2.23.0</mockito-junit-jupiter.version> - <oauth2-oidc-sdk.version>6.5</oauth2-oidc-sdk.version> + <oauth2-oidc-sdk.version>10.7.1</oauth2-oidc-sdk.version> <woodstox-core.version>6.4.0</woodstox-core.version> - <hibernate-validator.version>5.3.6.Final</hibernate-validator.version> - <jackson-databind.version>2.14.2</jackson-databind.version> - <jackson.version>2.14.2</jackson.version> - <spring-webmvc.version>5.3.22</spring-webmvc.version> + <hibernate-validator.version>8.0.1.Final</hibernate-validator.version> + <jackson-databind.version>2.15.2</jackson-databind.version> + <jackson.version>2.16.1</jackson.version> + <spring-webmvc.version>6.1.3</spring-webmvc.version> <netty.version>4.1.101.Final</netty.version> - <reactor-core.version>3.4.19</reactor-core.version> - <reactor-netty.version>1.1.14</reactor-netty.version> + <reactor-core.version>3.6.2</reactor-core.version> + <reactor-netty.version>1.1.15</reactor-netty.version> <okhttp.version>4.12.0</okhttp.version> </properties> @@ -53,17 +53,17 @@ <type>pom</type> <scope>import</scope> </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-dependencies</artifactId> - <version>2.7.17</version> - <type>pom</type> - <scope>import</scope> - </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-dependencies</artifactId> + <version>${spring-boot.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> <!-- Inherit managed dependencies from core-lib-azure --> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-azure</artifactId> + <artifactId>core-lib-azure-spring6</artifactId> <version>${osdu.corelibazure.version}</version> <type>pom</type> <scope>import</scope> @@ -85,7 +85,7 @@ <!-- OSDU Dependencies --> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-azure</artifactId> + <artifactId>core-lib-azure-spring6</artifactId> <version>${osdu.corelibazure.version}</version> <exclusions> <exclusion> @@ -97,7 +97,8 @@ </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>os-core-common</artifactId> + <artifactId>os-core-common-spring6</artifactId> + <version>0.26.0-rc2</version> </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> @@ -121,13 +122,18 @@ <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> - <version>9.0.70</version> </dependency> <!-- Azure Dependencies --> <dependency> <groupId>com.azure.spring</groupId> <artifactId>azure-spring-boot-starter-active-directory</artifactId> <version>3.14.0</version> + <exclusions> + <exclusion> + <artifactId>msal4j</artifactId> + <groupId>com.microsoft.azure</groupId> + </exclusion> + </exclusions> </dependency> <!-- Spring Dependencies --> @@ -139,24 +145,23 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> + <version>${spring-boot.version}</version> <exclusions> <exclusion> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> </exclusion> - <exclusion> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-to-slf4j</artifactId> - </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-client</artifactId> + <version>${spring-security.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> + <version>${spring-boot.version}</version> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> @@ -167,10 +172,12 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> + <version>${spring-boot.version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-oauth2-jose</artifactId> + <version>${spring-security.version}</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> @@ -215,6 +222,22 @@ <artifactId>okhttp</artifactId> <version>${okhttp.version}</version> </dependency> + <dependency> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <version>6.0.0</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback.contrib</groupId> + <artifactId>logback-json-classic</artifactId> + <version>0.1.5</version> + </dependency> + <dependency> + <groupId>ch.qos.logback.contrib</groupId> + <artifactId>logback-jackson</artifactId> + <version>0.1.5</version> + </dependency> <!-- Test Dependencies --> <dependency> diff --git a/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/di/AzureBootstrapConfig.java b/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/di/AzureBootstrapConfig.java index 435c46868..90a2d3622 100644 --- a/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/di/AzureBootstrapConfig.java +++ b/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/di/AzureBootstrapConfig.java @@ -14,8 +14,8 @@ package org.opengroup.osdu.register.provider.azure.di; -import javax.inject.Inject; -import javax.inject.Named; +import jakarta.inject.Inject; +import jakarta.inject.Named; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; diff --git a/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/di/AzureTenantIdConfig.java b/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/di/AzureTenantIdConfig.java index 2d5a72ad2..0f03b7611 100644 --- a/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/di/AzureTenantIdConfig.java +++ b/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/di/AzureTenantIdConfig.java @@ -3,8 +3,8 @@ package org.opengroup.osdu.register.provider.azure.di; import lombok.Getter; import org.springframework.stereotype.Component; -import javax.inject.Inject; -import javax.inject.Named; +import jakarta.inject.Inject; +import jakarta.inject.Named; @Getter @Component diff --git a/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/security/AzureIstioSecurityConfig.java b/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/security/AzureIstioSecurityConfig.java index 6634cc06c..fc0db33a8 100644 --- a/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/security/AzureIstioSecurityConfig.java +++ b/provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/security/AzureIstioSecurityConfig.java @@ -14,18 +14,29 @@ package org.opengroup.osdu.register.provider.azure.security; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import static org.springframework.security.config.Customizer.withDefaults; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; +@Configuration @EnableWebSecurity -@EnableGlobalMethodSecurity(prePostEnabled = true) -public class AzureIstioSecurityConfig extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.httpBasic().disable() - .csrf().disable(); //AuthN is disabled. AuthN is handled by sidecar proxy +@EnableMethodSecurity +public class AzureIstioSecurityConfig { + @Bean + public SecurityFilterChain defaultFilterChain(HttpSecurity http) throws Exception { + http + .cors(AbstractHttpConfigurer::disable) + .csrf(AbstractHttpConfigurer::disable) + .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll()) + .httpBasic(withDefaults()); + return http.build(); } } diff --git a/provider/register-gc/docs/anthos/README.md b/provider/register-gc/docs/anthos/README.md index 811c97f8b..fea88c4ff 100644 --- a/provider/register-gc/docs/anthos/README.md +++ b/provider/register-gc/docs/anthos/README.md @@ -6,40 +6,40 @@ Define the following environment variables. Must have: -| name | value | description | sensitive? | source | -| --- | --- | --- | --- | --- | -| `SPRING_PROFILES_ACTIVE` | ex `anthos` | Spring profile that activate default configuration for Google Cloud environment | false | - | -| `OPENID_PROVIDER_CLIENT_ID` | `*****` | Client id that represents this service and serves to request tokens, example `workload-identity-legal` |yes| - | -| `OPENID_PROVIDER_CLIENT_SECRET` | `*****` | This client secret that serves to request tokens| yes | - | -| `OPENID_PROVIDER_URL` | `https://keycloack.com/auth/realms/master` | URL of OpenID Connect provider, it will be used as `<OpenID URL> + /.well-known/openid-configuration` to auto configure endpoint for token request | no | - | -| `<POSTGRES_PASSWORD_ENV_VARIABLE_NAME>` | ex `POSTGRES_PASS_OSDU` | Postgres password env name, name of that variable not defined at the service level, the name will be received through partition service. Each tenant can have it's own ENV name value, and it must be present in ENV of Register service | yes | - | -| `<AMQP_PASSWORD_ENV_VARIABLE_NAME>` | ex `AMQP_PASS_OSDU` | AMQP password env name, name of that variable not defined at the service level, the name will be received through partition service. Each tenant can have it's own ENV name value, and it must be present in ENV of Register service | yes | - | -| `<AMQP_ADMIN_PASSWORD_ENV_VARIABLE_NAME>` | ex `AMQP_ADMIN_PASS_OSDU` | AMQP admin password env name, name of that variable not defined at the service level, the name will be received through partition service. Each tenant can have it's own ENV name value, and it must be present in ENV of Register service | yes | - | -| `KMS_PASSWORD` | `*****` | The password used to generate the encryptor's secret key | yes | - | -| `KMS_SALT` | `*****` | The provided salt is expected to be hex-encoded; it should be random and at least 8 bytes in length |yes| - | +| name | value | description | sensitive? | source | +|-------------------------------------------|--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------|--------| +| `SPRING_PROFILES_ACTIVE` | ex `anthos` | Spring profile that activate default configuration for Google Cloud environment | false | - | +| `OPENID_PROVIDER_CLIENT_ID` | `*****` | Client id that represents this service and serves to request tokens, example `workload-identity-legal` | yes | - | +| `OPENID_PROVIDER_CLIENT_SECRET` | `*****` | This client secret that serves to request tokens | yes | - | +| `OPENID_PROVIDER_URL` | `https://keycloack.com/auth/realms/master` | URL of OpenID Connect provider, it will be used as `<OpenID URL> + /.well-known/openid-configuration` to auto configure endpoint for token request | no | - | +| `<POSTGRES_PASSWORD_ENV_VARIABLE_NAME>` | ex `POSTGRES_PASS_OSDU` | Postgres password env name, name of that variable not defined at the service level, the name will be received through partition service. Each tenant can have it's own ENV name value, and it must be present in ENV of Register service | yes | - | +| `<AMQP_PASSWORD_ENV_VARIABLE_NAME>` | ex `AMQP_PASS_OSDU` | AMQP password env name, name of that variable not defined at the service level, the name will be received through partition service. Each tenant can have it's own ENV name value, and it must be present in ENV of Register service | yes | - | +| `<AMQP_ADMIN_PASSWORD_ENV_VARIABLE_NAME>` | ex `AMQP_ADMIN_PASS_OSDU` | AMQP admin password env name, name of that variable not defined at the service level, the name will be received through partition service. Each tenant can have it's own ENV name value, and it must be present in ENV of Register service | yes | - | +| `KMS_PASSWORD` | `*****` | The password used to generate the encryptor's secret key | yes | - | +| `KMS_SALT` | `*****` | The provided salt is expected to be hex-encoded; it should be random and at least 8 bytes in length | yes | - | Defined in default application property file but possible to override: -| name | value | description | sensitive? | source | -| --- | --- | --- | --- | --- | -| `LOG_PREFIX` | `service` | Logging prefix | no | - | -| `SERVER_SERVLET_CONTEXPATH` | `/api/register/v1` | Register context path | no | - | -| `ENTITLEMENTS_API` | ex `http://entitlements/entitlements/v1` | Entitlements API endpoint | no | output of infrastructure deployment | -| `STORAGE_API` | ex `http://storage/api/storage/v2` | Storage API endpoint | no | output of infrastructure deployment | -| `SUBSCRIBER_SECRET` | ex`7a786376626e` | HMAC_SECRET from notification int tests in HEX , pattern(^[a-zA-Z0-9]{8,30}+$) | yes | output of infrastructure deployment | -| `ENVIRONMENT` | ex `dev` | Service environment config | no | - | -| `PARTITION_API` | ex `http://partition/api/partition/v1` | Partition service endpoint | no | - | +| name | value | description | sensitive? | source | +|-----------------------------|------------------------------------------|--------------------------------------------------------------------------------|------------|-------------------------------------| +| `LOG_PREFIX` | `service` | Logging prefix | no | - | +| `SERVER_SERVLET_CONTEXPATH` | `/api/register/v1` | Register context path | no | - | +| `ENTITLEMENTS_API` | ex `http://entitlements/entitlements/v1` | Entitlements API endpoint | no | output of infrastructure deployment | +| `STORAGE_API` | ex `http://storage/api/storage/v2` | Storage API endpoint | no | output of infrastructure deployment | +| `SUBSCRIBER_SECRET` | ex`7a786376626e` | HMAC_SECRET from notification int tests in HEX , pattern(^[a-zA-Z0-9]{8,30}+$) | yes | output of infrastructure deployment | +| `ENVIRONMENT` | ex `dev` | Service environment config | no | - | +| `PARTITION_API` | ex `http://partition/api/partition/v1` | Partition service endpoint | no | - | These variables define service behavior, and are used to switch between `Reference` or `Google Cloud` environments, their overriding and usage in mixed mode was not tested. Usage of spring profiles is preferred. -| name | value | description | sensitive? | source | -| --- | --- | --- | --- | --- | -| `PARTITION_AUTH_ENABLED` | ex `true` or `false` | Disable or enable auth token provisioning for requests to Partition service | no | - | -| `OQMDRIVER` | `rabbitmq` or `pubsub` | Oqm driver mode that defines which message broker will be used | no | - | -| `OSMDRIVER` | `datastore`| Osm driver mode that defines which KV storage will be used | no | - | -| `SERVICE_TOKEN_PROVIDER` | `GCP` or `OPENID` |Service account token provider, `GCP` means use Google service account `OPEIND` means use OpenId provider like `Keycloak` | no | - | -| `KMSCLIENT` | `anthos-kms`| Kms client mode that defines which encryption mechanism will be used. In case of `anthos-kms` in-service encryption is used | no | - | +| name | value | description | sensitive? | source | +|--------------------------|------------------------|-----------------------------------------------------------------------------------------------------------------------------|------------|--------| +| `PARTITION_AUTH_ENABLED` | ex `true` or `false` | Disable or enable auth token provisioning for requests to Partition service | no | - | +| `OQMDRIVER` | `rabbitmq` or `pubsub` | Oqm driver mode that defines which message broker will be used | no | - | +| `OSMDRIVER` | `datastore` | Osm driver mode that defines which KV storage will be used | no | - | +| `SERVICE_TOKEN_PROVIDER` | `GCP` or `OPENID` | Service account token provider, `GCP` means use Google service account `OPEIND` means use OpenId provider like `Keycloak` | no | - | +| `KMSCLIENT` | `anthos-kms` | Kms client mode that defines which encryption mechanism will be used. In case of `anthos-kms` in-service encryption is used | no | - | ## Testing Navigate to register service's root folder and run all the tests: @@ -59,25 +59,25 @@ This section describes how to run cloud OSDU E2E tests (testing/register-test-ba You will need to have the following environment variables defined. -| name | value | description | sensitive? | source | -| --- | --- | --- | --- | --- | -| `TEST_DE_OPS_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_OPS_TESTER` | yes | -- | -| `TEST_DE_OPS_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_OPS_TESTER` | yes | -- | -| `TEST_DE_ADMIN_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_ADMIN_TESTER` | yes | -- | -| `TEST_DE_ADMIN_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_ADMIN_TESTER` | yes | -- | -| `TEST_DE_EDITOR_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_EDITOR_TESTER` | yes | -- | -| `TEST_DE_EDITOR_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_EDITOR_TESTER` | yes | -- | -| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_NO_ACCESS_TESTER` | yes | -- | -| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_NO_ACCESS_TESTER` | yes | -- | -| `TEST_OPENID_PROVIDER_URL` | `https://keycloak.com/auth/realms/osdu` | OpenID provider url | yes | -- | -| `REGISTER_BASE_URL` | ex `https://os-register-dot-opendes.appspot.com/` | Register API endpoint | no | output of infrastructure deployment | -| `ENVIRONMENT` | ex `local` OR `dev` | 'local' for local testing or 'dev' for dev testing | no | - | -| `SUBSCRIBER_SECRET` | ex `********` | String in hex , must match pattern ^[a-zA-Z0-9]{8,30}+$ & be in register variable SUBSCRIBER_SECRET | yes | - | -| `CLIENT_TENANT` | ex `nonexistenttenant` | Client tenant, it is supposed to be tenant that we do not have access to, it can be not existing tenant| no | - | -| `OSDU_TENANT` | ex `osdu` | Osdu tenant | no | - | -| `SUBSCRIPTION_ID` | `********` | A base64 encoded string of subscribed topic + subscriber url ex `records-changedhttp://localhost:8081/api/register/v1/test/challenge/1` | no | - | -| `REGISTER_CUSTOM_PUSH_URL` | ex`https://os-register-dot-opendes.appspot.com/api/register/v1/test/challenge/1` | Register push url, that will act as subscriber | no | - | -| `SUBSCRIBER_PRIVATE_KEY_ID` | `********` | Private key id of DE_OPS_TESTER from notification int tests, required only for integration test| yes | output of infrastructure deployment | +| name | value | description | sensitive? | source | +|------------------------------------------------|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------|-------------------------------------| +| `TEST_DE_OPS_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_OPS_TESTER` | yes | -- | +| `TEST_DE_OPS_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_OPS_TESTER` | yes | -- | +| `TEST_DE_ADMIN_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_ADMIN_TESTER` | yes | -- | +| `TEST_DE_ADMIN_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_ADMIN_TESTER` | yes | -- | +| `TEST_DE_EDITOR_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_EDITOR_TESTER` | yes | -- | +| `TEST_DE_EDITOR_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_EDITOR_TESTER` | yes | -- | +| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_ID` | `********` | Client Id for `DE_NO_ACCESS_TESTER` | yes | -- | +| `TEST_NO_ACCESS_OPENID_PROVIDER_CLIENT_SECRET` | `********` | | Client secret for `DE_NO_ACCESS_TESTER` | yes | -- | +| `TEST_OPENID_PROVIDER_URL` | `https://keycloak.com/auth/realms/osdu` | OpenID provider url | yes | -- | +| `REGISTER_BASE_URL` | ex `https://os-register-dot-opendes.appspot.com/` | Register API endpoint | no | output of infrastructure deployment | +| `ENVIRONMENT` | ex `local` OR `dev` | 'local' for local testing or 'dev' for dev testing | no | - | +| `SUBSCRIBER_SECRET` | ex `********` | String in hex , must match pattern ^[a-zA-Z0-9]{8,30}+$ & be in register variable SUBSCRIBER_SECRET | yes | - | +| `CLIENT_TENANT` | ex `nonexistenttenant` | Client tenant, it is supposed to be tenant that we do not have access to, it can be not existing tenant | no | - | +| `OSDU_TENANT` | ex `osdu` | OSDU tenant | no | - | +| `SUBSCRIPTION_ID` | `********` | A base64 encoded string of subscribed topic + subscriber url ex `records-changedhttp://localhost:8081/api/register/v1/test/challenge/1` | no | - | +| `REGISTER_CUSTOM_PUSH_URL` | ex`https://os-register-dot-opendes.appspot.com/api/register/v1/test/challenge/1` | Register push url, that will act as subscriber | no | - | +| `SUBSCRIBER_PRIVATE_KEY_ID` | `********` | Private key id of DE_OPS_TESTER from notification int tests, required only for integration test | yes | output of infrastructure deployment | **Entitlements configuration for integration accounts** @@ -130,20 +130,20 @@ For example, this is how **Datastore** OSM driver contains records for "SUBSCRIP And this is how **Postgres** OSM driver does. Notice, the above hierarchy is kept, but Postgres uses alternative entities for it. -| Datastore hierarchy level | | Postgres alternative used | -|---------------------------|-----|----------------------------| -| partition (Google Cloud project) | == | Postgres server URL | -| namespace | == | Schema | -| kind | == | Table | -| record | == | '<multiple table records>' | -| columns | == | id, data (jsonb) | +| Datastore hierarchy level | | Postgres alternative used | +|----------------------------------|----|----------------------------| +| partition (Google Cloud project) | == | Postgres server URL | +| namespace | == | Schema | +| kind | == | Table | +| record | == | '<multiple table records>' | +| columns | == | id, data (jsonb) | As we can see in the above table, Postgres uses different approach in storing business data in records. Not like Datastore, which segments data into multiple physical columns, Postgres organises them into the single JSONB "data" column. It allows provisioning new data registers easily not taking care about specifics of certain registers structure. In the current OSM version (as on December'21) the Postgres OSM driver is not able to create new tables in runtime. -So this is a responsibility of DevOps / CICD to provision all required SQL tables (for all required data kinds) when on new +So this is a responsibility of DevOps / CI/CD to provision all required SQL tables (for all required data kinds) when on new environment or tenant provisioning when using Postgres. Detailed instructions (with examples) for creating new tables is in the **OSM module Postgres driver README.md** `org/opengroup/osdu/core/gcp/osm/translate/postgresql/README.md` @@ -186,11 +186,11 @@ It can be overridden by: **PropertySet:** -| Property | Description | -| --- | --- | -| osm.postgres.datasource.url | server URL | -| osm.postgres.datasource.username | username | -| osm.postgres.datasource.password | password | +| Property | Description | +|----------------------------------|-------------| +| osm.postgres.datasource.url | server URL | +| osm.postgres.datasource.username | username | +| osm.postgres.datasource.password | password | <details><summary>Example of a definition for a single tenant</summary> @@ -223,19 +223,19 @@ It can be overridden by: **PropertySet** (for two types of connection: messaging and admin operations): -| Property | Description | -| --- | --- | -| oqm.rabbitmq.amqp.host | messaging hostname or IP | -| oqm.rabbitmq.amqp.port | - port | -| oqm.rabbitmq.amqp.path | - path | -| oqm.rabbitmq.amqp.username | - username | -| oqm.rabbitmq.amqp.password | - password | -| oqm.rabbitmq.admin.schema | admin host schema | -| oqm.rabbitmq.admin.host | - host name | -| oqm.rabbitmq.admin.port | - port | -| oqm.rabbitmq.admin.path | - path | -| oqm.rabbitmq.admin.username | - username | -| oqm.rabbitmq.admin.password | - password | +| Property | Description | +|-----------------------------|--------------------------| +| oqm.rabbitmq.amqp.host | messaging hostname or IP | +| oqm.rabbitmq.amqp.port | - port | +| oqm.rabbitmq.amqp.path | - path | +| oqm.rabbitmq.amqp.username | - username | +| oqm.rabbitmq.amqp.password | - password | +| oqm.rabbitmq.admin.schema | admin host schema | +| oqm.rabbitmq.admin.host | - host name | +| oqm.rabbitmq.admin.port | - port | +| oqm.rabbitmq.admin.path | - path | +| oqm.rabbitmq.admin.username | - username | +| oqm.rabbitmq.admin.password | - password | <details><summary>Example of a single tenant definition</summary> diff --git a/provider/register-gc/pom.xml b/provider/register-gc/pom.xml index 0a70fd47b..f233cf800 100644 --- a/provider/register-gc/pom.xml +++ b/provider/register-gc/pom.xml @@ -1,12 +1,13 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - Copyright 2017-2020 Schlumberger + Copyright 2020-2024 Google LLC + Copyright 2020-2024 EPAM Systems, Inc Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -16,152 +17,155 @@ --> <project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - <artifactId>register-gc</artifactId> - <description>Register service</description> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <artifactId>register-gc</artifactId> + <description>Register service</description> - <properties> - <jackson-databind.version>2.14.2</jackson-databind.version> - <jackson.version>2.14.2</jackson.version> - </properties> + <properties> + <jackson-databind.version>2.16.1</jackson-databind.version> + <jackson.version>2.16.1</jackson.version> + </properties> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>com.google.cloud</groupId> - <artifactId>libraries-bom</artifactId> - <version>26.14.0</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <packaging>jar</packaging> - - <parent> - <groupId>org.opengroup.osdu</groupId> - <artifactId>os-register</artifactId> - <version>0.26.0-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> - </parent> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>com.google.cloud</groupId> + <artifactId>libraries-bom</artifactId> + <version>26.14.0</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <packaging>jar</packaging> - <dependencies> - <dependency> - <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-gc</artifactId> - <version>0.25.0</version> - </dependency> - <dependency> - <groupId>org.opengroup.osdu</groupId> - <artifactId>oqm</artifactId> - <version>0.25.0</version> - </dependency> - <dependency> - <groupId>org.opengroup.osdu</groupId> - <artifactId>osm</artifactId> - <version>0.25.0</version> - </dependency> - <dependency> - <groupId>org.opengroup.osdu</groupId> - <artifactId>os-core-common</artifactId> - </dependency> + <parent> + <groupId>org.opengroup.osdu</groupId> + <artifactId>os-register</artifactId> + <version>0.26.0-SNAPSHOT</version> + <relativePath>../../pom.xml</relativePath> + </parent> - <dependency> - <groupId>org.opengroup.osdu</groupId> - <artifactId>register-core</artifactId> - <version>0.26.0-SNAPSHOT</version> - </dependency> + <dependencies> + <dependency> + <groupId>org.opengroup.osdu</groupId> + <artifactId>register-core</artifactId> + <version>0.26.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>org.opengroup.osdu</groupId> + <artifactId>core-lib-gc-spring6</artifactId> + <version>0.26.0-rc5</version> + </dependency> + <dependency> + <groupId>org.opengroup.osdu</groupId> + <artifactId>oqm</artifactId> + <version>0.25.0</version> + </dependency> + <dependency> + <groupId>org.opengroup.osdu</groupId> + <artifactId>osm</artifactId> + <version>0.25.0</version> + </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-webmvc</artifactId> - </dependency> + <dependency> + <groupId>jakarta.annotation</groupId> + <artifactId>jakarta.annotation-api</artifactId> + <version>2.1.1</version> + </dependency> - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-config</artifactId> - </dependency> + <dependency> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <version>6.0.0</version> + <scope>provided</scope> + </dependency> - <dependency> - <groupId>ch.qos.logback.contrib</groupId> - <artifactId>logback-json-classic</artifactId> - <version>0.1.5</version> - </dependency> + <dependency> + <groupId>org.springframework.security</groupId> + <artifactId>spring-security-config</artifactId> + </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <scope>test</scope> - </dependency> + <dependency> + <groupId>ch.qos.logback.contrib</groupId> + <artifactId>logback-json-classic</artifactId> + <version>0.1.5</version> + </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.13.2</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.mockito</groupId> - <artifactId>mockito-core</artifactId> - <version>3.12.0</version> - <scope>test</scope> - </dependency> - </dependencies> + <!-- Testing --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.13.2</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>3.12.0</version> + <scope>test</scope> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-maven-plugin</artifactId> - <version>2.7.11</version> - <executions> - <execution> - <goals> - <goal>repackage</goal> - </goals> - <configuration> - <classifier>spring-boot</classifier> - <mainClass>org.opengroup.osdu.register.provider.gcp.RegisterApplication</mainClass> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.jacoco</groupId> - <artifactId>jacoco-maven-plugin</artifactId> - <version>0.8.8</version> - <executions> - <execution> - <goals> - <goal>prepare-agent</goal> - </goals> - </execution> - <execution> - <id>report</id> - <phase>prepare-package</phase> - <goals> - <goal>report</goal> - </goals> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <version>3.0.0-M9</version> - <dependencies> - <dependency> - <groupId>org.apache.maven.surefire</groupId> - <artifactId>surefire-junit47</artifactId> - <version>3.0.0-M9</version> - </dependency> - </dependencies> - <configuration> - <trimStackTrace>false</trimStackTrace> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + <configuration> + <classifier>spring-boot</classifier> + <mainClass>org.opengroup.osdu.register.provider.gcp.RegisterApplication</mainClass> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.jacoco</groupId> + <artifactId>jacoco-maven-plugin</artifactId> + <version>0.8.8</version> + <executions> + <execution> + <goals> + <goal>prepare-agent</goal> + </goals> + </execution> + <execution> + <id>report</id> + <phase>prepare-package</phase> + <goals> + <goal>report</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <version>3.0.0-M9</version> + <dependencies> + <dependency> + <groupId>org.apache.maven.surefire</groupId> + <artifactId>surefire-junit47</artifactId> + <version>3.0.0-M9</version> + </dependency> + </dependencies> + <configuration> + <trimStackTrace>false</trimStackTrace> + </configuration> + </plugin> + </plugins> + </build> </project> diff --git a/provider/register-gc/src/main/appengine/app.yaml b/provider/register-gc/src/main/appengine/app.yaml deleted file mode 100644 index 114e429d7..000000000 --- a/provider/register-gc/src/main/appengine/app.yaml +++ /dev/null @@ -1,42 +0,0 @@ -service: os-register - -runtime: java -env: flex - -api_version: 1 -threadsafe: yes - -resources: - cpu: 1 - memory_gb: 2.4 - -automatic_scaling: - min_num_instances: 2 - max_num_instances: 10 - cool_down_period_sec: 120 - cpu_utilization: - target_utilization: 0.4 - -# TODO: fix once AppEngine logger is injected -#liveness_check: -# path: 'api/register/v1/ah/liveness_check' -# timeout_sec: 4 -# check_interval_sec: 10 -# failure_threshold: 3 -# success_threshold: 2 -# initial_delay_sec: 300 -# -#readiness_check: -# path: 'api/register/v1/ah/readiness_check' -# timeout_sec: 4 -# check_interval_sec: 5 -# failure_threshold: 2 -# success_threshold: 2 -# app_start_timeout_sec: 300 - -env_variables: - JETTY_MODULES_ENABLE: 'gzip' - JAVA_OPTS: -Xms2048m -Xmx3072m - SPRING_PROFILES_ACTIVE: 'dev' - SUBSCRIBER_SECRET: "SUBSCRIBER-SECRET" - SUBSCRIBER_PRIVATE_KEY_ID: "SUBSCRIBER-PRIVATE-KEY-ID" \ No newline at end of file diff --git a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/RegisterApplication.java b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/RegisterApplication.java index 841bf78aa..cda1f99a7 100644 --- a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/RegisterApplication.java +++ b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/RegisterApplication.java @@ -17,7 +17,7 @@ package org.opengroup.osdu.register.provider.gcp; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; diff --git a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/api/SubscriberApiGcp.java b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/api/SubscriberApiGcp.java index 89b59aefb..df3c073a2 100644 --- a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/api/SubscriberApiGcp.java +++ b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/api/SubscriberApiGcp.java @@ -28,8 +28,8 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.annotation.RequestScope; -import javax.inject.Inject; -import javax.inject.Provider; +import jakarta.inject.Inject; +import jakarta.inject.Provider; import java.util.List; @RestController diff --git a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/api/test/SubscriberListenerTestApi.java b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/api/test/SubscriberListenerTestApi.java index fe44cf245..e06ce581c 100644 --- a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/api/test/SubscriberListenerTestApi.java +++ b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/api/test/SubscriberListenerTestApi.java @@ -14,10 +14,10 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import javax.inject.Inject; -import javax.inject.Provider; -import javax.validation.ValidationException; -import javax.validation.constraints.NotBlank; +import jakarta.inject.Inject; +import jakarta.inject.Provider; +import jakarta.validation.ValidationException; +import jakarta.validation.constraints.NotBlank; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; @@ -43,7 +43,7 @@ public class SubscriberListenerTestApi { @GetMapping("challenge/{path}") public ChallengeResponse testCrc(@PathVariable String path, @RequestParam("crc") @NotBlank String crc, - @RequestParam("hmac") @NotBlank String hmac) { + @RequestParam("hmac") @NotBlank String hmac) { try { signatureService.verifyHmacSignature(hmac, this.serviceConfig.getSubscriberSecret()); logger.debug("GC tests: Signature verified and sending response"); diff --git a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/logging/AppengineLogFactory.java b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/logging/AppengineLogFactory.java deleted file mode 100644 index e356da193..000000000 --- a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/logging/AppengineLogFactory.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright 2020 Google LLC - Copyright 2020 EPAM Systems, Inc - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - */ - -package org.opengroup.osdu.register.provider.gcp.logging; - -import org.opengroup.osdu.core.common.logging.ILogger; -import org.opengroup.osdu.core.gcp.logging.logger.appengine.AppEngineLoggingProvider; - -import org.springframework.beans.factory.FactoryBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Lazy; -import org.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; - -@Component -@ConditionalOnProperty(name="enable.appengine.log.factory", havingValue = "true") -@Primary -@Lazy -public class AppengineLogFactory implements FactoryBean<ILogger> { - - private AppEngineLoggingProvider appEngineLoggingProvider = new AppEngineLoggingProvider(); - - @Override - public ILogger getObject() throws Exception { - return appEngineLoggingProvider.getLogger(); - } - - @Override - public Class<?> getObjectType() { - return ILogger.class; - } -} diff --git a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/security/GSuiteSecurityConfig.java b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/security/GSuiteSecurityConfig.java index c9a1b267e..ce5415547 100644 --- a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/security/GSuiteSecurityConfig.java +++ b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/security/GSuiteSecurityConfig.java @@ -17,19 +17,29 @@ package org.opengroup.osdu.register.provider.gcp.security; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import static org.springframework.security.config.Customizer.withDefaults; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; +@Configuration @EnableWebSecurity -@EnableGlobalMethodSecurity(prePostEnabled = true) -public class GSuiteSecurityConfig extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(HttpSecurity httpSecurity) throws Exception { - httpSecurity - .httpBasic().disable() - .csrf().disable(); //disable default authN. AuthN handled by endpoints proxy +@EnableMethodSecurity +public class GSuiteSecurityConfig { + @Bean + public SecurityFilterChain defaultFilterChain(HttpSecurity http) throws Exception { + http + .cors(AbstractHttpConfigurer::disable) + .csrf(AbstractHttpConfigurer::disable) + .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll()) + .httpBasic(withDefaults()); + return http.build(); } } \ No newline at end of file diff --git a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/subscriber/OsmAccess.java b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/subscriber/OsmAccess.java index 2688c51b2..ed6fdd1bc 100644 --- a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/subscriber/OsmAccess.java +++ b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/subscriber/OsmAccess.java @@ -40,7 +40,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Repository; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.sql.Timestamp; import java.util.List; diff --git a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/subscriber/model/SubscriptionDto.java b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/subscriber/model/SubscriptionDto.java index 7aa6b229a..e16291c7b 100644 --- a/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/subscriber/model/SubscriptionDto.java +++ b/provider/register-gc/src/main/java/org/opengroup/osdu/register/provider/gcp/subscriber/model/SubscriptionDto.java @@ -17,8 +17,8 @@ package org.opengroup.osdu.register.provider.gcp.subscriber.model; import java.sql.Timestamp; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Pattern; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Pattern; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -27,22 +27,21 @@ import lombok.NoArgsConstructor; @AllArgsConstructor @NoArgsConstructor public class SubscriptionDto { - private String id; - @NotBlank - @Pattern(regexp = "^[A-Za-z0-9- ]{2,50}") - private String name; - @Pattern(regexp = "^[A-Za-z0-9. ]{0,255}") - private String description; - @NotBlank - private String topic; - @NotBlank - private String pushEndpoint; - private String createdBy; - private Timestamp createdOnEpoch; - private String notificationId; - - private String secretValue; - private String secretType; + private String id; + @NotBlank + @Pattern(regexp = "^[A-Za-z0-9- ]{2,50}") + private String name; + @Pattern(regexp = "^[A-Za-z0-9. ]{0,255}") + private String description; + @NotBlank + private String topic; + @NotBlank + private String pushEndpoint; + private String createdBy; + private Timestamp createdOnEpoch; + private String notificationId; + + private String secretValue; + private String secretType; } - diff --git a/provider/register-gc/src/main/resources/logback.xml b/provider/register-gc/src/main/resources/logback.xml deleted file mode 100644 index 8d6d9b140..000000000 --- a/provider/register-gc/src/main/resources/logback.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<configuration> - <include resource="org/springframework/boot/logging/logback/defaults.xml"/> - <property resource="application.properties" /> - <logger name="org.opengroup.osdu" level="${LOG_LEVEL}"/> - <springProfile name="local"> - <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> - <encoder> - <pattern>%yellow([%thread]) %highlight(| %-5level |) %green(%d) %cyan(| %logger{15} |) %highlight(%msg) %n</pattern> - <charset>utf8</charset> - </encoder> - </appender> - <root level="info"> - <appender-ref ref="CONSOLE"/> - </root> - </springProfile> - - <springProfile name="!local"> - <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender"> - <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> - <layout class="ch.qos.logback.contrib.json.classic.JsonLayout"> - <timestampFormat>yyyy-MM-dd HH:mm:ss.SSS</timestampFormat> - <timestampFormatTimezoneId>Etc/UTC</timestampFormatTimezoneId> - <appendLineSeparator>true</appendLineSeparator> - - <jsonFormatter class="org.opengroup.osdu.core.gcp.logging.formatter.GoogleJsonFormatter"> - <prettyPrint>false</prettyPrint> - </jsonFormatter> - </layout> - </encoder> - </appender> - - <root level="info"> - <appender-ref ref="stdout"/> - </root> - </springProfile> - -</configuration> \ No newline at end of file diff --git a/provider/register-ibm/pom.xml b/provider/register-ibm/pom.xml index c31e82e6c..2f9b37adf 100644 --- a/provider/register-ibm/pom.xml +++ b/provider/register-ibm/pom.xml @@ -26,9 +26,9 @@ </parent> <properties> - <jackson.version>2.15.0-rc1</jackson.version> - <jackson-databind.version>2.14.2</jackson-databind.version> - <jackson-dataformat-cbor.version>2.14.2</jackson-dataformat-cbor.version> + <jackson.version>2.16.1</jackson.version> + <jackson-databind.version>2.16.1</jackson-databind.version> + <jackson-dataformat-cbor.version>2.16.1</jackson-dataformat-cbor.version> </properties> <dependencyManagement> @@ -50,7 +50,7 @@ <dependency> <groupId>org.opengroup.osdu</groupId> <artifactId>os-core-lib-ibm</artifactId> - <version>0.25.1</version> + <version>0.26.0-rc8</version> <exclusions> <exclusion> <groupId>org.springframework.security</groupId> @@ -71,7 +71,8 @@ </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>os-core-common</artifactId> + <artifactId>os-core-common-spring6</artifactId> + <version>${os-core-common-spring6.version}</version> <exclusions> <exclusion> <groupId>org.apache.tomcat.embed</groupId> diff --git a/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/RegisterApplication.java b/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/RegisterApplication.java index 12e1de8fa..8eec276f0 100644 --- a/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/RegisterApplication.java +++ b/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/RegisterApplication.java @@ -11,7 +11,7 @@ import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.PropertySource; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; @SpringBootApplication(exclude = { MongoAutoConfiguration.class, diff --git a/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/api/SubscriptionApi.java b/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/api/SubscriptionApi.java index c0b04c8d6..2026a18a5 100644 --- a/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/api/SubscriptionApi.java +++ b/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/api/SubscriptionApi.java @@ -40,32 +40,35 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.context.annotation.RequestScope; -import javax.inject.Inject; -import javax.inject.Provider; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; +import jakarta.inject.Inject; +import jakarta.inject.Provider; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; import java.util.List; @RestController @RequestMapping("/") @RequestScope @Validated -public class SubscriptionApi{ - +public class SubscriptionApi { + @Inject private Provider<ISubscriptionRepository> subscriptionRepository; - + @GetMapping("subscription/topic/{topic}") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + ServiceRole.EDITOR + "')") - public ResponseEntity<List<SubscriptionInfo>> getSubscriptionsByTopic(@PathVariable("topic") @NotBlank String topic) { - //removed getByTopic from ISubscriptionRepository, to remove dependency on register-core for now. Need to change afterwards - SubscriptionRepository subsRepo = (SubscriptionRepository) subscriptionRepository.get(); - List<Subscription> subscriptions = subsRepo.getByTopic(topic); + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + + ServiceRole.EDITOR + "')") + public ResponseEntity<List<SubscriptionInfo>> getSubscriptionsByTopic( + @PathVariable("topic") @NotBlank String topic) { + // removed getByTopic from ISubscriptionRepository, to remove dependency on + // register-core for now. Need to change afterwards + SubscriptionRepository subsRepo = (SubscriptionRepository) subscriptionRepository.get(); + List<Subscription> subscriptions = subsRepo.getByTopic(topic); List<SubscriptionInfo> subsInfoList = new ArrayList<SubscriptionInfo>(); - for(Subscription subs: subscriptions) { - subsInfoList.add(new SubscriptionInfo(subs)); + for (Subscription subs : subscriptions) { + subsInfoList.add(new SubscriptionInfo(subs)); } return new ResponseEntity<>(subsInfoList, HttpStatus.OK); } - + } diff --git a/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/ddms/datastore/DatastoreMultiTenantAccess.java b/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/ddms/datastore/DatastoreMultiTenantAccess.java index 0718c59dd..e0f6bb998 100644 --- a/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/ddms/datastore/DatastoreMultiTenantAccess.java +++ b/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/ddms/datastore/DatastoreMultiTenantAccess.java @@ -8,7 +8,7 @@ import java.net.MalformedURLException; import java.util.HashMap; import java.util.Map; -import javax.annotation.PostConstruct; +import jakarta.annotation.PostConstruct; import org.apache.commons.lang3.StringUtils; import org.opengroup.osdu.core.common.model.http.AppException; diff --git a/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/security/IBMSecurityConfig.java b/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/security/IBMSecurityConfig.java index 692c78888..23f320e40 100644 --- a/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/security/IBMSecurityConfig.java +++ b/provider/register-ibm/src/main/java/org/opengroup/osdu/register/provider/ibm/security/IBMSecurityConfig.java @@ -3,25 +3,29 @@ package org.opengroup.osdu.register.provider.ibm.security; -import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; +import static org.springframework.security.config.Customizer.withDefaults; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; +import org.springframework.security.config.http.SessionCreationPolicy; +import org.springframework.security.web.SecurityFilterChain; +@Configuration @EnableWebSecurity -@EnableGlobalMethodSecurity(prePostEnabled = true) -public class IBMSecurityConfig extends WebSecurityConfigurerAdapter { - - @Override - protected void configure(HttpSecurity http) throws Exception { - http.csrf().disable(); - // .authorizeRequests() - // .antMatchers("/test/**","/v1/api-docs", - // "/configuration/ui", - // "/swagger-resources/**", - // "/configuration/security", - // "/swagger-ui.html", - // "/webjars/**").permitAll() - // .anyRequest().authenticated().and().oauth2ResourceServer().jwt(); - } +@EnableMethodSecurity +public class IBMSecurityConfig { + @Bean + public SecurityFilterChain defaultFilterChain(HttpSecurity http) throws Exception { + http + .cors(AbstractHttpConfigurer::disable) + .csrf(AbstractHttpConfigurer::disable) + .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) + .authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll()) + .httpBasic(withDefaults()); + return http.build(); + } } diff --git a/register-core/pom.xml b/register-core/pom.xml index 4eeefef7e..4ee406149 100644 --- a/register-core/pom.xml +++ b/register-core/pom.xml @@ -29,18 +29,20 @@ </parent> <properties> - <jackson-databind.version>2.14.2</jackson-databind.version> - <jackson.version>2.14.2</jackson.version> + <jackson-databind.version>2.16.1</jackson-databind.version> + <jackson.version>2.16.1</jackson.version> + <spring-core.version>6.2.2</spring-core.version> + <spring-boot.version>3.2.3</spring-boot.version> </properties> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-core</artifactId> - </dependency> - </dependencies> - </dependencyManagement> + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </dependency> + </dependencies> + </dependencyManagement> <dependencies> <dependency> @@ -77,15 +79,11 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-jersey</artifactId> - </dependency> - + </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>os-core-common</artifactId> + <artifactId>os-core-common-spring6</artifactId> + <version>${os-core-common-spring6.version}</version> </dependency> <dependency> <groupId>com.nimbusds</groupId> @@ -119,11 +117,6 @@ </exclusions> </dependency> - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-validator</artifactId> - <version>6.2.5.Final</version> - </dependency> <dependency> <groupId>com.fasterxml.jackson.datatype</groupId> <artifactId>jackson-datatype-joda</artifactId> @@ -134,26 +127,15 @@ <artifactId>joda-time</artifactId> <version>2.10.2</version> </dependency> - <dependency> - <groupId>org.glassfish.jersey.core</groupId> - <artifactId>jersey-common</artifactId> - <version>2.28</version> - <exclusions> - <exclusion> - <artifactId>jakarta.ws.rs-api</artifactId> - <groupId>jakarta.ws.rs</groupId> - </exclusion> - </exclusions> - </dependency> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.9.4</version> </dependency> <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + <version>6.0.0</version> <scope>provided</scope> </dependency> <dependency> @@ -183,11 +165,21 @@ <version>${jackson.version}</version> </dependency> <dependency> - <groupId>javax.el</groupId> - <artifactId>javax.el-api</artifactId> - <version>2.2.1</version> + <groupId>jakarta.el</groupId> + <artifactId>jakarta.el-api</artifactId> + <version>5.0.1</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.glassfish.jersey.core</groupId> + <artifactId>jersey-common</artifactId> + <version>3.1.5</version> + </dependency> + <dependency> + <groupId>org.hibernate.validator</groupId> + <artifactId>hibernate-validator</artifactId> + <version>8.0.1.Final</version> + </dependency> <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> diff --git a/register-core/src/main/java/org/opengroup/osdu/register/action/model/CreateActionDto.java b/register-core/src/main/java/org/opengroup/osdu/register/action/model/CreateActionDto.java index 3be10529c..28399d1c8 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/action/model/CreateActionDto.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/action/model/CreateActionDto.java @@ -21,12 +21,12 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.constraints.Email; -import javax.validation.constraints.NotEmpty; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotEmpty; import org.hibernate.validator.constraints.URL; -import javax.validation.Valid; -import javax.validation.constraints.Pattern; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Pattern; @Data @Builder diff --git a/register-core/src/main/java/org/opengroup/osdu/register/action/model/TestActionRequest.java b/register-core/src/main/java/org/opengroup/osdu/register/action/model/TestActionRequest.java index dd5d92685..910780cca 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/action/model/TestActionRequest.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/action/model/TestActionRequest.java @@ -23,8 +23,8 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotNull; @Data @Builder diff --git a/register-core/src/main/java/org/opengroup/osdu/register/action/model/validators/FilterValidator.java b/register-core/src/main/java/org/opengroup/osdu/register/action/model/validators/FilterValidator.java index f4cecebd2..e382d4e48 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/action/model/validators/FilterValidator.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/action/model/validators/FilterValidator.java @@ -19,8 +19,8 @@ package org.opengroup.osdu.register.action.model.validators; import com.google.common.base.Strings; import org.opengroup.osdu.register.action.model.Filter; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import java.util.List; public class FilterValidator implements ConstraintValidator<ValidFilter, Filter> { diff --git a/register-core/src/main/java/org/opengroup/osdu/register/action/model/validators/ValidFilter.java b/register-core/src/main/java/org/opengroup/osdu/register/action/model/validators/ValidFilter.java index 9ea801b16..09af90a72 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/action/model/validators/ValidFilter.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/action/model/validators/ValidFilter.java @@ -16,8 +16,8 @@ package org.opengroup.osdu.register.action.model.validators; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.*; @Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE, ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) diff --git a/register-core/src/main/java/org/opengroup/osdu/register/api/ActionApi.java b/register-core/src/main/java/org/opengroup/osdu/register/api/ActionApi.java index b407aab21..b37e534bd 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/api/ActionApi.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/api/ActionApi.java @@ -53,9 +53,9 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.annotation.RequestScope; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Pattern; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Pattern; import java.util.Collections; import java.util.List; @@ -68,136 +68,185 @@ import static org.apache.http.HttpStatus.SC_NOT_FOUND; @Tag(name = "action-api", description = "Action API") public class ActionApi { - @Autowired - private IActionRepo repo; - @Autowired - private TestActionService testActionService; - @Autowired - private AuditLogger auditLogger; - @Autowired - private JaxRsDpsLog log; - @Autowired - private IRetrieveActionService retrieveActionService; + @Autowired + private IActionRepo repo; + @Autowired + private TestActionService testActionService; + @Autowired + private AuditLogger auditLogger; + @Autowired + private JaxRsDpsLog log; + @Autowired + private IRetrieveActionService retrieveActionService; - @Operation(summary = "${actionApi.createAction.summary}", description = "${actionApi.createAction.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "action-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "201", description = "Created", content = { @Content(schema = @Schema(implementation = Action.class)) }), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "409", description = "Conflict", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @PostMapping("action") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "')") - public ResponseEntity<Action> createAction(@RequestBody @Valid CreateActionDto createActionDto) { - Action action = new Action(createActionDto); - Action output = repo.createAction(action); - this.auditLogger.createActionSuccess(Collections.singletonList(action.toString())); - return new ResponseEntity<>(output, HttpStatus.CREATED); - } + @Operation(summary = "${actionApi.createAction.summary}", description = "${actionApi.createAction.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "action-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Created", content = { + @Content(schema = @Schema(implementation = Action.class)) }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @PostMapping("action") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "')") + public ResponseEntity<Action> createAction(@RequestBody @Valid CreateActionDto createActionDto) { + Action action = new Action(createActionDto); + Action output = repo.createAction(action); + this.auditLogger.createActionSuccess(Collections.singletonList(action.toString())); + return new ResponseEntity<>(output, HttpStatus.CREATED); + } - @Operation(summary = "${actionApi.retrieveAction.summary}", description = "${actionApi.retrieveAction.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "action-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK", content = { @Content(array = @ArraySchema(schema = @Schema(implementation = Action.class)))}), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "409", description = "Conflict", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "429", description = "Too Many Requests", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @PostMapping("action:retrieve") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") - public ResponseEntity<List<Action>> retrieveAction(@RequestBody JsonNode jsonObject) { - try { - List<Action> query = repo.getAllActions(); - List<Action> output = this.retrieveActionService.getActions(query, jsonObject); - this.auditLogger.readMultipleActionsSuccess(Collections.singletonList(output.toString())); - return new ResponseEntity<>(output, HttpStatus.OK); - } catch (Exception e) { - this.log.error("retrieve action failed", e); - return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); + @Operation(summary = "${actionApi.retrieveAction.summary}", description = "${actionApi.retrieveAction.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "action-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK", content = { + @Content(array = @ArraySchema(schema = @Schema(implementation = Action.class))) }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "429", description = "Too Many Requests", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @PostMapping("action:retrieve") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") + public ResponseEntity<List<Action>> retrieveAction(@RequestBody JsonNode jsonObject) { + try { + List<Action> query = repo.getAllActions(); + List<Action> output = this.retrieveActionService.getActions(query, jsonObject); + this.auditLogger.readMultipleActionsSuccess(Collections.singletonList(output.toString())); + return new ResponseEntity<>(output, HttpStatus.OK); + } catch (Exception e) { + this.log.error("retrieve action failed", e); + return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); + } } - } - @Operation(summary = "${actionApi.deleteAction.summary}", description = "${actionApi.deleteAction.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "action-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "204", description = "No Content"), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "429", description = "Too Many Requests", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @DeleteMapping("action/{id}") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "')") - public ResponseEntity deleteAction(@Parameter(description = "Action Registration Id", example = "petrel-launch-project", - in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9-]{2,50}")) - @PathVariable("id") @NotBlank @Pattern(regexp = "^[A-Za-z0-9-]{2,50}") String id) { - if (repo.delete(id)) { - this.auditLogger.deleteActionSuccess(Collections.singletonList(id)); - return new ResponseEntity(HttpStatus.NO_CONTENT); - } else { - throw new AppException(SC_NOT_FOUND, "Not found", String.format("Could not delete Action with id %s because it could not be found", id)); + @Operation(summary = "${actionApi.deleteAction.summary}", description = "${actionApi.deleteAction.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "action-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "429", description = "Too Many Requests", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @DeleteMapping("action/{id}") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "')") + public ResponseEntity deleteAction( + @Parameter(description = "Action Registration Id", example = "petrel-launch-project", in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9-]{2,50}")) @PathVariable("id") @NotBlank @Pattern(regexp = "^[A-Za-z0-9-]{2,50}") String id) { + if (repo.delete(id)) { + this.auditLogger.deleteActionSuccess(Collections.singletonList(id)); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } else { + throw new AppException(SC_NOT_FOUND, "Not found", String.format( + "Could not delete Action with id %s because it could not be found", id)); + } } - } - @Operation(summary = "${actionApi.getAction.summary}", description = "${actionApi.getAction.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "action-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK", content = {@Content(schema = @Schema(implementation = Action.class ))}), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "409", description = "Conflict", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "429", description = "Too Many Requests", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @GetMapping("action/{id}") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") - public ResponseEntity<Action> getAction(@Parameter(description = "Action Registration Id", example = "petrel-launch-project", - in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9-]{2,50}")) - @PathVariable("id") @NotBlank @Pattern(regexp = "^[A-Za-z0-9-]{2,50}") String id) { - Action action = this.repo.get(id); - this.auditLogger.readActionSuccess(Collections.singletonList(action.toString())); - return new ResponseEntity<>(action, HttpStatus.OK); - } + @Operation(summary = "${actionApi.getAction.summary}", description = "${actionApi.getAction.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "action-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK", content = { + @Content(schema = @Schema(implementation = Action.class)) }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "429", description = "Too Many Requests", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @GetMapping("action/{id}") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") + public ResponseEntity<Action> getAction( + @Parameter(description = "Action Registration Id", example = "petrel-launch-project", in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9-]{2,50}")) @PathVariable("id") @NotBlank @Pattern(regexp = "^[A-Za-z0-9-]{2,50}") String id) { + Action action = this.repo.get(id); + this.auditLogger.readActionSuccess(Collections.singletonList(action.toString())); + return new ResponseEntity<>(action, HttpStatus.OK); + } - @Operation(summary = "${actionApi.testAction.summary}", description = "${actionApi.testAction.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "action-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK", content = {@Content(schema = @Schema(implementation = ParsedAction.class ))}), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "409", description = "Conflict", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "429", description = "Too Many Requests", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @PostMapping("action:test") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") - public ResponseEntity<ParsedAction> testAction(@RequestBody @Valid TestActionRequest testActionRequest) { - ParsedAction response = this.testActionService.validateRegex(testActionRequest); - this.auditLogger.validateActionSuccess(Collections.singletonList(response.toString())); - return new ResponseEntity<>(response, HttpStatus.OK); - } + @Operation(summary = "${actionApi.testAction.summary}", description = "${actionApi.testAction.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "action-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK", content = { + @Content(schema = @Schema(implementation = ParsedAction.class)) }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "429", description = "Too Many Requests", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @PostMapping("action:test") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") + public ResponseEntity<ParsedAction> testAction(@RequestBody @Valid TestActionRequest testActionRequest) { + ParsedAction response = this.testActionService.validateRegex(testActionRequest); + this.auditLogger.validateActionSuccess(Collections.singletonList(response.toString())); + return new ResponseEntity<>(response, HttpStatus.OK); + } } diff --git a/register-core/src/main/java/org/opengroup/osdu/register/api/DdmsApi.java b/register-core/src/main/java/org/opengroup/osdu/register/api/DdmsApi.java index 8ac3ecfeb..6993e310d 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/api/DdmsApi.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/api/DdmsApi.java @@ -50,9 +50,9 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.annotation.RequestScope; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Pattern; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Pattern; import java.net.URI; import java.util.Collections; import java.util.List; @@ -64,130 +64,171 @@ import java.util.List; @Tag(name = "ddms-api", description = "Domain Data Management Service (DDMS) API") public class DdmsApi { - @Autowired - private IDdmsRepository dmsRepository; - @Autowired - private AuditLogger auditLogger; - @Autowired - private ConsumptionService consumptionService; + @Autowired + private IDdmsRepository dmsRepository; + @Autowired + private AuditLogger auditLogger; + @Autowired + private ConsumptionService consumptionService; - @Operation(summary = "${ddmsApi.postDMS.summary}", description = "${ddmsApi.postDMS.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "ddms-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "201", description = "Created", content = { @Content(schema = @Schema(implementation = Ddms.class)) }), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "409", description = "Conflict", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @PostMapping("ddms") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.EDITOR + "', '" + ServiceRole.ADMIN + "', '" + ServiceRole.OPS + "')") - public ResponseEntity<Ddms> postDMS(@RequestBody @Valid Ddms spec) { - dmsRepository.create(spec); - this.auditLogger.createDmsSuccess(Collections.singletonList(spec.getId())); - return new ResponseEntity<>(spec, HttpStatus.CREATED); - } + @Operation(summary = "${ddmsApi.postDMS.summary}", description = "${ddmsApi.postDMS.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "ddms-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "201", description = "Created", content = { + @Content(schema = @Schema(implementation = Ddms.class)) }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @PostMapping("ddms") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.EDITOR + "', '" + ServiceRole.ADMIN + + "', '" + ServiceRole.OPS + "')") + public ResponseEntity<Ddms> postDMS(@RequestBody @Valid Ddms spec) { + dmsRepository.create(spec); + this.auditLogger.createDmsSuccess(Collections.singletonList(spec.getId())); + return new ResponseEntity<>(spec, HttpStatus.CREATED); + } - @Operation(summary = "${ddmsApi.getDMS.summary}", description = "${ddmsApi.getDMS.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "ddms-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK", content = { @Content(schema = @Schema(implementation = Ddms.class)) }), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "409", description = "Conflict", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @GetMapping("ddms/{id}") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") - public ResponseEntity<Ddms> getDMS(@Parameter(description = "Id", example = "example-id-123", - in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9-]{2,50}")) - @PathVariable("id") @NotBlank @Pattern(regexp = "^[A-Za-z0-9-]{2,50}") String id) { - Ddms result = dmsRepository.get(id); - return new ResponseEntity<>(result, HttpStatus.OK); - } + @Operation(summary = "${ddmsApi.getDMS.summary}", description = "${ddmsApi.getDMS.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "ddms-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK", content = { + @Content(schema = @Schema(implementation = Ddms.class)) }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @GetMapping("ddms/{id}") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") + public ResponseEntity<Ddms> getDMS( + @Parameter(description = "Id", example = "example-id-123", in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9-]{2,50}")) @PathVariable("id") @NotBlank @Pattern(regexp = "^[A-Za-z0-9-]{2,50}") String id) { + Ddms result = dmsRepository.get(id); + return new ResponseEntity<>(result, HttpStatus.OK); + } - @Operation(summary = "${ddmsApi.queryDMS.summary}", description = "${ddmsApi.queryDMS.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "ddms-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "OK", content = { @Content(array = @ArraySchema(schema = @Schema(implementation = Ddms.class)))}), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "409", description = "Conflict", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @GetMapping("ddms") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") - public ResponseEntity<List<Ddms>> queryDMS(@Parameter(description = "Specifies the type in ddms I.E wellbores", - schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9]{1,50}")) - @RequestParam("type") @NotBlank @Pattern(regexp = "^[A-Za-z0-9]{1,50}") String type) { - List<Ddms> result = dmsRepository.query(type); - return new ResponseEntity<>(result, HttpStatus.OK); - } + @Operation(summary = "${ddmsApi.queryDMS.summary}", description = "${ddmsApi.queryDMS.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "ddms-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "200", description = "OK", content = { + @Content(array = @ArraySchema(schema = @Schema(implementation = Ddms.class))) }), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @GetMapping("ddms") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") + public ResponseEntity<List<Ddms>> queryDMS( + @Parameter(description = "Specifies the type in ddms I.E wellbores", schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9]{1,50}")) @RequestParam("type") @NotBlank @Pattern(regexp = "^[A-Za-z0-9]{1,50}") String type) { + List<Ddms> result = dmsRepository.query(type); + return new ResponseEntity<>(result, HttpStatus.OK); + } - @Operation(summary = "${ddmsApi.deleteDMS.summary}", description = "${ddmsApi.deleteDMS.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "ddms-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "204", description = "No Content"), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "409", description = "Conflict", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @DeleteMapping("ddms/{id}") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.ADMIN + "', '" + ServiceRole.OPS + "')") - public ResponseEntity deleteDMS(@Parameter(description = "Id", example = "example-id-123", - in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9-]{2,50}")) - @PathVariable("id") @NotBlank @Pattern(regexp = "^[A-Za-z0-9-]{2,50}") String id) { - boolean result = dmsRepository.delete(id); - if (result) { - this.auditLogger.deleteDmsSuccess(Collections.singletonList(id)); - return new ResponseEntity(HttpStatus.NO_CONTENT); - } else { - throw new AppException(org.apache.http.HttpStatus.SC_NOT_FOUND, "Not found", String.format("Could not delete DDMS with id %s because it could not be found", id)); + @Operation(summary = "${ddmsApi.deleteDMS.summary}", description = "${ddmsApi.deleteDMS.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "ddms-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "204", description = "No Content"), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @DeleteMapping("ddms/{id}") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.ADMIN + "', '" + ServiceRole.OPS + "')") + public ResponseEntity deleteDMS( + @Parameter(description = "Id", example = "example-id-123", in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[A-Za-z0-9-]{2,50}")) @PathVariable("id") @NotBlank @Pattern(regexp = "^[A-Za-z0-9-]{2,50}") String id) { + boolean result = dmsRepository.delete(id); + if (result) { + this.auditLogger.deleteDmsSuccess(Collections.singletonList(id)); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } else { + throw new AppException(org.apache.http.HttpStatus.SC_NOT_FOUND, "Not found", String + .format("Could not delete DDMS with id %s because it could not be found", id)); + } } - } - @Operation(summary = "${ddmsApi.redirectToDms.summary}", description = "${ddmsApi.redirectToDms.description}", - security = {@SecurityRequirement(name = "Authorization")}, tags = { "ddms-api" }) - @ApiResponses(value = { - @ApiResponse(responseCode = "307", description = "Temporary Redirect", headers = @Header(name = "location", - schema = @Schema(type = "string"), description = "Redirection to DDMS Single entity retrieve URL")), - @ApiResponse(responseCode = "400", description = "Bad Request", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "401", description = "Unauthorized", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "404", description = "Not Found", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "409", description = "Conflict", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "500", description = "Internal Server Error", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "502", description = "Bad Gateway", content = {@Content(schema = @Schema(implementation = AppError.class ))}), - @ApiResponse(responseCode = "503", description = "Service Unavailable", content = {@Content(schema = @Schema(implementation = AppError.class ))}) - }) - @GetMapping("ddms/{id}/{type}/{localid}") - @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") - public ResponseEntity redirectToDms( - @Parameter(description = "Id", example = "example-id-123", in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[\\w\\.-]{2,50}")) - @PathVariable("id") @NotBlank @Pattern(regexp = "^[\\w\\.-]{2,50}") String id, - @Parameter(description = "Specifies the type in ddms I.E wellbores", in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[\\w\\.-]{2,50}")) - @PathVariable("type") @NotBlank @Pattern(regexp = "^[\\w\\.-]{2,50}") String type, - @Parameter(description = "Specifies the record id with Optional version partition-id:group-type--IndividualType:UniqueRecordID:<OptionalVersionNumber>", - in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = ValidationDoc.RECORD_ID_REGEX)) - @PathVariable("localid") @NotBlank @Pattern(regexp = ValidationDoc.RECORD_ID_REGEX) String localid) throws Exception { - URI targetURIForRedirection = this.consumptionService.getSingleEntityRetrivalUri(id, type, localid); - return ResponseEntity.status(HttpStatus.TEMPORARY_REDIRECT).location(targetURIForRedirection).build(); - } + @Operation(summary = "${ddmsApi.redirectToDms.summary}", description = "${ddmsApi.redirectToDms.description}", security = { + @SecurityRequirement(name = "Authorization") }, tags = { "ddms-api" }) + @ApiResponses(value = { + @ApiResponse(responseCode = "307", description = "Temporary Redirect", headers = @Header(name = "location", schema = @Schema(type = "string"), description = "Redirection to DDMS Single entity retrieve URL")), + @ApiResponse(responseCode = "400", description = "Bad Request", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "401", description = "Unauthorized", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "403", description = "User not authorized to perform the action.", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "404", description = "Not Found", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "409", description = "Conflict", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "500", description = "Internal Server Error", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "502", description = "Bad Gateway", content = { + @Content(schema = @Schema(implementation = AppError.class)) }), + @ApiResponse(responseCode = "503", description = "Service Unavailable", content = { + @Content(schema = @Schema(implementation = AppError.class)) }) + }) + @GetMapping("ddms/{id}/{type}/{localid}") + @PreAuthorize("@authorizationFilter.hasAnyPermission('" + ServiceRole.OPS + "', '" + ServiceRole.ADMIN + "', '" + + ServiceRole.EDITOR + "', '" + ServiceRole.VIEWER + "')") + public ResponseEntity redirectToDms( + @Parameter(description = "Id", example = "example-id-123", in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[\\w\\.-]{2,50}")) @PathVariable("id") @NotBlank @Pattern(regexp = "^[\\w\\.-]{2,50}") String id, + @Parameter(description = "Specifies the type in ddms I.E wellbores", in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = "^[\\w\\.-]{2,50}")) @PathVariable("type") @NotBlank @Pattern(regexp = "^[\\w\\.-]{2,50}") String type, + @Parameter(description = "Specifies the record id with Optional version partition-id:group-type--IndividualType:UniqueRecordID:<OptionalVersionNumber>", in = ParameterIn.PATH, schema = @Schema(implementation = String.class, pattern = ValidationDoc.RECORD_ID_REGEX)) @PathVariable("localid") @NotBlank @Pattern(regexp = ValidationDoc.RECORD_ID_REGEX) String localid) + throws Exception { + URI targetURIForRedirection = this.consumptionService.getSingleEntityRetrivalUri(id, type, localid); + return ResponseEntity.status(HttpStatus.TEMPORARY_REDIRECT).location(targetURIForRedirection).build(); + } } diff --git a/register-core/src/main/java/org/opengroup/osdu/register/api/SubscriberApi.java b/register-core/src/main/java/org/opengroup/osdu/register/api/SubscriberApi.java index f6309778e..edef73153 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/api/SubscriberApi.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/api/SubscriberApi.java @@ -55,10 +55,10 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.context.annotation.RequestScope; -import javax.inject.Inject; -import javax.inject.Provider; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; +import jakarta.inject.Inject; +import jakarta.inject.Provider; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; import java.util.Collections; import java.util.List; diff --git a/register-core/src/main/java/org/opengroup/osdu/register/api/test/GsaSubscriberListenerApi.java b/register-core/src/main/java/org/opengroup/osdu/register/api/test/GsaSubscriberListenerApi.java index 4a6717cb2..671b76eb7 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/api/test/GsaSubscriberListenerApi.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/api/test/GsaSubscriberListenerApi.java @@ -1,9 +1,9 @@ package org.opengroup.osdu.register.api.test; -import javax.inject.Inject; -import javax.inject.Provider; -import javax.validation.ValidationException; -import javax.validation.constraints.NotBlank; +import jakarta.inject.Inject; +import jakarta.inject.Provider; +import jakarta.validation.ValidationException; +import jakarta.validation.constraints.NotBlank; import io.swagger.v3.oas.annotations.Hidden; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; diff --git a/register-core/src/main/java/org/opengroup/osdu/register/api/test/SubscriberListenerApi.java b/register-core/src/main/java/org/opengroup/osdu/register/api/test/SubscriberListenerApi.java index 948b3869b..7657645af 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/api/test/SubscriberListenerApi.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/api/test/SubscriberListenerApi.java @@ -16,8 +16,8 @@ package org.opengroup.osdu.register.api.test; -import javax.validation.ValidationException; -import javax.validation.constraints.NotBlank; +import jakarta.validation.ValidationException; +import jakarta.validation.constraints.NotBlank; import io.swagger.v3.oas.annotations.Hidden; import org.opengroup.osdu.core.common.cryptographic.ISignatureService; @@ -55,7 +55,7 @@ public class SubscriberListenerApi { @GetMapping("challenge/{count}") public ChallengeResponse testCrc(@RequestParam("crc") @NotBlank String crc, - @RequestParam("hmac") @NotBlank String hmac) { + @RequestParam("hmac") @NotBlank String hmac) { try { signatureService.verifyHmacSignature(hmac, this.serviceConfig.getSubscriberSecret()); logger.debug("Signature verified and sending response"); diff --git a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/Ddms.java b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/Ddms.java index 8d3504a88..10f3a9c5e 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/Ddms.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/Ddms.java @@ -22,10 +22,10 @@ import java.util.HashSet; import java.util.Optional; import java.util.Set; -import javax.validation.Valid; -import javax.validation.constraints.Email; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Pattern; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Email; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Pattern; import io.swagger.v3.oas.annotations.media.Schema; import org.opengroup.osdu.register.ddms.model.validators.ValidRegisteredInterfaces; @@ -35,7 +35,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import lombok.Data; @Data -@JsonIgnoreProperties({"first"}) +@JsonIgnoreProperties({ "first" }) @Schema(description = "Represents a model for Ddms") public class Ddms { diff --git a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/RegisteredInterface.java b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/RegisteredInterface.java index f465f8f1a..9928abe17 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/RegisteredInterface.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/RegisteredInterface.java @@ -34,9 +34,9 @@ import org.opengroup.osdu.register.ddms.model.validators.ValidOpenApi3Spec; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; import java.io.File; import java.net.URI; import java.util.List; @@ -70,7 +70,8 @@ public class RegisteredInterface { public OpenApi3 openApi3Spec() throws Exception { if (openApi3 == null) { - String temp = String.format("%s/%s.json", System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()); + String temp = String.format("%s/%s.json", System.getProperty("java.io.tmpdir"), + UUID.randomUUID().toString()); ObjectMapper mapper = new ObjectMapper(); File file = new File(temp); mapper.writeValue(file, schema); diff --git a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/OpenApi3SpecValidator.java b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/OpenApi3SpecValidator.java index 249ac24b1..85331eaef 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/OpenApi3SpecValidator.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/OpenApi3SpecValidator.java @@ -25,8 +25,8 @@ import org.opengroup.osdu.register.ddms.model.ExtensionValidationMessages; import org.opengroup.osdu.register.ddms.model.RegisteredInterface; import org.opengroup.osdu.core.common.model.http.AppException; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import static com.reprezen.kaizen.oasparser.val.msg.Messages.msg; @@ -34,7 +34,7 @@ public class OpenApi3SpecValidator implements ConstraintValidator<ValidOpenApi3S @Override public void initialize(ValidOpenApi3Spec constraintAnnotation) { - //needed by interface - we don't use + // needed by interface - we don't use } @Override diff --git a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/RegisteredInterfacesValidator.java b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/RegisteredInterfacesValidator.java index b58b8234b..1ec0dcf16 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/RegisteredInterfacesValidator.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/RegisteredInterfacesValidator.java @@ -18,19 +18,20 @@ package org.opengroup.osdu.register.ddms.model.validators; import org.opengroup.osdu.register.ddms.model.RegisteredInterface; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import java.util.Collection; import java.util.List; import java.util.Map; import static java.util.stream.Collectors.groupingBy; -public class RegisteredInterfacesValidator implements ConstraintValidator<ValidRegisteredInterfaces, Collection<RegisteredInterface>> { +public class RegisteredInterfacesValidator + implements ConstraintValidator<ValidRegisteredInterfaces, Collection<RegisteredInterface>> { @Override public void initialize(ValidRegisteredInterfaces constraintAnnotation) { - //needed by interface - we don't use + // needed by interface - we don't use } @Override @@ -40,8 +41,8 @@ public class RegisteredInterfacesValidator implements ConstraintValidator<ValidR if (value.size() > 10) return false; - Map<String, List<RegisteredInterface>> ordered = - value.stream().collect(groupingBy(RegisteredInterface::getEntityType)); + Map<String, List<RegisteredInterface>> ordered = value.stream() + .collect(groupingBy(RegisteredInterface::getEntityType)); if (ordered.values().stream().anyMatch(v -> v.size() > 1)) return false; diff --git a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/ValidOpenApi3Spec.java b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/ValidOpenApi3Spec.java index 095d80266..76a67fec5 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/ValidOpenApi3Spec.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/ValidOpenApi3Spec.java @@ -16,13 +16,14 @@ package org.opengroup.osdu.register.ddms.model.validators; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.*; -@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE, ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE, ElementType.TYPE_USE, + ElementType.TYPE_PARAMETER }) @Retention(RetentionPolicy.RUNTIME) -@Constraint(validatedBy = {OpenApi3SpecValidator.class}) +@Constraint(validatedBy = { OpenApi3SpecValidator.class }) @Documented public @interface ValidOpenApi3Spec { diff --git a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/ValidRegisteredInterfaces.java b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/ValidRegisteredInterfaces.java index addf3add1..c200b28d9 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/ValidRegisteredInterfaces.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/ddms/model/validators/ValidRegisteredInterfaces.java @@ -16,13 +16,14 @@ package org.opengroup.osdu.register.ddms.model.validators; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.*; -@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE, ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE, ElementType.TYPE_USE, + ElementType.TYPE_PARAMETER }) @Retention(RetentionPolicy.RUNTIME) -@Constraint(validatedBy = {RegisteredInterfacesValidator.class}) +@Constraint(validatedBy = { RegisteredInterfacesValidator.class }) @Documented public @interface ValidRegisteredInterfaces { diff --git a/register-core/src/main/java/org/opengroup/osdu/register/middleware/AuthorizationFilter.java b/register-core/src/main/java/org/opengroup/osdu/register/middleware/AuthorizationFilter.java index e8ff93b34..da66de56e 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/middleware/AuthorizationFilter.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/middleware/AuthorizationFilter.java @@ -29,7 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.RequestScope; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.util.Arrays; @Component("authorizationFilter") @@ -45,14 +45,14 @@ public class AuthorizationFilter { @Autowired private ServiceRequestInfo requestInfo; @Autowired - //TODO: use interface ICache<K, V> + // TODO: use interface ICache<K, V> private GroupVmCache groupVmCache; public boolean hasAnyPermission(String... requiredRoles) { String path = request.getServletPath(); if ("GET".equals(request.getMethod()) && - (path.equals("/swagger-ui.html") || path.equals("/info"))) { + (path.equals("/swagger-ui.html") || path.equals("/info"))) { return true; } @@ -67,7 +67,7 @@ public class AuthorizationFilter { } catch (AppException e) { if (Arrays.asList(requiredRoles).contains(ServiceRole.CRON)) { checkCronAccess(); - headers.put(DpsHeaders.USER_EMAIL, ServiceRole.CRON); //just assign user as cron job + headers.put(DpsHeaders.USER_EMAIL, ServiceRole.CRON); // just assign user as cron job return true; } else { return false; @@ -83,12 +83,12 @@ public class AuthorizationFilter { } /* - Check cache first, fall back to authorization service call otherwise + * Check cache first, fall back to authorization service call otherwise */ private AuthorizationResponse checkApiAccess(String[] requiredRoles, DpsHeaders dpsHeaders) { String cacheKey = getGroupCacheKey(dpsHeaders); AuthorizationResponse authorizationResponse = groupVmCache.get(cacheKey); - if(authorizationResponse != null && authorizationResponse.getGroups() != null) + if (authorizationResponse != null && authorizationResponse.getGroups() != null) return authorizationResponse; else { authorizationResponse = authorizationService.authorizeAny(dpsHeaders, requiredRoles); @@ -97,7 +97,6 @@ public class AuthorizationFilter { } } - private String getGroupCacheKey(DpsHeaders dpsHeaders) { String key = String.format("register-entitlement-groups:%s:%s", dpsHeaders.getPartitionId(), dpsHeaders.getAuthorization()); diff --git a/register-core/src/main/java/org/opengroup/osdu/register/middleware/GlobalExceptionMapper.java b/register-core/src/main/java/org/opengroup/osdu/register/middleware/GlobalExceptionMapper.java index 4aa9c90b4..d753464dd 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/middleware/GlobalExceptionMapper.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/middleware/GlobalExceptionMapper.java @@ -29,6 +29,7 @@ import org.springframework.core.Ordered; import org.springframework.core.annotation.Order; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; +import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; import org.springframework.lang.NonNull; import org.springframework.security.access.AccessDeniedException; @@ -40,7 +41,7 @@ import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import java.io.IOException; -import javax.validation.ValidationException; +import jakarta.validation.ValidationException; import java.util.List; import java.util.stream.Collectors; @@ -56,7 +57,7 @@ public class GlobalExceptionMapper extends ResponseEntityExceptionHandler { @Override protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, - HttpStatus status, WebRequest request) { + HttpStatusCode status, WebRequest request) { List<String> errorList = ex .getBindingResult() .getFieldErrors() @@ -70,7 +71,7 @@ public class GlobalExceptionMapper extends ResponseEntityExceptionHandler { @NonNull protected ResponseEntity<Object> handleHttpRequestMethodNotSupported(@NonNull HttpRequestMethodNotSupportedException e, @NonNull HttpHeaders headers, - @NonNull HttpStatus status, + @NonNull HttpStatusCode status, @NonNull WebRequest request) { return this.getErrorResponse(new AppException(HttpStatus.METHOD_NOT_ALLOWED.value(), "Method not found.", "Method not found.", e)); } diff --git a/register-core/src/main/java/org/opengroup/osdu/register/middleware/RegisterFilter.java b/register-core/src/main/java/org/opengroup/osdu/register/middleware/RegisterFilter.java index eae112641..f120421e6 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/middleware/RegisterFilter.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/middleware/RegisterFilter.java @@ -9,13 +9,13 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; import java.util.Map; -import javax.inject.Inject; +import jakarta.inject.Inject; @Component public class RegisterFilter implements Filter { @@ -29,7 +29,8 @@ public class RegisterFilter implements Filter { @Autowired private AppServiceConfig serviceConfig; - // defaults to * for any front-end, string must be comma-delimited if more than one domain + // defaults to * for any front-end, string must be comma-delimited if more than + // one domain @Value("${ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS:*}") String ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS; @@ -37,7 +38,7 @@ public class RegisterFilter implements Filter { @Override public void init(FilterConfig filterConfig) { - //do nothing + // do nothing } @Override @@ -49,14 +50,15 @@ public class RegisterFilter implements Filter { this.headers.addCorrelationIdIfMissing(); - Map<String, String> responseHeaders = responseHeadersFactory.getResponseHeaders(ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS); - for(Map.Entry<String, String> header : responseHeaders.entrySet()){ + Map<String, String> responseHeaders = responseHeadersFactory + .getResponseHeaders(ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS); + for (Map.Entry<String, String> header : responseHeaders.entrySet()) { httpResponse.addHeader(header.getKey(), header.getValue().toString()); } httpResponse.addHeader(DpsHeaders.CORRELATION_ID, this.headers.getCorrelationId()); if (!validateIsHttps(httpResponse)) { - //do nothing + // do nothing } else if (httpRequest.getMethod().equalsIgnoreCase(OPTIONS_STRING)) { httpResponse.setStatus(HttpStatus.SC_OK); } else { @@ -88,7 +90,8 @@ public class RegisterFilter implements Filter { } private boolean isSwagger(String uri) { - return uri.contains("/swagger") || uri.contains("/v2/api-docs") || uri.contains("/configuration/ui") || uri.contains("/webjars/"); + return uri.contains("/swagger") || uri.contains("/v2/api-docs") || uri.contains("/configuration/ui") + || uri.contains("/webjars/"); } private boolean isVersionInfo(String uri) { diff --git a/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/Subscription.java b/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/Subscription.java index 1c6dead50..dcc574dbc 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/Subscription.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/Subscription.java @@ -25,9 +25,9 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import javax.validation.Valid; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Pattern; +import jakarta.validation.Valid; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.Pattern; @Data @Builder @@ -69,4 +69,3 @@ public class Subscription { @Builder.Default private Secret secret = null; } - diff --git a/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/validators/SecretValidator.java b/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/validators/SecretValidator.java index 0dcfe9bb0..e2b877f8a 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/validators/SecretValidator.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/validators/SecretValidator.java @@ -22,15 +22,16 @@ import org.opengroup.osdu.register.subscriber.model.HmacSecret; import org.opengroup.osdu.register.subscriber.model.Secret; import org.opengroup.osdu.register.utils.Constants; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; public class SecretValidator implements ConstraintValidator<ValidSecret, Secret> { private static final String HMAC_VALUE_PATTERN = "^[a-zA-Z0-9]{8,30}+$"; @Override - public void initialize(ValidSecret constraintAnnotation) { } + public void initialize(ValidSecret constraintAnnotation) { + } @Override public boolean isValid(Secret value, ConstraintValidatorContext context) { @@ -50,19 +51,20 @@ public class SecretValidator implements ConstraintValidator<ValidSecret, Secret> private boolean validateSecretValue(Secret secret, ConstraintValidatorContext context) { if (secret.getSecretType().equalsIgnoreCase(Constants.HMACSecret)) { - String hmacSecret = ((HmacSecret)secret).getValue(); - if(!hmacSecret.matches(HMAC_VALUE_PATTERN) || hmacSecret.length()% 2 != 0 ) + String hmacSecret = ((HmacSecret) secret).getValue(); + if (!hmacSecret.matches(HMAC_VALUE_PATTERN) || hmacSecret.length() % 2 != 0) return addError(context, "HMAC value must match \"^[a-zA-Z0-9]{8,30}+$\" and length should be even."); } else { - GsaSecret gsaSecret = (GsaSecret)secret; - if(Strings.isNullOrEmpty(gsaSecret.getValue().getAudience()) || Strings.isNullOrEmpty(gsaSecret.getValue().getKey())) { + GsaSecret gsaSecret = (GsaSecret) secret; + if (Strings.isNullOrEmpty(gsaSecret.getValue().getAudience()) + || Strings.isNullOrEmpty(gsaSecret.getValue().getKey())) { return addError(context, "audience & key are required for GSA secret type"); } } return true; } - boolean addError(ConstraintValidatorContext context, String error){ + boolean addError(ConstraintValidatorContext context, String error) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate(error).addConstraintViolation(); return false; diff --git a/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/validators/ValidSecret.java b/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/validators/ValidSecret.java index 27510f770..12229f55c 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/validators/ValidSecret.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/subscriber/model/validators/ValidSecret.java @@ -16,13 +16,14 @@ package org.opengroup.osdu.register.subscriber.model.validators; -import javax.validation.Constraint; -import javax.validation.Payload; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.*; -@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE, ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) +@Target({ ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.TYPE, ElementType.TYPE_USE, + ElementType.TYPE_PARAMETER }) @Retention(RetentionPolicy.RUNTIME) -@Constraint(validatedBy = {SecretValidator.class}) +@Constraint(validatedBy = { SecretValidator.class }) @Documented public @interface ValidSecret { @@ -32,4 +33,3 @@ public @interface ValidSecret { Class<? extends Payload>[] payload() default {}; } - diff --git a/register-core/src/main/java/org/opengroup/osdu/register/utils/ServiceRequestInfo.java b/register-core/src/main/java/org/opengroup/osdu/register/utils/ServiceRequestInfo.java index 71e029fe8..c85f416e6 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/utils/ServiceRequestInfo.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/utils/ServiceRequestInfo.java @@ -20,7 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.context.annotation.RequestScope; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; @RequestScope @Component @@ -34,7 +34,8 @@ public class ServiceRequestInfo { private static final String EXPECTED_HEADER_VALUE = "true"; public boolean isHttps() { - return getUri().startsWith("https") || "https".equalsIgnoreCase(this.httpRequest.getHeader("x-forwarded-proto")); + return getUri().startsWith("https") + || "https".equalsIgnoreCase(this.httpRequest.getHeader("x-forwarded-proto")); } public String getUri() { diff --git a/register-core/src/main/java/org/opengroup/osdu/register/utils/UriResolver.java b/register-core/src/main/java/org/opengroup/osdu/register/utils/UriResolver.java index e648757b8..5dfc650b6 100644 --- a/register-core/src/main/java/org/opengroup/osdu/register/utils/UriResolver.java +++ b/register-core/src/main/java/org/opengroup/osdu/register/utils/UriResolver.java @@ -18,7 +18,7 @@ package org.opengroup.osdu.register.utils; import org.glassfish.jersey.uri.UriTemplate; -import javax.ws.rs.core.UriBuilder; +import jakarta.ws.rs.core.UriBuilder; import java.net.URI; import java.util.HashMap; import java.util.List; diff --git a/register-core/src/test/java/org/opengroup/osdu/register/api/SubscriberApiTest.java b/register-core/src/test/java/org/opengroup/osdu/register/api/SubscriberApiTest.java index 41623680d..7595f32ea 100644 --- a/register-core/src/test/java/org/opengroup/osdu/register/api/SubscriberApiTest.java +++ b/register-core/src/test/java/org/opengroup/osdu/register/api/SubscriberApiTest.java @@ -36,7 +36,7 @@ import org.opengroup.osdu.register.subscriber.services.DeleteSubscription; import org.opengroup.osdu.register.subscriber.services.UpdateSubscriptionSecret; import org.springframework.http.ResponseEntity; -import javax.inject.Provider; +import jakarta.inject.Provider; import java.util.ArrayList; import java.util.List; diff --git a/register-core/src/test/java/org/opengroup/osdu/register/ddms/model/validators/OpenApi3SpecValidatorTest.java b/register-core/src/test/java/org/opengroup/osdu/register/ddms/model/validators/OpenApi3SpecValidatorTest.java index be629938a..3c90ed33f 100644 --- a/register-core/src/test/java/org/opengroup/osdu/register/ddms/model/validators/OpenApi3SpecValidatorTest.java +++ b/register-core/src/test/java/org/opengroup/osdu/register/ddms/model/validators/OpenApi3SpecValidatorTest.java @@ -21,7 +21,7 @@ import org.opengroup.osdu.register.utils.OpenApiFileUtils; import org.junit.Test; import org.mockito.ArgumentCaptor; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidatorContext; import java.util.List; import static org.junit.Assert.*; @@ -30,14 +30,12 @@ import static org.mockito.Mockito.when; public class OpenApi3SpecValidatorTest { - - @Test public void should_notFailValidation_when_noGetPath() throws Exception { ConstraintValidatorContext context = mock(ConstraintValidatorContext.class); ArgumentCaptor<String> msgCaptor = ArgumentCaptor.forClass(String.class); - when(context.buildConstraintViolationWithTemplate(msgCaptor.capture())). - thenReturn(mock(ConstraintValidatorContext.ConstraintViolationBuilder.class)); + when(context.buildConstraintViolationWithTemplate(msgCaptor.capture())) + .thenReturn(mock(ConstraintValidatorContext.ConstraintViolationBuilder.class)); OpenApi3SpecValidator validator = new OpenApi3SpecValidator(); Ddms model = OpenApiFileUtils.getDmsWithOpenSpec("validations/path/noGetMethod.json", "testType"); @@ -49,8 +47,8 @@ public class OpenApi3SpecValidatorTest { public void should_notFailValidation_when_usingValidSpecFile() throws Exception { ConstraintValidatorContext context = mock(ConstraintValidatorContext.class); ArgumentCaptor<String> msgCaptor = ArgumentCaptor.forClass(String.class); - when(context.buildConstraintViolationWithTemplate(msgCaptor.capture())). - thenReturn(mock(ConstraintValidatorContext.ConstraintViolationBuilder.class)); + when(context.buildConstraintViolationWithTemplate(msgCaptor.capture())) + .thenReturn(mock(ConstraintValidatorContext.ConstraintViolationBuilder.class)); OpenApi3SpecValidator validator = new OpenApi3SpecValidator(); Ddms model = OpenApiFileUtils.getDmsWithOpenSpec("validSubsurfaceDdms.json", "testType"); @@ -64,8 +62,8 @@ public class OpenApi3SpecValidatorTest { public void should_failValidation_when_serversMissing() throws Exception { ConstraintValidatorContext context = mock(ConstraintValidatorContext.class); ArgumentCaptor<String> msgCaptor = ArgumentCaptor.forClass(String.class); - when(context.buildConstraintViolationWithTemplate(msgCaptor.capture())). - thenReturn(mock(ConstraintValidatorContext.ConstraintViolationBuilder.class)); + when(context.buildConstraintViolationWithTemplate(msgCaptor.capture())) + .thenReturn(mock(ConstraintValidatorContext.ConstraintViolationBuilder.class)); OpenApi3SpecValidator validator = new OpenApi3SpecValidator(); Ddms model = OpenApiFileUtils.getDmsWithOpenSpec("validations/servers/missingServers.json", "testType"); @@ -78,8 +76,8 @@ public class OpenApi3SpecValidatorTest { public void should_failValidation_when_multipleServersRegistered() throws Exception { ConstraintValidatorContext context = mock(ConstraintValidatorContext.class); ArgumentCaptor<String> msgCaptor = ArgumentCaptor.forClass(String.class); - when(context.buildConstraintViolationWithTemplate(msgCaptor.capture())). - thenReturn(mock(ConstraintValidatorContext.ConstraintViolationBuilder.class)); + when(context.buildConstraintViolationWithTemplate(msgCaptor.capture())) + .thenReturn(mock(ConstraintValidatorContext.ConstraintViolationBuilder.class)); OpenApi3SpecValidator validator = new OpenApi3SpecValidator(); Ddms model = OpenApiFileUtils.getDmsWithOpenSpec("validations/servers/multipleServers.json", "testType"); diff --git a/register-core/src/test/java/org/opengroup/osdu/register/ddms/model/validators/RegisteredInterfacesValidatorTest.java b/register-core/src/test/java/org/opengroup/osdu/register/ddms/model/validators/RegisteredInterfacesValidatorTest.java index 226977744..c93516db1 100644 --- a/register-core/src/test/java/org/opengroup/osdu/register/ddms/model/validators/RegisteredInterfacesValidatorTest.java +++ b/register-core/src/test/java/org/opengroup/osdu/register/ddms/model/validators/RegisteredInterfacesValidatorTest.java @@ -21,7 +21,7 @@ import org.opengroup.osdu.register.ddms.model.RegisteredInterface; import org.opengroup.osdu.register.utils.OpenApiFileUtils; import org.junit.Test; -import javax.validation.ConstraintValidatorContext; +import jakarta.validation.ConstraintValidatorContext; import java.util.ArrayList; import java.util.List; @@ -55,7 +55,6 @@ public class RegisteredInterfacesValidatorTest { ConstraintValidatorContext context = mock(ConstraintValidatorContext.class); RegisteredInterfacesValidator validator = new RegisteredInterfacesValidator(); - Ddms model = OpenApiFileUtils.getDmsWithOpenSpec("validations/openapi/invalidOpenApiVersion.json", "testType"); List<RegisteredInterface> input = new ArrayList<>(); input.add(model.getFirst()); @@ -72,8 +71,8 @@ public class RegisteredInterfacesValidatorTest { List<RegisteredInterface> input = new ArrayList<>(); Ddms model = OpenApiFileUtils.getDmsWithOpenSpec("validations/openapi/invalidOpenApiVersion.json", "testType"); - for(int i = 0;i < 12; i++){ - model.getFirst().setEntityType(String.format("%s",i)); + for (int i = 0; i < 12; i++) { + model.getFirst().setEntityType(String.format("%s", i)); input.add(model.getFirst()); } assertFalse(validator.isValid(input, context)); diff --git a/register-core/src/test/java/org/opengroup/osdu/register/middleware/AuthorizationFilterTest.java b/register-core/src/test/java/org/opengroup/osdu/register/middleware/AuthorizationFilterTest.java index d09cf0d66..8c08a0d5a 100644 --- a/register-core/src/test/java/org/opengroup/osdu/register/middleware/AuthorizationFilterTest.java +++ b/register-core/src/test/java/org/opengroup/osdu/register/middleware/AuthorizationFilterTest.java @@ -32,7 +32,7 @@ import org.opengroup.osdu.register.di.GroupVmCache; import org.opengroup.osdu.register.utils.ServiceRequestInfo; import org.opengroup.osdu.register.utils.ServiceRole; -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.util.ArrayList; import java.util.List; @@ -91,7 +91,8 @@ public class AuthorizationFilterTest { @Test public void should_authenticateRequest_when_isCronJob() { when(this.requestInfo.isCronRequest()).thenReturn(true); - when(this.authorizationService.authorizeAny(any(), eq(ROLE3))).thenThrow(new AppException(403, "unknown error", "this error occurred")); + when(this.authorizationService.authorizeAny(any(), eq(ROLE3))) + .thenThrow(new AppException(403, "unknown error", "this error occurred")); assertTrue(this.sut.hasAnyPermission(ROLE3)); verify(headers).put(DpsHeaders.USER_EMAIL, ServiceRole.CRON); @@ -116,7 +117,8 @@ public class AuthorizationFilterTest { groups.setGroups(groupInfos); groups.setDesId("desid"); groups.setMemberEmail("memberEmail"); - AuthorizationResponse authorizationResponse = AuthorizationResponse.builder().groups(groups).user(USER_EMAIL).build(); + AuthorizationResponse authorizationResponse = AuthorizationResponse.builder().groups(groups).user(USER_EMAIL) + .build(); when(this.groupVmCache.get("+CjZlg==")).thenReturn(authorizationResponse); assertTrue(this.sut.hasAnyPermission(ROLE1, ROLE2)); verify(headers).put(DpsHeaders.USER_EMAIL, USER_EMAIL); diff --git a/register-core/src/test/java/org/opengroup/osdu/register/middleware/RegisterFilterTest.java b/register-core/src/test/java/org/opengroup/osdu/register/middleware/RegisterFilterTest.java index 809e003f8..b244f5058 100644 --- a/register-core/src/test/java/org/opengroup/osdu/register/middleware/RegisterFilterTest.java +++ b/register-core/src/test/java/org/opengroup/osdu/register/middleware/RegisterFilterTest.java @@ -13,10 +13,10 @@ import org.opengroup.osdu.register.utils.ServiceRequestInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.util.ReflectionTestUtils; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import static org.junit.Assert.fail; @@ -47,31 +47,29 @@ public class RegisterFilterTest { private FilterChain filterChain; @Before - public void setup(){ + public void setup() { MockitoAnnotations.initMocks(RegisterFilterTest.this); - ReflectionTestUtils.setField(registerFilter,"ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS","allow"); + ReflectionTestUtils.setField(registerFilter, "ACCESS_CONTROL_ALLOW_ORIGIN_DOMAINS", "allow"); } @Test public void doFilterTest() throws ServletException, IOException { when(requestInfo.getUri()).thenReturn("http://example.com"); when(serviceConfig.getAcceptHttp()).thenReturn(false); - try{ - registerFilter.doFilter(request,response,filterChain); - } - catch(Exception e){ - fail("Did not expect exception here"); - } + try { + registerFilter.doFilter(request, response, filterChain); + } catch (Exception e) { + fail("Did not expect exception here"); + } } @Test public void doFilterTest_when_localHostUri() throws ServletException, IOException { when(requestInfo.getUri()).thenReturn("http://localhost:8080/test"); when(request.getMethod()).thenReturn("OPTIONS"); - try{ - registerFilter.doFilter(request,response,filterChain); - } - catch(Exception e){ + try { + registerFilter.doFilter(request, response, filterChain); + } catch (Exception e) { fail("Did not expect exception here"); } } diff --git a/register-core/src/test/java/org/opengroup/osdu/register/utils/Helpers.java b/register-core/src/test/java/org/opengroup/osdu/register/utils/Helpers.java index d015b8002..636cd7f75 100644 --- a/register-core/src/test/java/org/opengroup/osdu/register/utils/Helpers.java +++ b/register-core/src/test/java/org/opengroup/osdu/register/utils/Helpers.java @@ -16,9 +16,9 @@ package org.opengroup.osdu.register.utils; -import javax.validation.ConstraintViolation; -import javax.validation.Validation; -import javax.validation.Validator; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validation; +import jakarta.validation.Validator; import java.util.Set; import static junit.framework.TestCase.assertEquals; diff --git a/register-core/src/test/java/org/opengroup/osdu/register/utils/ServiceRequestInfoTest.java b/register-core/src/test/java/org/opengroup/osdu/register/utils/ServiceRequestInfoTest.java index 9678ef680..062f1380f 100644 --- a/register-core/src/test/java/org/opengroup/osdu/register/utils/ServiceRequestInfoTest.java +++ b/register-core/src/test/java/org/opengroup/osdu/register/utils/ServiceRequestInfoTest.java @@ -9,8 +9,7 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; - -import javax.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequest; import java.net.MalformedURLException; @@ -35,7 +34,7 @@ public class ServiceRequestInfoTest { public void isHttpsTest() throws MalformedURLException { when(httpRequest.getRequestURL()).thenReturn(new StringBuffer("https://example.com")); boolean actual = serviceRequestInfo.isHttps(); - assertEquals(actual,true); + assertEquals(actual, true); } } diff --git a/testing/pom.xml b/testing/pom.xml index 9adc0e51c..e92bca4e0 100644 --- a/testing/pom.xml +++ b/testing/pom.xml @@ -59,7 +59,7 @@ <url>${publish.snapshots.url}</url> </snapshotRepository> </distributionManagement> - +<!-- <dependencyManagement> <dependencies> <dependency> @@ -67,13 +67,8 @@ <artifactId>log4j-api</artifactId> <version>${log4j.version}</version> </dependency> - <dependency> - <groupId>org.apache.logging.log4j</groupId> - <artifactId>log4j-to-slf4j</artifactId> - <version>${log4j.version}</version> - </dependency> </dependencies> - </dependencyManagement> + </dependencyManagement> --> <profiles> <profile> diff --git a/testing/register-test-aws/pom.xml b/testing/register-test-aws/pom.xml index 5a3fc6aac..066092e26 100644 --- a/testing/register-test-aws/pom.xml +++ b/testing/register-test-aws/pom.xml @@ -36,8 +36,8 @@ <maven.compiler.target>17</maven.compiler.target> <maven.compiler.source>17</maven.compiler.source> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <jackson-databind.version>2.15.2</jackson-databind.version> - <jackson.version>2.15.2</jackson.version> + <jackson-databind.version>2.16.1</jackson-databind.version> + <jackson.version>2.16.1</jackson.version> </properties> <dependencies> @@ -47,14 +47,14 @@ <version>1.18.26</version> </dependency> <dependency> - <groupId>javax.json</groupId> - <artifactId>javax.json-api</artifactId> - <version>1.1.2</version> + <groupId>jakarta.json</groupId> + <artifactId>jakarta.json-api</artifactId> + <version>2.1.3</version> </dependency> <dependency> <groupId>org.glassfish</groupId> - <artifactId>javax.json</artifactId> - <version>1.1.2</version> + <artifactId>jakarta.json</artifactId> + <version>2.0.1</version> </dependency> <dependency> <groupId>com.google.oauth-client</groupId> @@ -145,7 +145,7 @@ <dependency> <groupId>org.opengroup.osdu.core.aws</groupId> <artifactId>os-core-lib-aws</artifactId> - <version>0.26.0-rc2</version> + <version>0.26.0-spring6-rc1</version> </dependency> </dependencies> diff --git a/testing/register-test-azure/pom.xml b/testing/register-test-azure/pom.xml index 9cb002921..336c47ed6 100644 --- a/testing/register-test-azure/pom.xml +++ b/testing/register-test-azure/pom.xml @@ -36,14 +36,22 @@ <maven.compiler.target>17</maven.compiler.target> <maven.compiler.source>17</maven.compiler.source> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <core-lib-azure.version>0.26.0-rc5</core-lib-azure.version> + <core-lib-azure.version>0.26.0-rc6</core-lib-azure.version> + <netty.version>4.1.101.Final</netty.version> </properties> <dependencyManagement> <dependencies> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-bom</artifactId> + <version>${netty.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-azure</artifactId> + <artifactId>core-lib-azure-spring6</artifactId> <version>${core-lib-azure.version}</version> <type>pom</type> <scope>import</scope> @@ -58,14 +66,14 @@ <version>1.18.26</version> </dependency> <dependency> - <groupId>javax.json</groupId> - <artifactId>javax.json-api</artifactId> - <version>1.1.2</version> + <groupId>jakarta.json</groupId> + <artifactId>jakarta.json-api</artifactId> + <version>2.1.3</version> </dependency> <dependency> <groupId>org.glassfish</groupId> - <artifactId>javax.json</artifactId> - <version>1.1.2</version> + <artifactId>jakarta.json</artifactId> + <version>2.0.1</version> </dependency> <dependency> <groupId>com.google.oauth-client</groupId> @@ -121,7 +129,7 @@ <exclusions> <exclusion> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-gc</artifactId> + <artifactId>core-lib-gc-spring6</artifactId> </exclusion> </exclusions> </dependency> @@ -145,8 +153,18 @@ </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-azure</artifactId> + <artifactId>core-lib-azure-spring6</artifactId> <version>${core-lib-azure.version}</version> </dependency> + <dependency> + <groupId>ch.qos.logback.contrib</groupId> + <artifactId>logback-json-classic</artifactId> + <version>0.1.5</version> + </dependency> + <dependency> + <groupId>ch.qos.logback.contrib</groupId> + <artifactId>logback-jackson</artifactId> + <version>0.1.5</version> + </dependency> </dependencies> </project> diff --git a/testing/register-test-baremetal/pom.xml b/testing/register-test-baremetal/pom.xml index 35952b3a9..15188472c 100644 --- a/testing/register-test-baremetal/pom.xml +++ b/testing/register-test-baremetal/pom.xml @@ -44,14 +44,14 @@ <version>1.18.26</version> </dependency> <dependency> - <groupId>javax.json</groupId> - <artifactId>javax.json-api</artifactId> - <version>1.1.2</version> + <groupId>jakarta.json</groupId> + <artifactId>jakarta.json-api</artifactId> + <version>2.1.3</version> </dependency> <dependency> <groupId>org.glassfish</groupId> - <artifactId>javax.json</artifactId> - <version>1.1.2</version> + <artifactId>jakarta.json</artifactId> + <version>2.0.1</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> @@ -75,8 +75,8 @@ </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-gc</artifactId> - <version>0.25.0</version> + <artifactId>core-lib-gc-spring6</artifactId> + <version>0.26.0-rc5</version> </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> diff --git a/testing/register-test-core/pom.xml b/testing/register-test-core/pom.xml index e76565c9e..bba476d97 100644 --- a/testing/register-test-core/pom.xml +++ b/testing/register-test-core/pom.xml @@ -36,25 +36,35 @@ <maven.compiler.target>17</maven.compiler.target> <maven.compiler.source>17</maven.compiler.source> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <jackson-databind.version>2.15.0-rc1</jackson-databind.version> - <jackson.version>2.15.0-rc1</jackson.version> + <jackson-databind.version>2.16.1</jackson-databind.version> + <jackson.version>2.16.1</jackson.version> </properties> <dependencies> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <version>4.0.1</version> + </dependency> + <dependency> + <groupId>org.glassfish.jaxb</groupId> + <artifactId>jaxb-runtime</artifactId> + <version>2.3.0</version> + </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.26</version> </dependency> <dependency> - <groupId>javax.json</groupId> - <artifactId>javax.json-api</artifactId> - <version>1.1.2</version> + <groupId>jakarta.json</groupId> + <artifactId>jakarta.json-api</artifactId> + <version>2.1.3</version> </dependency> <dependency> <groupId>org.glassfish</groupId> - <artifactId>javax.json</artifactId> - <version>1.1.2</version> + <artifactId>jakarta.json</artifactId> + <version>2.0.1</version> </dependency> <dependency> <groupId>com.sun.jersey</groupId> @@ -73,8 +83,8 @@ </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-gc</artifactId> - <version>0.25.0</version> + <artifactId>core-lib-gc-spring6</artifactId> + <version>0.26.0-rc5</version> </dependency> <dependency> diff --git a/testing/register-test-gc/pom.xml b/testing/register-test-gc/pom.xml index 122889ad9..6cdaee8c3 100644 --- a/testing/register-test-gc/pom.xml +++ b/testing/register-test-gc/pom.xml @@ -44,14 +44,20 @@ <version>1.18.26</version> </dependency> <dependency> - <groupId>javax.json</groupId> - <artifactId>javax.json-api</artifactId> - <version>1.1.2</version> + <groupId>jakarta.json</groupId> + <artifactId>jakarta.json-api</artifactId> + <version>2.1.3</version> </dependency> + <dependency> + <groupId>jakarta.xml.bind</groupId> + <artifactId>jakarta.xml.bind-api</artifactId> + <version>4.0.1</version> + </dependency> + <dependency> <groupId>org.glassfish</groupId> - <artifactId>javax.json</artifactId> - <version>1.1.2</version> + <artifactId>jakarta.json</artifactId> + <version>2.0.1</version> </dependency> <dependency> <groupId>com.google.oauth-client</groupId> @@ -102,19 +108,19 @@ </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-gc</artifactId> - <version>0.25.0</version> + <artifactId>core-lib-gc-spring6</artifactId> + <version>0.26.0-rc5</version> + </dependency> + <dependency> + <groupId>org.opengroup.osdu.register</groupId> + <artifactId>register-test-core</artifactId> + <version>0.26.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> <artifactId>core-test-lib-gcp</artifactId> <version>0.22.0</version> </dependency> - <dependency> - <groupId>org.opengroup.osdu.register</groupId> - <artifactId>register-test-core</artifactId> - <version>0.26.0-SNAPSHOT</version> - </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> diff --git a/testing/register-test-ibm/pom.xml b/testing/register-test-ibm/pom.xml index 433ff1024..b51c30a60 100644 --- a/testing/register-test-ibm/pom.xml +++ b/testing/register-test-ibm/pom.xml @@ -33,7 +33,7 @@ Copyright 2020 IBM Corp. All Rights Reserved. <maven.compiler.target>17</maven.compiler.target> <maven.compiler.source>17</maven.compiler.source> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> - <os-core-lib-ibm.version>0.25.1</os-core-lib-ibm.version> + <os-core-lib-ibm.version>0.26.0-rc8</os-core-lib-ibm.version> </properties> <dependencies> @@ -49,14 +49,14 @@ Copyright 2020 IBM Corp. All Rights Reserved. <version>1.18.26</version> </dependency> <dependency> - <groupId>javax.json</groupId> - <artifactId>javax.json-api</artifactId> - <version>1.1.2</version> + <groupId>jakarta.json</groupId> + <artifactId>jakarta.json-api</artifactId> + <version>2.1.3</version> </dependency> <dependency> <groupId>org.glassfish</groupId> - <artifactId>javax.json</artifactId> - <version>1.1.2</version> + <artifactId>jakarta.json</artifactId> + <version>2.0.1</version> </dependency> <dependency> <groupId>com.google.oauth-client</groupId> @@ -107,8 +107,8 @@ Copyright 2020 IBM Corp. All Rights Reserved. </dependency> <dependency> <groupId>org.opengroup.osdu</groupId> - <artifactId>core-lib-gc</artifactId> - <version>0.25.0</version> + <artifactId>core-lib-gc-spring6</artifactId> + <version>0.26.0-rc5</version> </dependency> <dependency> <groupId>org.opengroup.osdu.register</groupId> -- GitLab