You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "oscerd (via GitHub)" <gi...@apache.org> on 2026/10/16 12:12:59 UTC

[PR] CAMEL-25706: camel-elasticsearch - bind the basic authentication credentials to the cluster nodes [camel]

oscerd opened a new pull request, #27946:
URL: https://github.com/apache/camel/pull/27946

   ## Description
   
   [CAMEL-25706](https://issues.apache.org/jira/browse/CAMEL-25706): `ElasticsearchProducer.createClient()` registered the configured `user` and `password` with `AuthScope.ANY`, which matches any host.
   
   - The credentials are now held by a `NodeScopedCredentialsProvider`, which offers them only to the nodes the client talks to: the hosts of `hostAddresses` and, when `enableSniffer` is set, the nodes the sniffer finds.
   - A node matches on scheme, host name (in any case) and port. A node without a port matches the default port of its scheme.
   - The provider reads the nodes from the `RestClient` (`getNodes()`) on each lookup, so it follows the nodes the sniffer adds or removes. Every configured node keeps receiving the credentials.
   - HttpClient 4's `BasicCredentialsProvider` matches an `AuthScope` on host and port only, never on the scheme. The provider therefore checks the origin of the scope that HttpClient looks the credentials up with, both preemptively and after a challenge.
   - `setCredentials` and `clear` do nothing, because the credentials come from the endpoint configuration only. HttpClient calls `setCredentials` for the user info of a request URI.
   - A client set with the `client` option is not changed.
   
   Upgrade guide (4.24): a request to another host is sent without the credentials. This includes the host of a node with another scheme or port.
   
   ## Tests
   
   - New `NodeScopedCredentialsProviderTest` (8 tests):
     - every node gets the credentials, and a node without a port uses the default port of its scheme;
     - the host name matches in any case;
     - another host, or another port or scheme of a node, gets none;
     - nodes added or removed later are followed;
     - a scope without an origin gets none;
     - credentials set afterwards are ignored.
   - New `ElasticsearchProducerCredentialsTest` (2 tests):
     - the provider that the producer builds from the endpoint configuration offers the credentials to the configured hosts only;
     - without credentials there is no provider.
     - With the producer change reverted to `AuthScope.ANY`, `offersTheConfiguredCredentialsOnlyToTheConfiguredHosts` fails on the host that is not a node.
   - The integration tests authenticate against a secured Elasticsearch container through the new provider: `ElasticsearchTestSupport` sets `user`, `password` and the CA certificate. Run locally against the Elasticsearch 9.1.0 test container (TLS and basic authentication), `ElasticsearchGetSearchDeleteExistsUpdateIT` and `ElasticsearchPingIT` pass: 37 tests.
   
   | Module | Tests |
   |---|---|
   | camel-elasticsearch | 19 unit tests |
   
   Full reactor `mvn clean install -DskipTests -DskipITs`: green, no generated-file changes. The `createCredentialsProvider` extraction came after that run. It touches no options or metadata, and was built and tested at module level.
   
   ## Backports
   
   To be backported to camel-4.22.x and camel-4.18.x after the merge.
   
   - camel-4.22.x: `ElasticsearchProducer` is identical to main there, so it is a straight cherry-pick, without the upgrade-guide hunk.
   - camel-4.18.x: `createClient()` is structured differently there (the credentials block wraps the HTTP client callback), so the change is a port.
   
   _Claude Code on behalf of oscerd_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25706: camel-elasticsearch - bind the basic authentication credentials to the cluster nodes [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27946:
URL: https://github.com/apache/camel/pull/27946


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25706: camel-elasticsearch - bind the basic authentication credentials to the cluster nodes [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27946:
URL: https://github.com/apache/camel/pull/27946#issuecomment-6215860204

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `components/camel-elasticsearch`
   - `docs`
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 8 of 706 tested, 26 compile-only — current: 8 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **8 affected modules** (current approach: 8).
   
   **Skip-tests mode would test 8 modules** (2 direct + 7 downstream), **skip tests for 26** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (8)</summary>
   
   - `camel-elasticsearch` ← components/camel-elasticsearch/src/main/java/org/apache/camel/component/es/ElasticsearchProducer.java, components/camel-elasticsearch/src/main/java/org/apache/camel/component/es/NodeScopedCredentialsProvider.java, components/camel-elasticsearch/src/test/java/org/apache/camel/component/es/ElasticsearchProducerCredentialsTest.java, components/camel-elasticsearch/src/test/java/org/apache/camel/component/es/NodeScopedCredentialsProviderTest.java
   - `camel-jbang-mcp` ← downstream of org.apache.camel:camel-catalog
   - `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jbang-plugin-tui` ← downstream of org.apache.camel:camel-catalog
   - `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-yaml-dsl-validator
   - `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
   - `camel-yaml-dsl-validator` ← downstream of org.apache.camel:camel-catalog
   - `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
   
   </details>
   
   <details><summary>Modules with tests skipped (26)</summary>
   
   - `apache-camel`
   - `camel-allcomponents`
   - `camel-catalog`
   - `camel-catalog-console`
   - `camel-catalog-maven`
   - `camel-catalog-suggest`
   - `camel-componentdsl`
   - `camel-endpointdsl`
   - `camel-endpointdsl-support`
   - `camel-itest`
   - `camel-jbang-core`
   - `camel-jbang-it`
   - `camel-jbang-main`
   - `camel-jbang-plugin-edit`
   - `camel-jbang-plugin-generate`
   - `camel-jbang-plugin-kubernetes`
   - `camel-jbang-plugin-test`
   - `camel-kamelet-main`
   - `camel-launcher`
   - `camel-report-maven-plugin`
   - `camel-route-parser`
   - `camel-yaml-dsl`
   - `camel-yaml-dsl-deserializers`
   - `camel-yaml-dsl-maven-plugin`
   - `coverage`
   - `dummy-component`
   
   </details>
   
   > :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
   
   </details>
   
   <details><summary>All tested modules (35 modules, 5m 17s total)</summary>
   
   **Total reactor time:** 5m 17s
   
   | Module | Duration | Status |
   | --- | --- | --- |
   | Camel :: Launcher | 53.4s | SUCCESS |
   | Camel :: JBang :: MCP | 43.4s | SUCCESS |
   | Camel :: JBang :: Plugin :: Validate | 34.7s | SUCCESS |
   | Camel :: Component DSL | 23.4s | SUCCESS |
   | Camel :: Catalog :: Camel Catalog | 22.9s | SUCCESS |
   | Camel :: YAML DSL | 19.3s | SUCCESS |
   | Camel :: YAML DSL :: Validator | 18.6s | SUCCESS |
   | Camel :: Docs | 15.0s | SUCCESS |
   | Camel :: Kamelet Main | 12.5s | SUCCESS |
   | Camel :: JBang :: Plugin :: Kubernetes | 11.9s | SUCCESS |
   | Camel :: JBang :: Plugin :: Testing | 9.4s | SUCCESS |
   | Camel :: YAML DSL :: Deserializers | 8.6s | SUCCESS |
   | Camel :: Catalog :: Camel Route Parser | 7.9s | SUCCESS |
   | Camel :: Catalog :: Camel Report Maven Plugin | 6.2s | SUCCESS |
   | Camel :: All Components Sync point | 5.4s | SUCCESS |
   | Camel :: YAML DSL :: Validator Maven Plugin | 4.2s | SUCCESS |
   | Camel :: YAML DSL :: Maven Plugins | 3.1s | SUCCESS |
   | Camel :: Catalog :: Suggest (deprecated) | 2.8s | SUCCESS |
   | Camel :: Catalog :: Maven | 2.6s | SUCCESS |
   | Camel :: JBang :: Plugin :: Edit | 1.8s | SUCCESS |
   | Camel :: Assembly | 1.5s | SUCCESS |
   | Camel :: JBang :: Plugin :: Generate | 1.2s | SUCCESS |
   | Camel :: Coverage | 1.1s | SUCCESS |
   | Camel :: Catalog :: Dummy Component | 1.0s | SUCCESS |
   | Camel :: Catalog :: Console | 1.0s | SUCCESS |
   | Camel :: JBang :: Integration tests | 0.9s | SUCCESS |
   | Camel :: JBang :: Main | 0.8s | SUCCESS |
   | Camel :: Endpoint DSL :: Support | 0.8s | SUCCESS |
   | Camel :: Launcher :: Container | 0.8s | SUCCESS |
   | Camel :: JBang :: Plugin :: MCP | 0.5s | SUCCESS |
   | Camel :: Elasticsearch Java API Client | n/a |  |
   | Camel :: Endpoint DSL | n/a |  |
   | Camel :: Integration Tests | n/a |  |
   | Camel :: JBang :: Core | n/a |  |
   | Camel :: JBang :: Plugin :: TUI | n/a |  |
   
   **Top 20 slowest modules:**
   - `Camel :: Launcher` (53.4s)
   - `Camel :: JBang :: MCP` (43.4s)
   - `Camel :: JBang :: Plugin :: Validate` (34.7s)
   - `Camel :: Component DSL` (23.4s)
   - `Camel :: Catalog :: Camel Catalog` (22.9s)
   - `Camel :: YAML DSL` (19.3s)
   - `Camel :: YAML DSL :: Validator` (18.6s)
   - `Camel :: Docs` (15.0s)
   - `Camel :: Kamelet Main` (12.5s)
   - `Camel :: JBang :: Plugin :: Kubernetes` (11.9s)
   - `Camel :: JBang :: Plugin :: Testing` (9.4s)
   - `Camel :: YAML DSL :: Deserializers` (8.6s)
   - `Camel :: Catalog :: Camel Route Parser` (7.9s)
   - `Camel :: Catalog :: Camel Report Maven Plugin` (6.2s)
   - `Camel :: All Components Sync point` (5.4s)
   - `Camel :: YAML DSL :: Validator Maven Plugin` (4.2s)
   - `Camel :: YAML DSL :: Maven Plugins` (3.1s)
   - `Camel :: Catalog :: Suggest (deprecated)` (2.8s)
   - `Camel :: Catalog :: Maven` (2.6s)
   - `Camel :: JBang :: Plugin :: Edit` (1.8s)
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/38898974275)


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-25706: camel-elasticsearch - bind the basic authentication credentials to the cluster nodes [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27946:
URL: https://github.com/apache/camel/pull/27946#issuecomment-6215263083

   :star2: Thank you for your contribution to the Apache Camel project! :star2:
     :robot: CI automation will test this PR automatically.
   
     :camel: Apache Camel Committers, please review the following items:
   
     * First-time contributors **require MANUAL approval** for the GitHub Actions to run
     * You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
     * You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
     * Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
     
     :warning: Be careful when sharing logs. Review their contents before sharing them publicly.


-- 
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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org