From a57826d94dcf1d2878bfc3c14aa068e6ce1a245d Mon Sep 17 00:00:00 2001 From: Felix Dittrich <31076102+f11h@users.noreply.github.com> Date: Fri, 17 Feb 2023 15:26:02 +0100 Subject: [PATCH] Update to Spring Boot 3 and JDK 17 (#304) * Update to Spring Boot 3 and JDK 17 Update other Dependencies * Fix CI * Fix CI * Update OWASP Dependency Check --- .github/workflows/ci-manual-tomcat-deploy | 22 -- .github/workflows/ci-master.yml | 5 +- .github/workflows/ci-pull-request.yml | 5 +- .github/workflows/manual-package.yml | 5 +- codestyle/checkstyle.xml | 2 +- lombok.config | 1 + owasp/suppressions.xml | 22 +- pom.xml | 216 +++++------------- .../config/EfgsProperties.java | 2 +- .../config/EfgsPropertiesValidator.java | 4 +- .../config/ErrorHandler.java | 8 +- .../config/MdcCleanupInterceptor.java | 4 +- .../DbEncryptionByteArrayConverter.java | 6 +- .../DbEncryptionIntConverter.java | 6 +- .../DbEncryptionReportTypeConverter.java | 6 +- .../dbencryption/DbEncryptionService.java | 2 +- .../DbEncryptionStringConverter.java | 6 +- .../entity/CallbackSubscriptionEntity.java | 12 +- .../entity/CallbackTaskEntity.java | 18 +- .../entity/CertificateEntity.java | 16 +- .../entity/DiagnosisKeyBatchEntity.java | 12 +- .../entity/DiagnosisKeyEntity.java | 14 +- .../entity/DiagnosisKeyPayload.java | 6 +- .../entity/FormatInformation.java | 4 +- .../entity/UploaderInformation.java | 4 +- .../CertificateAuthentificationFilter.java | 9 +- .../repository/CallbackTaskRepository.java | 2 +- .../service/DiagnosisKeyEntityService.java | 2 +- ...nsactionalCallbackTaskExecutorService.java | 2 +- ...TransactionalDiagnosisKeyBatchService.java | 2 +- .../DiagnosisKeyBatchConstraint.java | 4 +- .../validator/DiagnosisKeyBatchValidator.java | 4 +- .../interop/federationgateway/TestData.java | 4 +- .../dbencryption/DbEncryptionTest.java | 2 +- .../CallbackTaskExecutorServiceTest.java | 2 +- .../DiagnosisKeyBatchValidatorTest.java | 2 +- 36 files changed, 151 insertions(+), 292 deletions(-) delete mode 100644 .github/workflows/ci-manual-tomcat-deploy create mode 100644 lombok.config diff --git a/.github/workflows/ci-manual-tomcat-deploy b/.github/workflows/ci-manual-tomcat-deploy deleted file mode 100644 index 5b25b68f..00000000 --- a/.github/workflows/ci-manual-tomcat-deploy +++ /dev/null @@ -1,22 +0,0 @@ -# This workflow will build a Java project with Maven -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven - -name: Java CI with Maven - -on: - push: - branches: [ feat/tomcat ] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.11 - - name: Build with Maven - run: mvn -B package --file pom.xml diff --git a/.github/workflows/ci-master.yml b/.github/workflows/ci-master.yml index 1930b6cf..32b50ad1 100644 --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -18,9 +18,10 @@ jobs: path: ~/.m2/repository key: ${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ env.cache-name }}- - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 + distribution: adopt - name: environment run: | sudo apt-get install --yes --no-install-recommends libxml-xpath-perl diff --git a/.github/workflows/ci-pull-request.yml b/.github/workflows/ci-pull-request.yml index d0584bda..6fca10cb 100644 --- a/.github/workflows/ci-pull-request.yml +++ b/.github/workflows/ci-pull-request.yml @@ -19,8 +19,9 @@ jobs: path: ~/.m2/repository key: ${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ env.cache-name }}- - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 + distribution: adopt - name: mvn package run: mvn --batch-mode package diff --git a/.github/workflows/manual-package.yml b/.github/workflows/manual-package.yml index 2c80c32a..b3af0c40 100644 --- a/.github/workflows/manual-package.yml +++ b/.github/workflows/manual-package.yml @@ -19,9 +19,10 @@ jobs: path: ~/.m2/repository key: ${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ env.cache-name }}- - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 + distribution: adopt - name: environment run: | sudo apt-get install --yes --no-install-recommends libxml-xpath-perl diff --git a/codestyle/checkstyle.xml b/codestyle/checkstyle.xml index d385615d..f4843f06 100644 --- a/codestyle/checkstyle.xml +++ b/codestyle/checkstyle.xml @@ -282,7 +282,7 @@ value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> - + diff --git a/lombok.config b/lombok.config new file mode 100644 index 00000000..53a4a723 --- /dev/null +++ b/lombok.config @@ -0,0 +1 @@ +lombok.copyableAnnotations += org.springframework.beans.factory.annotation.Qualifier diff --git a/owasp/suppressions.xml b/owasp/suppressions.xml index cf784907..f21cdfb6 100644 --- a/owasp/suppressions.xml +++ b/owasp/suppressions.xml @@ -1,25 +1,11 @@ - see https://github.com/jeremylong/DependencyCheck/issues/1827> - CVE-2018-1258 + H2 is only used for testing, not production + CVE-2022-45868 - see https://github.com/jeremylong/DependencyCheck/issues/2952 - CVE-2011-2732 - CVE-2011-2731 - CVE-2012-5055 - - - see https://tomcat.apache.org/security-9.html#Apache_Tomcat_9.x_vulnerabilities vulnerability is fixed in tomcat 9.0.38 - CVE-2020-13943 - - - H2 Vulnerability suppressed - CVE-2021-23463 - - - netty-transport-4.1.70 Vulnerability - CVE-2021-43797 + no YAML content from users is parsed within this service + CVE-2022-1471 diff --git a/pom.xml b/pom.xml index e022dd12..3292414f 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,13 @@ 1.0.15 ${packaging.format} + + org.springframework.cloud + spring-cloud-starter-parent + 2022.0.1 + + + efgs-federation-gateway European Federation Gateway Service project. @@ -18,37 +25,25 @@ war - 11 - 11 - 11 + 17 + 17 + 17 UTF-8 UTF-8 - 7.0.4 - 2.6.6 - 2021.0.0 - 5.3.19 - 5.6.2 - 1.18.24 - 4.9.1 - 1.6.7 - 3.19.6 + 8.1.0 + 1.6.14 + 3.21.12 1.4 - 5.7.2 - 1.4.2.Final - 3.12.4 - 1.69 - 1.0.1.RELEASE - 5.0.0-alpha.2 - 2.1.212 - 4.30.0 + 1.5.3.Final + 1.72 + 5.1.0 - 3.1.2 - 3.9.0.2155 - 0.8.7 - 1.7.0 - 3.0.0-M5 + 3.2.1 + 3.9.1.2184 + 0.8.8 + 1.7.1 EU-Federation-Gateway-Service / efgs-federation-gateway 2020 @@ -131,40 +126,6 @@ - - - - org.springframework.boot - spring-boot-dependencies - ${spring.boot.version} - pom - import - - - org.springframework.cloud - spring-cloud-dependencies - ${spring.cloud.version} - pom - import - - - org.projectlombok - lombok - ${lombok.version} - - - org.springdoc - springdoc-openapi-ui - ${springdoc.version} - - - org.liquibase - liquibase-core - ${liquibase.version} - - - - github @@ -174,12 +135,8 @@ - mysql - mysql-connector-java - - - org.springframework.boot - spring-boot-starter + com.mysql + mysql-connector-j org.springframework.boot @@ -199,8 +156,8 @@ provided - org.springframework.cloud - spring-cloud-starter-sleuth + org.springframework.boot + spring-boot-starter-webflux org.springframework.boot @@ -210,19 +167,10 @@ org.springframework.retry spring-retry - - org.springframework.boot - spring-boot-starter-webflux - org.liquibase liquibase-core - - org.springframework.boot - spring-boot-starter-test - test - org.projectlombok lombok @@ -243,12 +191,6 @@ protobuf-java-format ${protobuf-format.version} - - com.h2database - h2 - ${h2.version} - runtime - org.mapstruct mapstruct @@ -256,36 +198,17 @@ org.bouncycastle - bcpkix-jdk15on + bcpkix-jdk18on ${bcpkix.version} - - org.projectreactor - reactor-spring - ${reactor.version} - - - org.mockito - mockito-core - ${mockito.version} - test - + + + + + org.springframework.security spring-security-web - ${spring.security.version} - - - com.squareup.okhttp3 - okhttp - ${okhttp.version} - test - - - com.squareup.okhttp3 - mockwebserver3-junit5 - ${okhttp.version} - test net.javacrumbs.shedlock @@ -297,6 +220,24 @@ shedlock-spring ${shedlock.version} + + + + org.springframework.boot + spring-boot-starter-test + test + + + com.h2database + h2 + runtime + + + com.squareup.okhttp3 + mockwebserver3-junit5 + 5.0.0-alpha.11 + test + @@ -307,60 +248,6 @@ ${plugin.os-maven.version} - - - - org.apache.maven.plugins - maven-checkstyle-plugin - ${plugin.checkstyle.version} - - - org.sonarsource.scanner.maven - sonar-maven-plugin - ${plugin.sonar.version} - - - org.jacoco - jacoco-maven-plugin - ${plugin.jacoco.version} - - - org.apache.maven.plugins - maven-surefire-plugin - ${plugin.surefire.version} - - - org.xolstice.maven.plugins - protobuf-maven-plugin - 0.6.1 - - - org.apache.maven.plugins - maven-compiler-plugin - 3.8.1 - - - org.codehaus.mojo - license-maven-plugin - 2.0.0 - - - org.apache.maven.plugins - maven-war-plugin - 3.3.1 - - - org.apache.maven.plugins - maven-resources-plugin - 3.2.0 - - - org.apache.maven.plugins - maven-assembly-plugin - 2.6 - - - org.owasp @@ -392,7 +279,6 @@ org.springframework.boot spring-boot-maven-plugin - ${spring.boot.version} @@ -405,10 +291,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + ${plugin.checkstyle.version} codestyle/checkstyle.xml target/**/* - UTF-8 true true warning @@ -428,6 +314,7 @@ org.jacoco jacoco-maven-plugin + ${plugin.jacoco.version} @@ -445,6 +332,7 @@ org.xolstice.maven.plugins protobuf-maven-plugin + 0.6.1 @@ -477,6 +365,7 @@ org.codehaus.mojo license-maven-plugin + 2.0.0 **/*.java ${project.organization.name} and all other contributors @@ -537,6 +426,7 @@ + org.apache.maven.plugins maven-assembly-plugin diff --git a/src/main/java/eu/interop/federationgateway/config/EfgsProperties.java b/src/main/java/eu/interop/federationgateway/config/EfgsProperties.java index 0d64de26..74a01cd9 100644 --- a/src/main/java/eu/interop/federationgateway/config/EfgsProperties.java +++ b/src/main/java/eu/interop/federationgateway/config/EfgsProperties.java @@ -20,8 +20,8 @@ package eu.interop.federationgateway.config; +import jakarta.annotation.PostConstruct; import java.util.List; -import javax.annotation.PostConstruct; import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/src/main/java/eu/interop/federationgateway/config/EfgsPropertiesValidator.java b/src/main/java/eu/interop/federationgateway/config/EfgsPropertiesValidator.java index 724b4507..a8c930bd 100644 --- a/src/main/java/eu/interop/federationgateway/config/EfgsPropertiesValidator.java +++ b/src/main/java/eu/interop/federationgateway/config/EfgsPropertiesValidator.java @@ -20,8 +20,8 @@ package eu.interop.federationgateway.config; -import javax.annotation.PostConstruct; -import javax.validation.ValidationException; +import jakarta.annotation.PostConstruct; +import jakarta.validation.ValidationException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/eu/interop/federationgateway/config/ErrorHandler.java b/src/main/java/eu/interop/federationgateway/config/ErrorHandler.java index dabb4dd8..8d66c800 100644 --- a/src/main/java/eu/interop/federationgateway/config/ErrorHandler.java +++ b/src/main/java/eu/interop/federationgateway/config/ErrorHandler.java @@ -21,7 +21,7 @@ package eu.interop.federationgateway.config; import eu.interop.federationgateway.service.DiagnosisKeyEntityService; -import javax.validation.ConstraintViolationException; +import jakarta.validation.ConstraintViolationException; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -80,11 +80,11 @@ public ResponseEntity handleException(ConstraintViolationExcep */ @ExceptionHandler(Exception.class) public ResponseEntity handleException(Exception e) { - if (e instanceof ResponseStatusException) { + if (e instanceof ResponseStatusException responseStatusException) { return ResponseEntity - .status(((ResponseStatusException) e).getStatus()) + .status(responseStatusException.getStatusCode()) .contentType(MediaType.APPLICATION_JSON) - .body(new ErrorMessageBody(((ResponseStatusException) e).getReason())); + .body(new ErrorMessageBody(responseStatusException.getReason())); } else { log.error("Uncatched exception", e); return ResponseEntity diff --git a/src/main/java/eu/interop/federationgateway/config/MdcCleanupInterceptor.java b/src/main/java/eu/interop/federationgateway/config/MdcCleanupInterceptor.java index 97197f0d..aa9c24fe 100644 --- a/src/main/java/eu/interop/federationgateway/config/MdcCleanupInterceptor.java +++ b/src/main/java/eu/interop/federationgateway/config/MdcCleanupInterceptor.java @@ -21,8 +21,8 @@ package eu.interop.federationgateway.config; import eu.interop.federationgateway.utils.EfgsMdc; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; public class MdcCleanupInterceptor implements HandlerInterceptor { diff --git a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionByteArrayConverter.java b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionByteArrayConverter.java index 39e1438a..61f38ab6 100644 --- a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionByteArrayConverter.java +++ b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionByteArrayConverter.java @@ -20,13 +20,13 @@ package eu.interop.federationgateway.dbencryption; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import jakarta.persistence.PersistenceException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; -import javax.persistence.PersistenceException; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor diff --git a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionIntConverter.java b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionIntConverter.java index 0fb0ac58..01405994 100644 --- a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionIntConverter.java +++ b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionIntConverter.java @@ -20,13 +20,13 @@ package eu.interop.federationgateway.dbencryption; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import jakarta.persistence.PersistenceException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; -import javax.persistence.PersistenceException; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor diff --git a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionReportTypeConverter.java b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionReportTypeConverter.java index 4bbaba06..638eb5bf 100644 --- a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionReportTypeConverter.java +++ b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionReportTypeConverter.java @@ -21,13 +21,13 @@ package eu.interop.federationgateway.dbencryption; import eu.interop.federationgateway.entity.DiagnosisKeyPayload; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import jakarta.persistence.PersistenceException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; -import javax.persistence.PersistenceException; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor diff --git a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionService.java b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionService.java index c22a8e04..19e5e2bd 100644 --- a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionService.java +++ b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionService.java @@ -21,6 +21,7 @@ package eu.interop.federationgateway.dbencryption; import eu.interop.federationgateway.config.EfgsProperties; +import jakarta.validation.ValidationException; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.security.InvalidAlgorithmParameterException; @@ -32,7 +33,6 @@ import javax.crypto.IllegalBlockSizeException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; -import javax.validation.ValidationException; import lombok.extern.slf4j.Slf4j; import org.springframework.security.crypto.encrypt.AesBytesEncryptor; import org.springframework.stereotype.Service; diff --git a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionStringConverter.java b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionStringConverter.java index ffa052b2..2553579c 100644 --- a/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionStringConverter.java +++ b/src/main/java/eu/interop/federationgateway/dbencryption/DbEncryptionStringConverter.java @@ -20,13 +20,13 @@ package eu.interop.federationgateway.dbencryption; +import jakarta.persistence.AttributeConverter; +import jakarta.persistence.Converter; +import jakarta.persistence.PersistenceException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import javax.crypto.BadPaddingException; import javax.crypto.IllegalBlockSizeException; -import javax.persistence.AttributeConverter; -import javax.persistence.Converter; -import javax.persistence.PersistenceException; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor diff --git a/src/main/java/eu/interop/federationgateway/entity/CallbackSubscriptionEntity.java b/src/main/java/eu/interop/federationgateway/entity/CallbackSubscriptionEntity.java index d01d4785..939dadff 100644 --- a/src/main/java/eu/interop/federationgateway/entity/CallbackSubscriptionEntity.java +++ b/src/main/java/eu/interop/federationgateway/entity/CallbackSubscriptionEntity.java @@ -20,14 +20,14 @@ package eu.interop.federationgateway.entity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.io.Serializable; import java.time.ZonedDateTime; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/interop/federationgateway/entity/CallbackTaskEntity.java b/src/main/java/eu/interop/federationgateway/entity/CallbackTaskEntity.java index 1b5058e0..1906a98f 100644 --- a/src/main/java/eu/interop/federationgateway/entity/CallbackTaskEntity.java +++ b/src/main/java/eu/interop/federationgateway/entity/CallbackTaskEntity.java @@ -20,16 +20,16 @@ package eu.interop.federationgateway.entity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; import java.time.ZonedDateTime; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.ManyToOne; -import javax.persistence.OneToOne; -import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/interop/federationgateway/entity/CertificateEntity.java b/src/main/java/eu/interop/federationgateway/entity/CertificateEntity.java index f3a8820b..9a9c39c3 100644 --- a/src/main/java/eu/interop/federationgateway/entity/CertificateEntity.java +++ b/src/main/java/eu/interop/federationgateway/entity/CertificateEntity.java @@ -20,16 +20,16 @@ package eu.interop.federationgateway.entity; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.io.Serializable; import java.time.ZonedDateTime; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyBatchEntity.java b/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyBatchEntity.java index 81d5a62a..2be6476a 100644 --- a/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyBatchEntity.java +++ b/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyBatchEntity.java @@ -21,14 +21,14 @@ package eu.interop.federationgateway.entity; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.io.Serializable; import java.time.ZonedDateTime; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyEntity.java b/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyEntity.java index bd4f8dfd..d3f53c38 100644 --- a/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyEntity.java +++ b/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyEntity.java @@ -21,15 +21,15 @@ package eu.interop.federationgateway.entity; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.persistence.Column; +import jakarta.persistence.Embedded; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.io.Serializable; import java.time.ZonedDateTime; -import javax.persistence.Column; -import javax.persistence.Embedded; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyPayload.java b/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyPayload.java index d74eee9d..d0eeba4d 100644 --- a/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyPayload.java +++ b/src/main/java/eu/interop/federationgateway/entity/DiagnosisKeyPayload.java @@ -24,10 +24,10 @@ import eu.interop.federationgateway.dbencryption.DbEncryptionIntConverter; import eu.interop.federationgateway.dbencryption.DbEncryptionReportTypeConverter; import eu.interop.federationgateway.dbencryption.DbEncryptionStringConverter; +import jakarta.persistence.Column; +import jakarta.persistence.Convert; +import jakarta.persistence.Embeddable; import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Convert; -import javax.persistence.Embeddable; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/interop/federationgateway/entity/FormatInformation.java b/src/main/java/eu/interop/federationgateway/entity/FormatInformation.java index bb62dc39..b0d0d070 100644 --- a/src/main/java/eu/interop/federationgateway/entity/FormatInformation.java +++ b/src/main/java/eu/interop/federationgateway/entity/FormatInformation.java @@ -20,9 +20,9 @@ package eu.interop.federationgateway.entity; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Embeddable; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/interop/federationgateway/entity/UploaderInformation.java b/src/main/java/eu/interop/federationgateway/entity/UploaderInformation.java index c97fd38c..6ba5809d 100644 --- a/src/main/java/eu/interop/federationgateway/entity/UploaderInformation.java +++ b/src/main/java/eu/interop/federationgateway/entity/UploaderInformation.java @@ -20,9 +20,9 @@ package eu.interop.federationgateway.entity; +import jakarta.persistence.Column; +import jakarta.persistence.Embeddable; import java.io.Serializable; -import javax.persistence.Column; -import javax.persistence.Embeddable; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/interop/federationgateway/filter/CertificateAuthentificationFilter.java b/src/main/java/eu/interop/federationgateway/filter/CertificateAuthentificationFilter.java index 3bf54df7..7242604e 100644 --- a/src/main/java/eu/interop/federationgateway/filter/CertificateAuthentificationFilter.java +++ b/src/main/java/eu/interop/federationgateway/filter/CertificateAuthentificationFilter.java @@ -24,6 +24,10 @@ import eu.interop.federationgateway.entity.CertificateEntity; import eu.interop.federationgateway.service.CertificateService; import eu.interop.federationgateway.utils.EfgsMdc; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.math.BigInteger; import java.net.URLDecoder; @@ -33,10 +37,6 @@ import java.util.Map; import java.util.Optional; import java.util.stream.Collectors; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Qualifier; @@ -57,6 +57,7 @@ public class CertificateAuthentificationFilter extends OncePerRequestFilter { public static final String REQUEST_PROP_COUNTRY = "reqPropCountry"; public static final String REQUEST_PROP_THUMBPRINT = "reqPropCertThumbprint"; + @Qualifier("requestMappingHandlerMapping") private final RequestMappingHandlerMapping requestMap; private final EfgsProperties properties; diff --git a/src/main/java/eu/interop/federationgateway/repository/CallbackTaskRepository.java b/src/main/java/eu/interop/federationgateway/repository/CallbackTaskRepository.java index 1e1aa118..0e4a05dc 100644 --- a/src/main/java/eu/interop/federationgateway/repository/CallbackTaskRepository.java +++ b/src/main/java/eu/interop/federationgateway/repository/CallbackTaskRepository.java @@ -22,10 +22,10 @@ import eu.interop.federationgateway.entity.CallbackSubscriptionEntity; import eu.interop.federationgateway.entity.CallbackTaskEntity; +import jakarta.transaction.Transactional; import java.time.ZonedDateTime; import java.util.List; import java.util.Optional; -import javax.transaction.Transactional; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; diff --git a/src/main/java/eu/interop/federationgateway/service/DiagnosisKeyEntityService.java b/src/main/java/eu/interop/federationgateway/service/DiagnosisKeyEntityService.java index 65b7d44c..c0ef129a 100644 --- a/src/main/java/eu/interop/federationgateway/service/DiagnosisKeyEntityService.java +++ b/src/main/java/eu/interop/federationgateway/service/DiagnosisKeyEntityService.java @@ -24,12 +24,12 @@ import eu.interop.federationgateway.model.AuditEntry; import eu.interop.federationgateway.repository.DiagnosisKeyEntityRepository; import eu.interop.federationgateway.utils.EfgsMdc; +import jakarta.transaction.Transactional; import java.time.ZoneOffset; import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import javax.transaction.Transactional; import lombok.Getter; import lombok.NonNull; import lombok.RequiredArgsConstructor; diff --git a/src/main/java/eu/interop/federationgateway/service/TransactionalCallbackTaskExecutorService.java b/src/main/java/eu/interop/federationgateway/service/TransactionalCallbackTaskExecutorService.java index 29bb2762..9ff398e2 100644 --- a/src/main/java/eu/interop/federationgateway/service/TransactionalCallbackTaskExecutorService.java +++ b/src/main/java/eu/interop/federationgateway/service/TransactionalCallbackTaskExecutorService.java @@ -27,9 +27,9 @@ import eu.interop.federationgateway.entity.CallbackTaskEntity; import eu.interop.federationgateway.repository.CallbackTaskRepository; import eu.interop.federationgateway.utils.EfgsMdc; +import jakarta.transaction.Transactional; import java.time.ZoneOffset; import java.time.ZonedDateTime; -import javax.transaction.Transactional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/eu/interop/federationgateway/service/TransactionalDiagnosisKeyBatchService.java b/src/main/java/eu/interop/federationgateway/service/TransactionalDiagnosisKeyBatchService.java index 18b6b60f..a7cc3ae3 100644 --- a/src/main/java/eu/interop/federationgateway/service/TransactionalDiagnosisKeyBatchService.java +++ b/src/main/java/eu/interop/federationgateway/service/TransactionalDiagnosisKeyBatchService.java @@ -27,6 +27,7 @@ import eu.interop.federationgateway.repository.DiagnosisKeyBatchRepository; import eu.interop.federationgateway.repository.DiagnosisKeyEntityRepository; import eu.interop.federationgateway.utils.EfgsMdc; +import jakarta.transaction.Transactional; import java.time.Instant; import java.time.ZoneOffset; import java.time.ZonedDateTime; @@ -35,7 +36,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; -import javax.transaction.Transactional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; diff --git a/src/main/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchConstraint.java b/src/main/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchConstraint.java index ecf2cce0..c3710160 100644 --- a/src/main/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchConstraint.java +++ b/src/main/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchConstraint.java @@ -20,12 +20,12 @@ package eu.interop.federationgateway.validator; +import jakarta.validation.Constraint; +import jakarta.validation.Payload; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -import javax.validation.Constraint; -import javax.validation.Payload; @Target({ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) diff --git a/src/main/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchValidator.java b/src/main/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchValidator.java index 24bcc646..98844761 100644 --- a/src/main/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchValidator.java +++ b/src/main/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchValidator.java @@ -21,11 +21,11 @@ package eu.interop.federationgateway.validator; import eu.interop.federationgateway.model.EfgsProto; +import jakarta.validation.ConstraintValidator; +import jakarta.validation.ConstraintValidatorContext; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.List; -import javax.validation.ConstraintValidator; -import javax.validation.ConstraintValidatorContext; import lombok.extern.slf4j.Slf4j; @Slf4j diff --git a/src/test/java/eu/interop/federationgateway/TestData.java b/src/test/java/eu/interop/federationgateway/TestData.java index bca1c4c8..60ef1d59 100644 --- a/src/test/java/eu/interop/federationgateway/TestData.java +++ b/src/test/java/eu/interop/federationgateway/TestData.java @@ -111,7 +111,7 @@ public class TestData { private static String insertSigningCertificate(CertificateRepository certificateRepository, X509Certificate certificate) throws NoSuchAlgorithmException, CertificateEncodingException, IOException, InvalidKeyException, SignatureException { String certHash = CertificateUtils.getCertThumbprint(certificate); - String certDn = certificate.getSubjectDN().toString(); + String certDn = certificate.getSubjectX500Principal().toString(); int countryIndex = certDn.indexOf(("C=")); String certCountry = certDn.substring(countryIndex + 2, countryIndex + 4); @@ -167,7 +167,7 @@ public static void insertCertificatesForAuthentication(CertificateRepository cer byte[] certHashBytes = MessageDigest.getInstance("SHA-256").digest(validAuthenticationCertificate.getEncoded()); AUTH_CERT_HASH = new BigInteger(1, certHashBytes).toString(16); - String certDn = validAuthenticationCertificate.getSubjectDN().toString(); + String certDn = validAuthenticationCertificate.getSubjectX500Principal().toString(); int countryIndex = certDn.indexOf(("C=")); String certCountry = certDn.substring(countryIndex + 2, countryIndex + 4); diff --git a/src/test/java/eu/interop/federationgateway/dbencryption/DbEncryptionTest.java b/src/test/java/eu/interop/federationgateway/dbencryption/DbEncryptionTest.java index a356d3e8..c1e673b8 100644 --- a/src/test/java/eu/interop/federationgateway/dbencryption/DbEncryptionTest.java +++ b/src/test/java/eu/interop/federationgateway/dbencryption/DbEncryptionTest.java @@ -23,8 +23,8 @@ import eu.interop.federationgateway.TestData; import eu.interop.federationgateway.entity.DiagnosisKeyEntity; import eu.interop.federationgateway.repository.DiagnosisKeyEntityRepository; +import jakarta.persistence.EntityManager; import java.time.ZonedDateTime; -import javax.persistence.EntityManager; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; diff --git a/src/test/java/eu/interop/federationgateway/service/CallbackTaskExecutorServiceTest.java b/src/test/java/eu/interop/federationgateway/service/CallbackTaskExecutorServiceTest.java index 3db85774..f10e62c2 100644 --- a/src/test/java/eu/interop/federationgateway/service/CallbackTaskExecutorServiceTest.java +++ b/src/test/java/eu/interop/federationgateway/service/CallbackTaskExecutorServiceTest.java @@ -111,7 +111,7 @@ public void setup() throws IOException, NoSuchAlgorithmException, KeyManagementE ); mockWebServer.start(); - mockWebServer.useHttps(sslContext.getSocketFactory(), false); + mockWebServer.useHttps(sslContext.getSocketFactory()); mockWebServer.requireClientAuth(); mockCallbackUrl = "https://localhost:" + mockWebServer.getPort(); diff --git a/src/test/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchValidatorTest.java b/src/test/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchValidatorTest.java index e8ada215..0478db63 100644 --- a/src/test/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchValidatorTest.java +++ b/src/test/java/eu/interop/federationgateway/validator/DiagnosisKeyBatchValidatorTest.java @@ -27,10 +27,10 @@ import com.google.protobuf.ByteString; import eu.interop.federationgateway.TestData; import eu.interop.federationgateway.model.EfgsProto; +import jakarta.validation.ConstraintValidatorContext; import java.time.Instant; import java.time.temporal.ChronoUnit; import java.util.List; -import javax.validation.ConstraintValidatorContext; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach;