From aa0d199a853063fd5637d3a745c4d1eecfc30afd Mon Sep 17 00:00:00 2001 From: David Werth Date: Mon, 13 Oct 2025 11:00:24 +0200 Subject: [PATCH] Show Example with Proxy --- pom.xml | 5 +++++ .../org/jadice/dss/util/TrustStoreCreator.java | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/pom.xml b/pom.xml index 2eacc18..2d01d99 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,11 @@ ${jadice.utils.groupId} logging + + org.slf4j + slf4j-simple + 2.0.17 + org.junit.jupiter diff --git a/src/main/java/org/jadice/dss/util/TrustStoreCreator.java b/src/main/java/org/jadice/dss/util/TrustStoreCreator.java index 0c554b2..d21f193 100644 --- a/src/main/java/org/jadice/dss/util/TrustStoreCreator.java +++ b/src/main/java/org/jadice/dss/util/TrustStoreCreator.java @@ -17,6 +17,8 @@ import eu.europa.esig.dss.model.x509.CertificateToken; import eu.europa.esig.dss.service.http.commons.CommonsDataLoader; import eu.europa.esig.dss.service.http.commons.FileCacheDataLoader; +import eu.europa.esig.dss.service.http.proxy.ProxyConfig; +import eu.europa.esig.dss.service.http.proxy.ProxyProperties; import eu.europa.esig.dss.spi.tsl.TrustedListsCertificateSource; import eu.europa.esig.dss.spi.x509.CertificateSource; import eu.europa.esig.dss.spi.x509.KeyStoreCertificateSource; @@ -115,12 +117,24 @@ private static TLValidationJob createJob(TrustedListsCertificateSource tslCertif } private static FileCacheDataLoader onlineLoader() { + ProxyProperties httpProperties = new ProxyProperties(); + httpProperties.setHost("proxy.jadice.com"); + httpProperties.setPort(8080); + httpProperties.setScheme("https"); + httpProperties.setUser("proxyUser"); + httpProperties.setPassword("proxyPass".toCharArray()); + + ProxyConfig proxyConfig = new ProxyConfig(); + proxyConfig.setHttpsProperties(httpProperties); + + FileCacheDataLoader onlineFileLoader = new FileCacheDataLoader(); onlineFileLoader.setCacheExpirationTime(0); CommonsDataLoader dl = new CommonsDataLoader(); dl.setTimeoutConnection(5000); dl.setTimeoutConnectionRequest(5000); dl.setRedirectsEnabled(true); + dl.setProxyConfig(proxyConfig); onlineFileLoader.setDataLoader(dl); // We need to specify a cache directory