![JAR search and dependency download from the Maven repository](/logo.png)
com.deliveredtechnologies.terraform.helpers.HttpsTrustManager.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tf-test-groovy Show documentation
Show all versions of tf-test-groovy Show documentation
Terraform Build Tools: The parent POM project for Java and Terraform Tools
package com.deliveredtechnologies.terraform.helpers
import javax.net.ssl.HttpsURLConnection
import javax.net.ssl.SSLContext
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
import java.security.SecureRandom
import java.security.cert.CertificateException
import java.security.cert.X509Certificate
class HttpsTrustManager implements X509TrustManager {
private static TrustManager[] trustManagers = new TrustManager[]{new HttpsTrustManager()}
@Override
void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0]
}
public static void allowAllSSL() {
HttpsURLConnection.setDefaultHostnameVerifier({arg0, argr1 -> true})
HttpsURLConnection.setDefaultSSLSocketFactory(SSLContext.getInstance("TLS").init(null, trustManagers, new SecureRandom()))
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy