Forum Discussion
Michael_Baker
4 years agoNeophyte
def nullTrustManager = [
checkClientTrusted: { chain, authType -> },
checkServerTrusted: { chain, authType -> },
getAcceptedIssuers: { null }
]
def nullHostnameVerifier = [
verify: { hostname, session ->
hostname.startsWith('ignore.this')
}
]
javax.net.ssl.SSLContext sc = javax.net.ssl.SSLContext.getInstance("SSL")
sc.init(null, [nullTrustManager as javax.net.ssl.X509TrustManager] as javax.net.ssl.X509TrustManager[], null)
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory())
javax.net.ssl.HttpsURLConnection.setDefaultHostnameVerifier(nullHostnameVerifier as javax.net.ssl.HostnameVerifier)
def doRequest(urlPath, token) {
def conn = "https://....".toURL().openConnection()
return conn
}
This will do it... my Groovy foo is not strong but I have this working using the above
Related Content
- 10 months ago
- 2 years ago