oscerd commented on code in PR #28051:
URL: https://github.com/apache/camel/pull/28051#discussion_r4306910885
##########
components/camel-elasticsearch-rest-client/src/main/java/org/apache/camel/component/elasticsearch/rest/client/ElasticsearchRestClientProducer.java:
##########
@@ -375,15 +377,17 @@ String extractSearch(JsonObject doc) {
* Creates Rest Client from information in the Endpoint
*/
private RestClient createClient() throws Exception {
- final RestClientBuilder builder = RestClient.builder(getHttpHosts());
+ final HttpHost[] httpHosts = getHttpHosts();
+ final RestClientBuilder builder = RestClient.builder(httpHosts);
+ // the credentials provider reads the nodes from the client, as the
sniffer can change them
+ final AtomicReference<RestClient> restClientRef = new
AtomicReference<>();
builder.setRequestConfigCallback(requestConfigBuilder ->
requestConfigBuilder
.setConnectTimeout(this.endpoint.getConnectionTimeout()).setSocketTimeout(this.endpoint.getSocketTimeout()));
- if (this.endpoint.getUser() != null && this.endpoint.getPassword() !=
null) {
- final CredentialsProvider credentialsProvider = new
BasicCredentialsProvider();
- credentialsProvider.setCredentials(AuthScope.ANY,
- new UsernamePasswordCredentials(this.endpoint.getUser(),
this.endpoint.getPassword()));
+ final CredentialsProvider credentialsProvider
Review Comment:
Agreed: this is pre-existing and out of scope here, and it only affects
camel-4.18.x.
- On main and camel-4.22.x, the HTTP client callback is installed
unconditionally, and `certificatePath` (or `sslContextParameters`) is applied
independently of the credentials. That has been the case since CAMEL-23444
(camel-elasticsearch) and CAMEL-23445 (camel-elasticsearch-rest-client), which
were not backported to 4.18.x.
- This port keeps the 4.18.x structure on purpose, so that it only changes
how the credentials are scoped.
- Applying `certificatePath` without credentials on 4.18.x can be a separate
fix if it is wanted.
_Claude Code on behalf of oscerd_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]