Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update tls params for simulator #1426

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,46 +99,32 @@ private WebClient configureInsecureWebClient(final String baseAddress) {
final ClientConfiguration config = WebClient.getConfig(client);
final HTTPConduit conduit = config.getHttpConduit();

conduit.setTlsClientParameters(new TLSClientParameters());
/*
* Client for simulator in use with test code only! For now don't check
* or verify any certificates here.
*/
conduit
.getTlsClientParameters()
.setTrustManagers(
new TrustManager[] {
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}

@SuppressWarnings(
"squid:S4830") // no server certification validation specifically for testing
// purposes
@Override
public void checkServerTrusted(final X509Certificate[] chain, final String authType)
throws CertificateException {
/*
* Implicitly trust the certificate chain by not throwing a
* CertificateException.
*/
}

@SuppressWarnings(
"squid:S4830") // no server certification validation specifically for testing
// purposes
@Override
public void checkClientTrusted(final X509Certificate[] chain, final String authType)
throws CertificateException {
/*
* Implicitly trust the certificate chain by not throwing a
* CertificateException.
*/
}
}
});
final TLSClientParameters tlsParams = new TLSClientParameters();
tlsParams.setTrustManagers(
new TrustManager[] {
new X509TrustManager() {
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}

@Override
public void checkServerTrusted(final X509Certificate[] chain, final String authType)
throws CertificateException {
// Implicitly trust the certificate chain by not throwing a CertificateException.
}

@Override
public void checkClientTrusted(final X509Certificate[] chain, final String authType)
throws CertificateException {
// Implicitly trust the certificate chain by not throwing a CertificateException.
}
}
});

tlsParams.setSecureSocketProtocol("TLSv1.2");

conduit.setTlsClientParameters(tlsParams);

return client;
}
Expand Down
Loading