From 507ae1e9a9a22b2fa9e546cc448b9fbb727f1705 Mon Sep 17 00:00:00 2001 From: Suleiman Date: Thu, 13 Sep 2018 09:30:32 -0700 Subject: [PATCH] https access added --- .../dmc/service/TrustAnyHostnameVerifier.java | 16 +++++++++++++ .../dmc/service/TrustAnyTrustManager.java | 24 +++++++++++++++++++ .../iris/dmc/service/StationServiceTest.java | 21 ++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 src/main/java/edu/iris/dmc/service/TrustAnyHostnameVerifier.java create mode 100644 src/main/java/edu/iris/dmc/service/TrustAnyTrustManager.java create mode 100644 src/test/java/edu/iris/dmc/service/StationServiceTest.java diff --git a/src/main/java/edu/iris/dmc/service/TrustAnyHostnameVerifier.java b/src/main/java/edu/iris/dmc/service/TrustAnyHostnameVerifier.java new file mode 100644 index 0000000..438eb5d --- /dev/null +++ b/src/main/java/edu/iris/dmc/service/TrustAnyHostnameVerifier.java @@ -0,0 +1,16 @@ +package edu.iris.dmc.service; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLSession; + +/** + * Util4J + * @author Util4J + * + */ +public class TrustAnyHostnameVerifier implements HostnameVerifier { + + public boolean verify(String hostname, SSLSession session) { + return true; + } +} diff --git a/src/main/java/edu/iris/dmc/service/TrustAnyTrustManager.java b/src/main/java/edu/iris/dmc/service/TrustAnyTrustManager.java new file mode 100644 index 0000000..a774d90 --- /dev/null +++ b/src/main/java/edu/iris/dmc/service/TrustAnyTrustManager.java @@ -0,0 +1,24 @@ +package edu.iris.dmc.service; + +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.X509TrustManager; + +/** + * Util4J + * @author Util4J + * + */ +public class TrustAnyTrustManager implements X509TrustManager { + + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[] {}; + } +} \ No newline at end of file diff --git a/src/test/java/edu/iris/dmc/service/StationServiceTest.java b/src/test/java/edu/iris/dmc/service/StationServiceTest.java new file mode 100644 index 0000000..01ffec0 --- /dev/null +++ b/src/test/java/edu/iris/dmc/service/StationServiceTest.java @@ -0,0 +1,21 @@ +package edu.iris.dmc.service; + +import java.util.List; + +import org.junit.Test; + +import edu.iris.dmc.criteria.SacpzCriteria; +import edu.iris.dmc.fdsn.station.model.Network; +import edu.iris.dmc.sacpz.model.Sacpz; +import edu.iris.dmc.ws.util.DateUtil; +import edu.iris.dmc.ws.util.RespUtil; + +public class StationServiceTest { + + @Test + public void fetch() throws Exception { + + StationService service = ServiceUtil.getInstance().getStationService(); + List networks=service.fetch("https://fdsnws.raspberryshakedata.com/fdsnws/station/1/query?format=text&level=channel"); + } +}