What is the right way to send a client certificate with every request made by the resttemplate in spring?
Here is example how to do this using RestTemplate and Apache HttpClient You should define your own RestTemplate with configured SSL context: @Bean public RestTemplate restTemplate(RestTemplateBuilder builder) throws Exception { char[] password = “password”.toCharArray(); SSLContext sslContext = SSLContextBuilder.create() .loadKeyMaterial(keyStore(“classpath:cert.jks”, password), password) .loadTrustMaterial(null, new TrustSelfSignedStrategy()).build(); HttpClient client = HttpClients.custom().setSSLContext(sslContext).build(); return builder .requestFactory(new HttpComponentsClientHttpRequestFactory(client)) .build(); } private … Read more