I have got two .cer
file from client now my goal is to hit client api using https rather than http using spring webclient . As I am new to spring webclient not getting clue what to do
I have imported both .cer in keystore using below command
keytool -import -file "C:\Users\ankur\Download\Entrust_Root_Certification_Authority-G2.cer" -keystore "C:\Program Files\Java\jre1.8.0_40\lib\security\cacerts" -storepass "changeit"
keytool -import -file "C:\Users\ankur\Download\certificate\Entrust_Certification_Authority-L1K.cer" -keystore "C:\Program Files\Java\jre1.8.0_40\lib\security\cacerts" -storepass "changeit
I have written below to code in order to hit the api programatically from webclient
@Bean
public WebClient createWebClient() throws SSLException {
SslContext sslContext = SslContextBuilder
.forClient()
.trustManager(InsecureTrustManagerFactory.INSTANCE)
.build();
HttpClient httpClient = HttpClient
.create()
.secure(sslContextSpec -> sslContextSpec.sslContext(sslContext));
ClientHttpConnector connector = new ReactorClientHttpConnector(httpClient);
return WebClient.builder()
.clientConnector(connector).build();
}
application.yml
rest:
endpoint:https://someexample.com/xyz
I have no idea what to do with .cer file where to store these .cer file do we need to include in resource folder of spring boot any example or link would be helpful thanks