Last active
July 19, 2020 11:04
-
-
Save krnbr/51e613477b447274a0c9db4f971b6999 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pass the base 64 encoded String of the Keystore and keystore password | |
KeyManagerFactory keyManagerFactory = SSLContextHelper.getKeyStore(encodedKeystoreString, keystorePassword); | |
// pass the base 64 encoded String of the Truststore and truststore password | |
TrustManagerFactory trustManagerFactory = SSLContextHelper.getTrustStore(encodedTruststoreString, truststorePassword); | |
// Construct the SslContext using keyManagerFactory & trustManagerFactory | |
SslContext sslContext = SSLContextHelper.sslContext(keyManagerFactory, trustManagerFactory); | |
HttpClient resourceServerHttpClient = HttpClient.create() | |
.tcpConfiguration(client -> client.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000)) | |
.secure(sslContextSpec -> { | |
sslContextSpec.sslContext(sslContext); | |
}); | |
ClientHttpConnector customHttpConnector = new ReactorClientHttpConnector(resourceServerHttpClient); | |
return WebClient.builder() | |
// base path of the client, this way we need to set the complete url again | |
.baseUrl(testClientBaseUrl) | |
.clientConnector(customHttpConnector) | |
.filter(oauth) | |
.filter(logRequest()) | |
.filter(logResponse()) | |
.build(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment