You should be able to approach it by adapting SSLContext AsyncHttpClient. The idea is to provide a client certificate to the base client. I assume you have pkcs12.
It seems that AsyncHttpClientConfig cannot be updated as it is automatically initialized. Therefore, a new customer must be created and used.
The following should send the request as indicated in the SSLContext containing the pkcs12 file.
KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory .getDefaultAlgorithm()); KeyStore clientCert = KeyStore.getInstance("pkcs12"); InputStream is = new FileInputStream("/conf/brazo.p12"); clientCert.load(is, "brazo".toCharArray()); kmf.init(clientCert, "brazo".toCharArray()); SSLContext sc = SSLContext.getInstance("TLSv1"); sc.init(kmf.getKeyManagers(), null, new SecureRandom()); AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setSSLContext(sc).build(); AsyncHttpClient client = new AsyncHttpClient(config); String url = "https://your-url"; Request req = new RequestBuilder().setUrl(url).setMethod("GET").build(); client.executeRequest(req);
Unfortunately, this is moving away from Play! WS standard library.
brazo source share