From d1e2b9270eb781b8c293db28788b05d694053682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Ra=CC=88th?= Date: Wed, 29 Nov 2023 16:23:41 +0100 Subject: [PATCH 1/4] feat: revocation-list controller disabled. --- .../controller/CertificateRevocationListController.java | 2 ++ src/main/resources/application.yml | 4 ++++ 2 files changed, 6 insertions(+) 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 be581fef..68a53877 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 @@ -48,6 +48,7 @@ import java.time.ZonedDateTime; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; @@ -69,6 +70,7 @@ @RequiredArgsConstructor @Validated @Slf4j +@ConditionalOnProperty(name = "revocation-list.controller.enabled", havingValue = "true") public class CertificateRevocationListController { private final RevocationListService revocationListService; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ba197cfa..ef191da0 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -107,3 +107,7 @@ dgc: springdoc: api-docs: enabled: false + +revocation-list: + controller: + enabled: false \ No newline at end of file From 5b2a2d139df4f87d7f402de7f8c242d14f876c31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Ra=CC=88th?= Date: Wed, 29 Nov 2023 17:09:30 +0100 Subject: [PATCH 2/4] feat: revocation-list test disabled. --- pom.xml | 12 ++++++++++++ .../service/RevocationListCleanUpService.java | 2 ++ .../dgc/gateway/service/RevocationListService.java | 2 ++ 3 files changed, 16 insertions(+) diff --git a/pom.xml b/pom.xml index 42e5680a..8905768e 100644 --- a/pom.xml +++ b/pom.xml @@ -56,6 +56,7 @@ 5.2.0 2.2.220 + 3.1.2 3.4.2 3.2.1 3.9.1.2184 @@ -365,6 +366,17 @@ maven-assembly-plugin ${plugin.maven-assembly.version} + + org.apache.maven.plugins + maven-surefire-plugin + ${plugin.maven-surefire.version} + + + eu.europa.ec.dgc.gateway.restapi.controller/CertificateRevocationListIntegrationTest.java + eu.europa.ec.dgc.gateway.service/CertificateRevocationListCleanupTest.java + + + 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 0736ac2b..e154a76e 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 @@ -26,12 +26,14 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import net.javacrumbs.shedlock.spring.annotation.SchedulerLock; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor @Slf4j +@ConditionalOnProperty(name = "revocation-list.controller.enabled", havingValue = "true") public class RevocationListCleanUpService { private final RevocationBatchRepository revocationBatchRepository; 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 603479ed..174229b6 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 @@ -47,6 +47,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.bouncycastle.cert.X509CertificateHolder; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; import org.springframework.validation.BeanPropertyBindingResult; @@ -57,6 +58,7 @@ @Service @Slf4j @RequiredArgsConstructor +@ConditionalOnProperty(name = "revocation-list.controller.enabled", havingValue = "true") public class RevocationListService { private static final int MAX_BATCH_LIST_SIZE = 1000; From 42e54c0750212c21d853c80dadc5cca55ee1f2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Ra=CC=88th?= Date: Thu, 30 Nov 2023 10:04:18 +0100 Subject: [PATCH 3/4] Move revocation.enabled to DgcProperties. --- .../europa/ec/dgc/gateway/config/DgcConfigProperties.java | 1 + .../controller/CertificateRevocationListController.java | 2 +- .../dgc/gateway/service/RevocationListCleanUpService.java | 2 +- .../ec/dgc/gateway/service/RevocationListService.java | 2 +- src/main/resources/application.yml | 6 ++---- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/eu/europa/ec/dgc/gateway/config/DgcConfigProperties.java b/src/main/java/eu/europa/ec/dgc/gateway/config/DgcConfigProperties.java index 65c2574b..48bbb2f4 100644 --- a/src/main/java/eu/europa/ec/dgc/gateway/config/DgcConfigProperties.java +++ b/src/main/java/eu/europa/ec/dgc/gateway/config/DgcConfigProperties.java @@ -151,6 +151,7 @@ public static class HeaderFields { @Setter public static class Revocation { private int deleteThreshold = 14; + private Boolean enabled; } @Getter 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 68a53877..bbb97245 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 @@ -70,7 +70,7 @@ @RequiredArgsConstructor @Validated @Slf4j -@ConditionalOnProperty(name = "revocation-list.controller.enabled", havingValue = "true") +@ConditionalOnProperty(name = "dgc.revocation.enabled", havingValue = "true") public class CertificateRevocationListController { private final RevocationListService revocationListService; 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 e154a76e..3e166171 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 @@ -33,7 +33,7 @@ @Service @RequiredArgsConstructor @Slf4j -@ConditionalOnProperty(name = "revocation-list.controller.enabled", havingValue = "true") +@ConditionalOnProperty(name = "dgc.revocation.enabled", havingValue = "true") public class RevocationListCleanUpService { private final RevocationBatchRepository revocationBatchRepository; 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 174229b6..ae6ed318 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 @@ -58,7 +58,7 @@ @Service @Slf4j @RequiredArgsConstructor -@ConditionalOnProperty(name = "revocation-list.controller.enabled", havingValue = "true") +@ConditionalOnProperty(name = "dgc.revocation.enabled", havingValue = "true") public class RevocationListService { private static final int MAX_BATCH_LIST_SIZE = 1000; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index ef191da0..55930f43 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -67,6 +67,7 @@ dgc: pem: X-SSL-Client-Cert revocation: delete-threshold: 14 + enabled: false signer-information: delete-threshold: 14 trustedCertificates: @@ -104,10 +105,7 @@ dgc: apiKey: 0a0a0a0a-0a0a-0a0a-0a0a-0a0a0a0a0a0a url: https://api.cloudmersive.com enabled: false + springdoc: api-docs: enabled: false - -revocation-list: - controller: - enabled: false \ No newline at end of file From 0704303247febe7d9cec71b1bbf15f47a7ba7a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karsten=20Ra=CC=88th?= Date: Thu, 30 Nov 2023 15:29:21 +0100 Subject: [PATCH 4/4] Tests for revocation disabled with condition. --- pom.xml | 12 ------------ .../CertificateRevocationListIntegrationTest.java | 2 ++ .../CertificateRevocationListCleanupTest.java | 2 ++ src/test/resources/application.yml | 2 ++ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 8f2236d4..ee1b98a7 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,6 @@ 5.2.0 2.2.220 - 3.1.2 3.4.2 3.2.1 3.9.1.2184 @@ -386,17 +385,6 @@ maven-assembly-plugin ${plugin.maven-assembly.version} - - org.apache.maven.plugins - maven-surefire-plugin - ${plugin.maven-surefire.version} - - - eu.europa.ec.dgc.gateway.restapi.controller/CertificateRevocationListIntegrationTest.java - eu.europa.ec.dgc.gateway.service/CertificateRevocationListCleanupTest.java - - - diff --git a/src/test/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListIntegrationTest.java b/src/test/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListIntegrationTest.java index 7a496f5a..566b5f2e 100644 --- a/src/test/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListIntegrationTest.java +++ b/src/test/java/eu/europa/ec/dgc/gateway/restapi/controller/CertificateRevocationListIntegrationTest.java @@ -69,11 +69,13 @@ import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.HttpHeaders; import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.test.context.junit.jupiter.EnabledIf; import org.springframework.test.web.servlet.MockMvc; @SpringBootTest @AutoConfigureMockMvc @Slf4j +@EnabledIf(expression = "${dgc.revocation.enabled}", loadContext = true) public class CertificateRevocationListIntegrationTest { @Autowired diff --git a/src/test/java/eu/europa/ec/dgc/gateway/service/CertificateRevocationListCleanupTest.java b/src/test/java/eu/europa/ec/dgc/gateway/service/CertificateRevocationListCleanupTest.java index 5b511622..0d5f84c1 100644 --- a/src/test/java/eu/europa/ec/dgc/gateway/service/CertificateRevocationListCleanupTest.java +++ b/src/test/java/eu/europa/ec/dgc/gateway/service/CertificateRevocationListCleanupTest.java @@ -30,9 +30,11 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.EnabledIf; @SpringBootTest(properties = "dgc.revocation.delete-threshold=14") @Slf4j +@EnabledIf(expression = "${dgc.revocation.enabled}", loadContext = true) class CertificateRevocationListCleanupTest { @Autowired diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index d0efa1ae..a568bec3 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -39,6 +39,8 @@ dgc: thumbprint: X-SSL-Client-SHA256 distinguished-name: X-SSL-Client-DN pem: X-SSL-Client-Cert + revocation: + enabled: false did: enableDidGeneration: true didId: a