# SSL authentification with Jest Client

**URL:** <https://discuss.elastic.co/t/ssl-authentification-with-jest-client/56895>\
**Category:** Elasticsearch\
**Created:** [August 1, 2016, 1:43pm UTC](https://discuss.elastic.co/t/ssl-authentification-with-jest-client/56895 "2016-08-01T13:43:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Meriem\_Rezgui](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@Meriem\_Rezgui](https://discuss.elastic.co/u/Meriem_Rezgui)\
**Post date:** [August 1, 2016, 1:43pm UTC](https://discuss.elastic.co/t/ssl-authentification-with-jest-client/56895/1 "2016-08-01T13:43:54Z")

</div>

hello

i connect to elasticsearch cluster using jest client and i want to ensure ssl authentification on 9205 port i found this:

```
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() {
		    public boolean isTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
		        return true;
		    }
		}).build();

		// skip hostname checks
		HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;

		SSLConnectionSocketFactory sslSocketFactory = new SSLConnectionSocketFactory(sslContext, hostnameVerifier);
		SchemeIOSessionStrategy httpsIOSessionStrategy = new SSLIOSessionStrategy(sslContext, hostnameVerifier);

		JestClientFactory factory = new JestClientFactory();
		factory.setHttpClientConfig(new HttpClientConfig.Builder("https://localhost:9200")
		                .defaultSchemeForDiscoveredNodes("https") // required, otherwise uses http
		                .sslSocketFactory(sslSocketFactory) // this only affects sync calls
		                .httpsIOSessionStrategy(httpsIOSessionStrategy) // this only affects async calls
		                .build());
		final JestClient jestClient_3 = factory.getObject();

```

But with eclipse i have errors saying that The constructor SSLContextBuilder() is deprecated.  
Did someone had the same problem ?  
thanks 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 10:31pm UTC](https://discuss.elastic.co/t/ssl-authentification-with-jest-client/56895/2 "2017-07-05T22:31:11Z")

</div>


