in src/main/java/org/apache/pulsar/manager/zuul/HttpsClientConfiguration.java [49:83]
public CloseableHttpClient httpClient() throws Exception {
LaxRedirectStrategy customLaxRedirectStrategy = new LaxRedirectStrategy() {
@Override
protected boolean isRedirectable(final String method) {
return true;
}
};
if (tlsEnabled) {
Resource resource = new FileSystemResource(tlsKeystore);
File trustStoreFile = resource.getFile();
SSLContext sslcontext = SSLContexts.custom()
.loadTrustMaterial(trustStoreFile, tlsKeystorePassword.toCharArray(),
new TrustSelfSignedStrategy())
.build();
HostnameVerifier hostnameVerifier = (s, sslSession) -> {
// Custom logic to verify host name, tlsHostnameVerifier is false for test
if (!tlsHostnameVerifier) {
return true;
} else {
HostnameVerifier hv= HttpsURLConnection.getDefaultHostnameVerifier();
return hv.verify(s, sslSession);
}
};
SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(
sslcontext,
hostnameVerifier);
return HttpClients.custom()
.setRedirectStrategy(customLaxRedirectStrategy)
.setSSLSocketFactory(sslsf)
.build();
}
return HttpClients.custom().setRedirectStrategy(customLaxRedirectStrategy).build();
}