[
https://issues.apache.org/jira/browse/BEAM-14000?focusedWorklogId=753840&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-753840
]
ASF GitHub Bot logged work on BEAM-14000:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 07/Apr/22 04:47
Start Date: 07/Apr/22 04:47
Worklog Time Spent: 10m
Work Description: nishantjain91 commented on code in PR #17297:
URL: https://github.com/apache/beam/pull/17297#discussion_r844660303
##########
sdks/java/io/elasticsearch/src/main/java/org/apache/beam/sdk/io/elasticsearch/ElasticsearchIO.java:
##########
@@ -637,13 +638,16 @@ RestClient createClient() throws IOException {
final SSLContext sslContext =
SSLContexts.custom().loadTrustMaterial(keyStore,
trustStrategy).build();
final SSLIOSessionStrategy sessionStrategy = new
SSLIOSessionStrategy(sslContext);
- restClientBuilder.setHttpClientConfigCallback(
- httpClientBuilder ->
-
httpClientBuilder.setSSLContext(sslContext).setSSLStrategy(sessionStrategy));
+
httpAsyncClientBuilder.setSSLContext(sslContext).setSSLStrategy(sessionStrategy);
} catch (Exception e) {
throw new IOException("Can't load the client certificate from the
keystore", e);
}
}
+
+ if (getUsername() != null || (getKeystorePath() != null &&
!getKeystorePath().isEmpty())) {
+ restClientBuilder.setHttpClientConfigCallback(httpClientBuilder ->
httpAsyncClientBuilder);
Review Comment:
Made the changes requireed for this.
Issue Time Tracking
-------------------
Worklog Id: (was: 753840)
Time Spent: 1h (was: 50m)
> Elastic search IO doesnot work when both username/password and keystore are
> used
> --------------------------------------------------------------------------------
>
> Key: BEAM-14000
> URL: https://issues.apache.org/jira/browse/BEAM-14000
> Project: Beam
> Issue Type: Bug
> Components: sdk-java-core
> Reporter: nishant jain
> Priority: P2
> Time Spent: 1h
> Remaining Estimate: 0h
>
> When using both username/password and ssl keystore, ElasticSearchIO doesnot
> Create correct restclient.
>
> Firstly, it sets HttpClientConfigCallback using httpAsyncClientBuilder if
> username and passowrd is used. Afterwards, it will replace
> HttpClientConfigCallback to httpClientBuilder is ssl store is used, hence
> losing the credentials provider
--
This message was sent by Atlassian Jira
(v8.20.1#820001)