diff --git a/.github/workflows/ci-dependency-check.yml b/.github/workflows/ci-dependency-check.yml index 47996d71..d7b27f1e 100644 --- a/.github/workflows/ci-dependency-check.yml +++ b/.github/workflows/ci-dependency-check.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt - uses: actions/checkout@v2 with: diff --git a/.github/workflows/ci-main.yml b/.github/workflows/ci-main.yml index f5d7a949..667d4406 100644 --- a/.github/workflows/ci-main.yml +++ b/.github/workflows/ci-main.yml @@ -6,11 +6,11 @@ on: - main jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt - uses: actions/checkout@v2 with: @@ -61,11 +61,11 @@ jobs: name: DGCG001_PRD path: target/DGCG001_PRD* build-docker: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt - uses: actions/checkout@v2 with: @@ -115,11 +115,11 @@ jobs: APP_PACKAGES_USERNAME: ${{ github.actor }} APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }} license: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt - uses: actions/checkout@v2 with: diff --git a/.github/workflows/ci-openapi.yml b/.github/workflows/ci-openapi.yml index af396736..0bc6d212 100644 --- a/.github/workflows/ci-openapi.yml +++ b/.github/workflows/ci-openapi.yml @@ -6,11 +6,11 @@ on: - created jobs: release: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt - uses: actions/checkout@v2 with: diff --git a/.github/workflows/ci-pull-request.yml b/.github/workflows/ci-pull-request.yml index c9233c81..2d2cd89e 100644 --- a/.github/workflows/ci-pull-request.yml +++ b/.github/workflows/ci-pull-request.yml @@ -7,11 +7,11 @@ on: - reopened jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt - uses: actions/checkout@v2 with: diff --git a/.github/workflows/ci-release-notes.yml b/.github/workflows/ci-release-notes.yml index b12c3216..0027745d 100644 --- a/.github/workflows/ci-release-notes.yml +++ b/.github/workflows/ci-release-notes.yml @@ -5,7 +5,7 @@ on: - created jobs: release-notes: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index f28aebf6..0ac0ce43 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -5,11 +5,11 @@ on: - created jobs: release: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt - uses: actions/checkout@v2 with: diff --git a/.github/workflows/ci-sonar.yml b/.github/workflows/ci-sonar.yml index 90171d45..5e7dcc41 100644 --- a/.github/workflows/ci-sonar.yml +++ b/.github/workflows/ci-sonar.yml @@ -10,11 +10,11 @@ on: - reopened jobs: sonar: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt - uses: actions/checkout@v2 with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3aa4ba9f..b91a1f60 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -29,10 +29,10 @@ jobs: with: languages: ${{ matrix.language }} - - name: Setup Java 11 + - name: Setup Java uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt - name: Build diff --git a/owasp/suppressions.xml b/owasp/suppressions.xml index c9656353..02f3e651 100644 --- a/owasp/suppressions.xml +++ b/owasp/suppressions.xml @@ -1,29 +1,29 @@ - Bug only affects not used features of embedded tomcat. - CVE-2022-23181 + no YAML content from users is parsed within this service + CVE-2022-1471 - False Positive - CVE-2016-1000027 + Bitcoin CLI is not used by the JSON LD Lib + CVE-2021-3401 + CVE-2021-31876 - False Positive - Updated to newest version - CVE-2018-14335 + H2 is only used for testing, not production + CVE-2022-45868 - False Positive - CVE-2020-5408 + False positive. CVE is matching for hutools. OWASP Check matches for json-lib + CVE-2022-45688 - Only affecting example code shipped with tomcat. - CVE-2022-34305 + Both CVE are matching for eclipse ide + CVE-2008-7271 + CVE-2010-4647 - DGCG is not using YML User Input, Bug is fixed with SnameYAML 1.32, but CVE Matcher is invalid - CVE-2022-38751 - CVE-2022-38752 + Still WIP + CVE-2022-41862 - diff --git a/pom.xml b/pom.xml index 65dcd701..f8f35518 100644 --- a/pom.xml +++ b/pom.xml @@ -5,9 +5,9 @@ 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 2.7.4 + org.springframework.cloud + spring-cloud-starter-parent + 2022.0.1 @@ -36,32 +36,27 @@ war - 11 - 11 - 11 + 17 + 17 + 17 UTF-8 UTF-8 - 7.1.2 - 5.7.3 - 1.18.24 - 4.17.0 - 1.6.11 - 1.5.2.Final - 1.70 - 3.1.0 + 2.0.0 + 8.0.2 + 1.6.14 + 1.5.3.Final + 1.72 + 4.1.1 1.14.1 - 4.42.0 - 2021.0.4 - 2.1.214 - 1.3.2 + 5.1.0 3.4.2 - 3.2.0 + 3.2.1 3.9.1.2184 0.8.8 - 1.7.0 + 1.7.1 EU Digital Green Certificate Gateway Service / dgc-gateway 2021 @@ -132,26 +127,14 @@ - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring.cloud.version} - pom - import - - - - eu.europa.ec.dgc dgc-lib - ${dgc.lib.version} + ${dgclib.version} - com.vdurmont + org.semver4j semver4j ${semver4j.version} @@ -161,28 +144,12 @@ ${json-schema.version} - mysql - mysql-connector-java - - - org.springframework.boot - spring-boot-starter - - - org.yaml - snakeyaml - - - - - org.yaml - snakeyaml - [1.33,) + com.mysql + mysql-connector-j com.fasterxml.jackson.core jackson-databind - [2.13.4.2,) org.springframework.boot @@ -226,17 +193,6 @@ org.liquibase liquibase-core - - - org.apache.commons - commons-text - - - - - org.apache.commons - commons-text - [1.10.0,) org.projectlombok @@ -251,7 +207,6 @@ com.h2database h2 - ${h2.version} runtime @@ -261,13 +216,12 @@ org.bouncycastle - bcpkix-jdk15on + bcpkix-jdk18on ${bcpkix.version} org.springframework.security spring-security-web - ${spring.security.version} net.javacrumbs.shedlock @@ -284,11 +238,6 @@ - - org.apache.maven.plugins - maven-checkstyle-plugin - ${plugin.checkstyle.version} - org.sonarsource.scanner.maven sonar-maven-plugin @@ -334,14 +283,14 @@ ./owasp/suppressions.xml true + false org.springframework.boot spring-boot-maven-plugin - ${project.parent.version} - dev + dev,log2console 5000 30 @@ -369,10 +318,10 @@ org.apache.maven.plugins maven-checkstyle-plugin + ${plugin.checkstyle.version} codestyle/checkstyle.xml target/**/* - UTF-8 true true warning diff --git a/src/main/java/eu/europa/ec/dgc/gateway/client/JrcClient.java b/src/main/java/eu/europa/ec/dgc/gateway/client/JrcClient.java index b43e2863..ea408a4a 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/client/JrcClient.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/client/JrcClient.java @@ -21,7 +21,7 @@ package eu.europa.ec.dgc.gateway.client; import eu.europa.ec.dgc.gateway.model.JrcRatValuesetResponse; -import javax.validation.Valid; +import jakarta.validation.Valid; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.validation.annotation.Validated; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/config/ErrorHandler.java b/src/main/java/eu/europa/ec/dgc/gateway/config/ErrorHandler.java index 93f16dcb..c5dc61f8 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/config/ErrorHandler.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/config/ErrorHandler.java @@ -22,7 +22,7 @@ import eu.europa.ec.dgc.gateway.exception.DgcgResponseException; import eu.europa.ec.dgc.gateway.restapi.dto.ProblemReportDto; -import javax.validation.ConstraintViolationException; +import jakarta.validation.ConstraintViolationException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Configuration; @@ -31,7 +31,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.server.ResponseStatusException; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; @ControllerAdvice @@ -63,12 +62,12 @@ public ResponseEntity handleException(ConstraintViolationExcep @ExceptionHandler(Exception.class) public ResponseEntity handleException(Exception e) { - if (e instanceof DgcgResponseException) { - DgcgResponseException de = (DgcgResponseException) e; + if (e instanceof DgcgResponseException dgcgException) { return ResponseEntity - .status(((ResponseStatusException) e).getStatus()) + .status(dgcgException.getStatus()) .contentType(MediaType.APPLICATION_JSON) - .body(new ProblemReportDto(de.getCode(), de.getProblem(), de.getSentValues(), de.getDetails())); + .body(new ProblemReportDto(dgcgException.getCode(), dgcgException.getProblem(), + dgcgException.getSentValues(), dgcgException.getDetails())); } else { log.error("Uncaught exception", e); return ResponseEntity diff --git a/src/main/java/eu/europa/ec/dgc/gateway/config/MdcCleanupInterceptor.java b/src/main/java/eu/europa/ec/dgc/gateway/config/MdcCleanupInterceptor.java index 7804043e..e450d664 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/config/MdcCleanupInterceptor.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/config/MdcCleanupInterceptor.java @@ -21,8 +21,8 @@ package eu.europa.ec.dgc.gateway.config; import eu.europa.ec.dgc.gateway.utils.DgcMdc; -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/europa/ec/dgc/gateway/config/ValidationRuleSchemaProvider.java b/src/main/java/eu/europa/ec/dgc/gateway/config/ValidationRuleSchemaProvider.java index 1033f3c3..58e8064d 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/config/ValidationRuleSchemaProvider.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/config/ValidationRuleSchemaProvider.java @@ -20,9 +20,9 @@ package eu.europa.ec.dgc.gateway.config; +import jakarta.annotation.PostConstruct; import java.io.IOException; import java.io.InputStream; -import javax.annotation.PostConstruct; import lombok.Getter; import lombok.RequiredArgsConstructor; import org.everit.json.schema.Schema; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/entity/AuditEventEntity.java b/src/main/java/eu/europa/ec/dgc/gateway/entity/AuditEventEntity.java index 2829f78b..66df288f 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/entity/AuditEventEntity.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/entity/AuditEventEntity.java @@ -20,13 +20,13 @@ package eu.europa.ec.dgc.gateway.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.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.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/entity/RevocationBatchEntity.java b/src/main/java/eu/europa/ec/dgc/gateway/entity/RevocationBatchEntity.java index fbb619ea..0585263d 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/entity/RevocationBatchEntity.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/entity/RevocationBatchEntity.java @@ -20,17 +20,17 @@ package eu.europa.ec.dgc.gateway.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.Index; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; 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.Index; -import javax.persistence.Lob; -import javax.persistence.Table; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/entity/SignerInformationEntity.java b/src/main/java/eu/europa/ec/dgc/gateway/entity/SignerInformationEntity.java index 825e48f7..df68e905 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/entity/SignerInformationEntity.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/entity/SignerInformationEntity.java @@ -20,15 +20,15 @@ package eu.europa.ec.dgc.gateway.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.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.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedIssuerEntity.java b/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedIssuerEntity.java index 02577dbd..6a17bd02 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedIssuerEntity.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedIssuerEntity.java @@ -20,15 +20,15 @@ package eu.europa.ec.dgc.gateway.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.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.Getter; import lombok.Setter; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedPartyEntity.java b/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedPartyEntity.java index 85d51778..f59e7a0b 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedPartyEntity.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/entity/TrustedPartyEntity.java @@ -20,19 +20,19 @@ package eu.europa.ec.dgc.gateway.entity; +import jakarta.persistence.CollectionTable; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; +import jakarta.persistence.FetchType; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; import java.time.ZonedDateTime; import java.util.List; -import javax.persistence.CollectionTable; -import javax.persistence.Column; -import javax.persistence.ElementCollection; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.FetchType; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/entity/ValidationRuleEntity.java b/src/main/java/eu/europa/ec/dgc/gateway/entity/ValidationRuleEntity.java index ead22415..38fad1a5 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/entity/ValidationRuleEntity.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/entity/ValidationRuleEntity.java @@ -20,16 +20,16 @@ package eu.europa.ec.dgc.gateway.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 jakarta.persistence.UniqueConstraint; 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 javax.persistence.UniqueConstraint; import lombok.Getter; import lombok.Setter; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/entity/ValuesetEntity.java b/src/main/java/eu/europa/ec/dgc/gateway/entity/ValuesetEntity.java index 1ecfacb5..98be0660 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/entity/ValuesetEntity.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/entity/ValuesetEntity.java @@ -20,11 +20,11 @@ package eu.europa.ec.dgc.gateway.entity; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.Lob; -import javax.persistence.Table; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +import jakarta.persistence.Lob; +import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/exception/DgcgResponseException.java b/src/main/java/eu/europa/ec/dgc/gateway/exception/DgcgResponseException.java index 535ba93d..2ee3c068 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/exception/DgcgResponseException.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/exception/DgcgResponseException.java @@ -22,15 +22,15 @@ import lombok.Getter; import org.springframework.http.HttpStatus; -import org.springframework.web.server.ResponseStatusException; @Getter -public class DgcgResponseException extends ResponseStatusException { +public class DgcgResponseException extends RuntimeException { private final String code; private final String details; private final String sentValues; private final String problem; + private final HttpStatus status; /** * All Args constructor for DgcgResponseException. @@ -42,7 +42,7 @@ public class DgcgResponseException extends ResponseStatusException { * @param problem short problem description. */ public DgcgResponseException(HttpStatus status, String code, String problem, String sentValues, String details) { - super(status); + this.status = status; this.code = code; this.details = details; this.sentValues = sentValues; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/model/JrcRatValueset.java b/src/main/java/eu/europa/ec/dgc/gateway/model/JrcRatValueset.java index 647a67ea..b950aaab 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/model/JrcRatValueset.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/model/JrcRatValueset.java @@ -22,9 +22,9 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import java.time.ZonedDateTime; import java.util.List; -import javax.validation.constraints.NotNull; import lombok.Data; @Data diff --git a/src/main/java/eu/europa/ec/dgc/gateway/model/JrcRatValuesetResponse.java b/src/main/java/eu/europa/ec/dgc/gateway/model/JrcRatValuesetResponse.java index 46173393..a996ff3f 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/model/JrcRatValuesetResponse.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/model/JrcRatValuesetResponse.java @@ -22,9 +22,9 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonProperty; +import jakarta.validation.constraints.NotNull; import java.time.ZonedDateTime; import java.util.List; -import javax.validation.constraints.NotNull; import lombok.Data; @Data diff --git a/src/main/java/eu/europa/ec/dgc/gateway/repository/RevocationBatchRepository.java b/src/main/java/eu/europa/ec/dgc/gateway/repository/RevocationBatchRepository.java index 74a5a02d..94d6fc17 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/repository/RevocationBatchRepository.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/repository/RevocationBatchRepository.java @@ -22,10 +22,10 @@ import eu.europa.ec.dgc.gateway.entity.RevocationBatchEntity; import eu.europa.ec.dgc.gateway.entity.RevocationBatchProjection; +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; @@ -44,14 +44,18 @@ public interface RevocationBatchRepository extends JpaRepository getByBatchId(String batchId); @Modifying - @Query("UPDATE RevocationBatchEntity r SET r.signedBatch = null, r.deleted = true, " - + "r.changed = current_timestamp WHERE r.batchId = :batchId") - int markBatchAsDeleted(@Param("batchId") String batchId); + @Query(""" + UPDATE RevocationBatchEntity r SET r.signedBatch = null, r.deleted = true, + r.changed = :currentTimestamp WHERE r.batchId = :batchId""") + int markBatchAsDeleted(@Param("batchId") String batchId, + @Param("currentTimestamp") ZonedDateTime currentTimestamp); @Modifying - @Query("UPDATE RevocationBatchEntity r SET r.signedBatch = null, r.deleted = true, " - + "r.changed = current_timestamp WHERE r.deleted = false AND r.expires < :threshold") - int markExpiredBatchesAsDeleted(@Param("threshold") ZonedDateTime threshold); + @Query(""" + UPDATE RevocationBatchEntity r SET r.signedBatch = null, r.deleted = true, + r.changed = :currentTimestamp WHERE r.deleted = false AND r.expires < :threshold""") + int markExpiredBatchesAsDeleted(@Param("threshold") ZonedDateTime threshold, + @Param("currentTimestamp") ZonedDateTime currentTimestamp); @Modifying @Query("DELETE FROM RevocationBatchEntity r WHERE r.deleted = true AND r.changed < :threshold") diff --git a/src/main/java/eu/europa/ec/dgc/gateway/repository/SignerInformationRepository.java b/src/main/java/eu/europa/ec/dgc/gateway/repository/SignerInformationRepository.java index e0f5a3ec..cfd26b40 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/repository/SignerInformationRepository.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/repository/SignerInformationRepository.java @@ -21,10 +21,10 @@ package eu.europa.ec.dgc.gateway.repository; import eu.europa.ec.dgc.gateway.entity.SignerInformationEntity; +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/europa/ec/dgc/gateway/repository/ValidationRuleRepository.java b/src/main/java/eu/europa/ec/dgc/gateway/repository/ValidationRuleRepository.java index 2f38175f..580093de 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/repository/ValidationRuleRepository.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/repository/ValidationRuleRepository.java @@ -21,10 +21,10 @@ package eu.europa.ec.dgc.gateway.repository; import eu.europa.ec.dgc.gateway.entity.ValidationRuleEntity; +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/europa/ec/dgc/gateway/repository/ValuesetRepository.java b/src/main/java/eu/europa/ec/dgc/gateway/repository/ValuesetRepository.java index 3b2346dc..eb3c099d 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/repository/ValuesetRepository.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/repository/ValuesetRepository.java @@ -21,8 +21,8 @@ package eu.europa.ec.dgc.gateway.repository; import eu.europa.ec.dgc.gateway.entity.ValuesetEntity; +import jakarta.transaction.Transactional; import java.util.List; -import javax.transaction.Transactional; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListController.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListController.java index f68e93a3..b9fe0874 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListController.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListController.java @@ -43,9 +43,9 @@ import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Pattern; import java.time.ZonedDateTime; -import javax.validation.Valid; -import javax.validation.constraints.Pattern; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.format.annotation.DateTimeFormat; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/TrustListController.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/TrustListController.java index 4da39412..48a1bb69 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/TrustListController.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/TrustListController.java @@ -42,11 +42,11 @@ import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import jakarta.validation.Valid; +import jakarta.validation.constraints.Size; import java.time.ZonedDateTime; import java.util.List; import java.util.Locale; -import javax.validation.Valid; -import javax.validation.constraints.Size; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/ValidationRuleController.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/ValidationRuleController.java index 220eba22..fcd748f6 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/ValidationRuleController.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/controller/ValidationRuleController.java @@ -41,11 +41,11 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import jakarta.validation.Valid; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.hibernate.validator.constraints.Length; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchDeleteRequestDto.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchDeleteRequestDto.java index 6c5f3a63..44d962c7 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchDeleteRequestDto.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchDeleteRequestDto.java @@ -21,7 +21,7 @@ package eu.europa.ec.dgc.gateway.restapi.dto.revocation; import io.swagger.v3.oas.annotations.media.Schema; -import javax.validation.constraints.Pattern; +import jakarta.validation.constraints.Pattern; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchDto.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchDto.java index a1b5039f..21b15234 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchDto.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchDto.java @@ -21,11 +21,11 @@ package eu.europa.ec.dgc.gateway.restapi.dto.revocation; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Pattern; +import jakarta.validation.constraints.Size; import java.time.ZonedDateTime; import java.util.List; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; -import javax.validation.constraints.Size; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchListDto.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchListDto.java index 590719aa..10b32424 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchListDto.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/dto/revocation/RevocationBatchListDto.java @@ -21,9 +21,9 @@ package eu.europa.ec.dgc.gateway.restapi.dto.revocation; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Pattern; import java.time.ZonedDateTime; import java.util.List; -import javax.validation.constraints.Pattern; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/filter/CertificateAuthenticationFilter.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/filter/CertificateAuthenticationFilter.java index 18adf0df..2bc88434 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/filter/CertificateAuthenticationFilter.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/filter/CertificateAuthenticationFilter.java @@ -26,6 +26,10 @@ import eu.europa.ec.dgc.gateway.restapi.mapper.CertificateRoleMapper; import eu.europa.ec.dgc.gateway.service.TrustedPartyService; import eu.europa.ec.dgc.gateway.utils.DgcMdc; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLDecoder; import java.nio.charset.StandardCharsets; @@ -34,10 +38,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.bouncycastle.util.encoders.DecoderException; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/restapi/filter/IpLoggingFilter.java b/src/main/java/eu/europa/ec/dgc/gateway/restapi/filter/IpLoggingFilter.java index 0ee1bcb7..b8ba49a8 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/restapi/filter/IpLoggingFilter.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/restapi/filter/IpLoggingFilter.java @@ -21,11 +21,11 @@ package eu.europa.ec.dgc.gateway.restapi.filter; import eu.europa.ec.dgc.gateway.utils.DgcMdc; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; -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.stereotype.Component; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/service/RatValuesetUpdateService.java b/src/main/java/eu/europa/ec/dgc/gateway/service/RatValuesetUpdateService.java index 0d9d0f8f..b16b5258 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/service/RatValuesetUpdateService.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/service/RatValuesetUpdateService.java @@ -31,13 +31,13 @@ import eu.europa.ec.dgc.gateway.model.Valueset; import eu.europa.ec.dgc.gateway.utils.DgcMdc; import feign.FeignException; +import jakarta.annotation.PostConstruct; +import jakarta.validation.ConstraintViolationException; import java.time.LocalDate; import java.time.ZonedDateTime; import java.util.Comparator; import java.util.HashMap; import java.util.Optional; -import javax.annotation.PostConstruct; -import javax.validation.ConstraintViolationException; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.javacrumbs.shedlock.spring.annotation.SchedulerLock; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/service/RevocationListCleanUpService.java b/src/main/java/eu/europa/ec/dgc/gateway/service/RevocationListCleanUpService.java index b8e74304..49c65a83 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/service/RevocationListCleanUpService.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/service/RevocationListCleanUpService.java @@ -46,7 +46,8 @@ public class RevocationListCleanUpService { public void cleanup() { log.info("Starting Revocation List Cleanup Job."); - int affectedRowsMarkAsDeleted = revocationBatchRepository.markExpiredBatchesAsDeleted(ZonedDateTime.now()); + int affectedRowsMarkAsDeleted = revocationBatchRepository + .markExpiredBatchesAsDeleted(ZonedDateTime.now(), ZonedDateTime.now()); log.info("Marked {} Revocation Batches as deleted.", affectedRowsMarkAsDeleted); int affectedRowsDeleted = revocationBatchRepository.deleteDeletedBatchesOlderThan( diff --git a/src/main/java/eu/europa/ec/dgc/gateway/service/RevocationListService.java b/src/main/java/eu/europa/ec/dgc/gateway/service/RevocationListService.java index e436f647..56f53840 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/service/RevocationListService.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/service/RevocationListService.java @@ -177,7 +177,7 @@ public void deleteRevocationBatch( log.info("Deleting Revocation Batch with Batch ID {} from DB", parsedDeleteRequest.getBatchId()); - revocationBatchRepository.markBatchAsDeleted(parsedDeleteRequest.getBatchId()); + revocationBatchRepository.markBatchAsDeleted(parsedDeleteRequest.getBatchId(), ZonedDateTime.now()); auditService.addAuditEvent( authenticatedCountryCode, diff --git a/src/main/java/eu/europa/ec/dgc/gateway/service/ValidationRuleService.java b/src/main/java/eu/europa/ec/dgc/gateway/service/ValidationRuleService.java index bf01f4e3..71050de4 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/service/ValidationRuleService.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/service/ValidationRuleService.java @@ -25,7 +25,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.vdurmont.semver4j.Semver; import eu.europa.ec.dgc.gateway.config.ValidationRuleSchemaProvider; import eu.europa.ec.dgc.gateway.entity.TrustedPartyEntity; import eu.europa.ec.dgc.gateway.entity.ValidationRuleEntity; @@ -51,6 +50,7 @@ import org.everit.json.schema.ValidationException; import org.json.JSONException; import org.json.JSONObject; +import org.semver4j.Semver; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; diff --git a/src/main/java/eu/europa/ec/dgc/gateway/service/ValuesetService.java b/src/main/java/eu/europa/ec/dgc/gateway/service/ValuesetService.java index af1ec74a..4a0595b7 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/service/ValuesetService.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/service/ValuesetService.java @@ -23,9 +23,9 @@ import eu.europa.ec.dgc.gateway.entity.ValuesetEntity; import eu.europa.ec.dgc.gateway.repository.ValuesetRepository; import eu.europa.ec.dgc.gateway.utils.DgcMdc; +import jakarta.transaction.Transactional; import java.util.List; import java.util.Optional; -import javax.transaction.Transactional; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; diff --git a/src/test/java/eu/europa/ec/dgc/gateway/restapi/controller/SignerCertificateIntegrationTest.java b/src/test/java/eu/europa/ec/dgc/gateway/restapi/controller/SignerCertificateIntegrationTest.java index 3c1021d8..40a13b91 100644 --- a/src/test/java/eu/europa/ec/dgc/gateway/restapi/controller/SignerCertificateIntegrationTest.java +++ b/src/test/java/eu/europa/ec/dgc/gateway/restapi/controller/SignerCertificateIntegrationTest.java @@ -106,7 +106,7 @@ void testSuccessfulUpload() throws Exception { String authCertHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payload) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -157,7 +157,7 @@ void testUploadFailedConflict() throws Exception { String authCertHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payload) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -165,7 +165,7 @@ void testUploadFailedConflict() throws Exception { ) .andExpect(status().isCreated()); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payload) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -203,7 +203,7 @@ void testUploadFailedInvalidCSCA() throws Exception { String authCertHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payload) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -242,7 +242,7 @@ void testUploadFailedInvalidCSCAWrongCountryCode() throws Exception { String authCertHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payload) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -281,7 +281,7 @@ void testUploadFailedPayloadCertCountryWrong() throws Exception { String authCertHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payload) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -320,7 +320,7 @@ void testUploadFailedWrongSignerCertificate() throws Exception { String authCertHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payload) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -361,7 +361,7 @@ void testUploadFailedInvalidCmsMessage() throws Exception { String authCertHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payload) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -407,7 +407,7 @@ void testReupload() throws Exception { String authCertHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payloadString) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -432,7 +432,7 @@ void testReupload() throws Exception { /* * Step 2: Delete DSC */ - mockMvc.perform(delete("/signerCertificate/") + mockMvc.perform(delete("/signerCertificate") .content(payloadString) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) @@ -456,7 +456,7 @@ void testReupload() throws Exception { /* * Step 3: Reupload DSC */ - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .content(payloadString) .contentType("application/cms") .header(dgcConfigProperties.getCertAuth().getHeaderFields().getThumbprint(), authCertHash) diff --git a/src/test/java/eu/europa/ec/dgc/gateway/restapi/filter/CertAuthFilterTest.java b/src/test/java/eu/europa/ec/dgc/gateway/restapi/filter/CertAuthFilterTest.java index c3491cf6..a58bf6da 100644 --- a/src/test/java/eu/europa/ec/dgc/gateway/restapi/filter/CertAuthFilterTest.java +++ b/src/test/java/eu/europa/ec/dgc/gateway/restapi/filter/CertAuthFilterTest.java @@ -58,7 +58,7 @@ void testRequestShouldFailIfDNHeaderIsMissing() throws Exception { String certHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getThumbprint(), certHash) ).andExpect(status().isUnauthorized()); @@ -66,7 +66,7 @@ void testRequestShouldFailIfDNHeaderIsMissing() throws Exception { @Test void testRequestShouldFailIfThumbprintHeaderIsMissing() throws Exception { - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getDistinguishedName(), authDn) ).andExpect(status().isUnauthorized()); @@ -74,14 +74,14 @@ void testRequestShouldFailIfThumbprintHeaderIsMissing() throws Exception { @Test void testRequestShouldFailIfCertHeadersAreMissing() throws Exception { - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") ).andExpect(status().isUnauthorized()); } @Test void testRequestShouldFailIfCertIsNotOnWhitelist() throws Exception { - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getThumbprint(), "randomString") .header(properties.getCertAuth().getHeaderFields().getDistinguishedName(), authDn) @@ -93,7 +93,7 @@ void testFilterShouldAppendCountryAndThumbprintToRequestObject() throws Exceptio String certHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getThumbprint(), certHash) .header(properties.getCertAuth().getHeaderFields().getDistinguishedName(), authDn) @@ -115,7 +115,7 @@ void testFilterShouldDecodeDnString() throws Exception { String certHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getThumbprint(), certHash) .header(properties.getCertAuth().getHeaderFields().getDistinguishedName(), encodedDnString) @@ -144,7 +144,7 @@ void testFilterShouldDecodeBase64AndUrlEncodedCertThumbprint() throws Exception String encodedThumbprint = URLEncoder.encode(Base64.getEncoder().encodeToString(certHashBytes), StandardCharsets.UTF_8); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getThumbprint(), encodedThumbprint) .header(properties.getCertAuth().getHeaderFields().getDistinguishedName(), @@ -173,7 +173,7 @@ void testFilterShouldDecodeBase64EncodedCertThumbprint() throws Exception { String encodedThumbprint = Base64.getEncoder().encodeToString(certHashBytes); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getThumbprint(), encodedThumbprint) .header(properties.getCertAuth().getHeaderFields().getDistinguishedName(), @@ -194,7 +194,7 @@ void testRequestShouldFailIfCountryIsNotPresentInDnString() throws Exception { String certHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getThumbprint(), certHash) .header(properties.getCertAuth().getHeaderFields().getDistinguishedName(), @@ -207,7 +207,7 @@ void testFilterShouldFindCountryEvenOnMalformedDnString() throws Exception { String certHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getThumbprint(), certHash) .header(properties.getCertAuth().getHeaderFields().getDistinguishedName(), @@ -221,7 +221,7 @@ void testRequestShouldNotFailIfDnStringContainsDuplicatedKeys() throws Exception String certHash = trustedPartyTestHelper.getHash(TrustedPartyEntity.CertificateType.AUTHENTICATION, countryCode); - mockMvc.perform(post("/signerCertificate/") + mockMvc.perform(post("/signerCertificate") .contentType("application/cms") .header(properties.getCertAuth().getHeaderFields().getThumbprint(), certHash) .header(properties.getCertAuth().getHeaderFields().getDistinguishedName(), diff --git a/src/test/java/eu/europa/ec/dgc/gateway/service/RatValuesetUpdateServiceTest.java b/src/test/java/eu/europa/ec/dgc/gateway/service/RatValuesetUpdateServiceTest.java index a386d8bd..3ed0f9aa 100644 --- a/src/test/java/eu/europa/ec/dgc/gateway/service/RatValuesetUpdateServiceTest.java +++ b/src/test/java/eu/europa/ec/dgc/gateway/service/RatValuesetUpdateServiceTest.java @@ -36,6 +36,7 @@ import feign.FeignException; import feign.Request; import feign.RequestTemplate; +import jakarta.validation.ConstraintViolationException; import java.time.LocalDate; import java.time.ZonedDateTime; import java.time.temporal.ChronoUnit; @@ -43,7 +44,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.validation.ConstraintViolationException; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test;