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 be581fef..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 @@ -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 = "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 0736ac2b..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 @@ -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 = "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 603479ed..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 @@ -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 = "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 ba197cfa..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,6 +105,7 @@ dgc: apiKey: 0a0a0a0a-0a0a-0a0a-0a0a-0a0a0a0a0a0a url: https://api.cloudmersive.com enabled: false + springdoc: api-docs: enabled: false 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