You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "tmielke (via GitHub)" <gi...@apache.org> on 2026/08/28 13:40:20 UTC
[PR] CAMEL-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
tmielke opened a new pull request, #25876:
URL: https://github.com/apache/camel/pull/25876
# Description
The Maven plugin previously only supported Username-Password authentication,
hardcoding the grant type in the codegen layer. With Salesforce retiring the
USERNAME_PASSWORD grant type in Winter '27 (February 2027), this adds support
for JWT and Client Credentials flows.
Changes:
- Add authenticationType parameter to explicitly select the auth type
- Refactor codegen login config to use no-arg constructor + setters, enabling auto-detection from provided credentials
- Make userName optional (not needed for Client Credentials)
- Add Mojo-level validation for ambiguous credential combinations
- Add manual integration tests for all three authentication types
- Refactor AbstractSalesforceMojoTest into a utility class holding only static setup helpers; move login tests into CamelSalesforceLoginManualIT to separate test infrastructure from test logic
- Update README.md with per-auth-type requirements and examples
- Add upgrade guide entry
Note: without the ambiguity validation, omitting the password while providing
clientSecret and userName would silently auto-detect Client Credentials instead
of failing for Username-Password. The Mojo now rejects this combination early
with an actionable error message.
# Target
- [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch)
# Tracking
- [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it).
# Apache Camel coding standards and style
- [x] I checked that each commit in the pull request has a meaningful subject line and body.
- [x] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes.
# AI-assisted contributions
- [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used.
--
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-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #25876:
URL: https://github.com/apache/camel/pull/25876#issuecomment-5453811312
_AI-generated review comment by Codex on behalf of @Croway._
I found two issues with the authentication contract.
**P1 — the new ambiguity guard prevents the exact CAMEL-24495 auto-detection case.** With `clientId`, `clientSecret`, `userName`, and no password, `SalesforceLoginConfig` selects `CLIENT_CREDENTIALS`, but the Mojo rejects the same inputs before creating the login configuration. This credential-free test reproduces the mismatch:
```java
@Test
void mojoRejectsCredentialsThatSalesforceLoginConfigAutoDetects() {
SalesforceLoginConfig loginConfig = new SalesforceLoginConfig();
loginConfig.setClientId("client-id");
loginConfig.setClientSecret("client-secret");
loginConfig.setUserName("user@example.com");
assertThat(loginConfig.getType()).isEqualTo(AuthenticationType.CLIENT_CREDENTIALS);
AbstractSalesforceMojo mojo = new AbstractSalesforceMojo() {
@Override
protected AbstractSalesforceExecution getSalesforceExecution() {
throw new AssertionError("Validation should fail before an execution is created");
}
};
mojo.clientId = "client-id";
mojo.clientSecret = "client-secret";
mojo.userName = "user@example.com";
mojo.password = null;
assertThatThrownBy(mojo::execute)
.isInstanceOf(MojoExecutionException.class)
.hasMessageContaining("Ambiguous authentication configuration");
}
```
I ran this against `2c23ecc27831`; it passes and confirms the divergence without contacting Salesforce.
The minimal fix is to remove the `authenticationType == null && clientSecret != null && userName != null && password == null` rejection and let `SalesforceLoginConfig.getType()` remain the single source of truth. `userName` is not an authentication selector for Client Credentials; password presence selects Username-Password, while its absence selects Client Credentials. A small automated regression test should then assert that Mojo validation accepts this combination (making `validateAuthenticationParameters()` package-private would allow that without initiating a login).
**P2 — `REFRESH_TOKEN` is advertised but cannot work.** The generated Maven parameter help lists `REFRESH_TOKEN` as supported, but the Mojo has no `refreshToken` parameter and its validation only permits `clientSecret` or `keystoreResource`. Please either implement that flow or remove it from the supported-values description; the README currently correctly claims only the three actually supported flows.
--
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-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #25876:
URL: https://github.com/apache/camel/pull/25876#issuecomment-5453526813
: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
Re: [PR] CAMEL-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #25876:
URL: https://github.com/apache/camel/pull/25876#issuecomment-5453896961
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `components/camel-salesforce/camel-salesforce-codegen`
- `components/camel-salesforce/camel-salesforce-maven-plugin`
- `docs`
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 11 tested, 26 compile-only — current: 10 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **37 affected modules** (current approach: 10).
<details><summary>:warning: Modules only in Scalpel (27)</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`
- `docs`
- `dummy-component`
</details>
**Skip-tests mode would test 11 modules** (3 direct + 8 downstream), **skip tests for 26** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (11)</summary>
- `camel-jbang-mcp`
- `camel-jbang-plugin-mcp`
- `camel-jbang-plugin-route-parser`
- `camel-jbang-plugin-tui`
- `camel-jbang-plugin-validate`
- `camel-launcher-container`
- `camel-salesforce-codegen`
- `camel-salesforce-maven-plugin`
- `camel-yaml-dsl-validator`
- `camel-yaml-dsl-validator-maven-plugin`
- `docs`
</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 (37 modules)</summary>
- Camel :: All Components Sync point
- Camel :: Assembly
- Camel :: Catalog :: Camel Catalog
- Camel :: Catalog :: Camel Report Maven Plugin
- Camel :: Catalog :: Camel Route Parser
- Camel :: Catalog :: Console
- Camel :: Catalog :: Dummy Component
- Camel :: Catalog :: Maven
- Camel :: Catalog :: Suggest
- Camel :: Component DSL
- Camel :: Coverage
- Camel :: Docs
- Camel :: Endpoint DSL
- Camel :: Endpoint DSL :: Support
- Camel :: Integration Tests
- Camel :: JBang :: Core
- Camel :: JBang :: Integration tests
- Camel :: JBang :: MCP
- Camel :: JBang :: Main
- Camel :: JBang :: Plugin :: Edit
- Camel :: JBang :: Plugin :: Generate
- Camel :: JBang :: Plugin :: Kubernetes
- Camel :: JBang :: Plugin :: MCP
- Camel :: JBang :: Plugin :: Route Parser
- Camel :: JBang :: Plugin :: TUI
- Camel :: JBang :: Plugin :: Testing
- Camel :: JBang :: Plugin :: Validate
- Camel :: Kamelet Main
- Camel :: Launcher
- Camel :: Launcher :: Container
- Camel :: Salesforce :: CodeGen
- Camel :: Salesforce :: Maven Plugin
- Camel :: YAML DSL
- Camel :: YAML DSL :: Deserializers
- Camel :: YAML DSL :: Maven Plugins
- Camel :: YAML DSL :: Validator
- Camel :: YAML DSL :: Validator Maven Plugin
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/33176464928)
--
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-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #25876:
URL: https://github.com/apache/camel/pull/25876#issuecomment-5454119645
The test failures are unrelated
<!DOCTYPE html>
Failed Test | Duration | Failure Type
-- | -- | --
org.apache.camel.itest.tx.JmsToHttpTXWithRollbackTest.testSendToTXJmsWithRollback | 19.93s | ERROR
org.apache.camel.itest.greeter.JmsToCxfInOutTest.testJmsToCxfInOut | 19.92s | ERROR
org.apache.camel.itest.tx.JmsToHttpTXWithOnExceptionAndNoTransactionErrorHandlerConfiguredTest.testOK | 19.92s | ERROR
org.apache.camel.itest.tx.JmsToHttpTXWithOnExceptionAndNoTransactionErrorHandlerConfiguredTest.testRollback | 19.92s | FAILURE
org.apache.camel.itest.tx.JmsToHttpTXWithOnExceptionAndNoTransactionErrorHandlerConfiguredTest.test404 | 19.92s | ERROR
org.apache.camel.itest.greeter.CxfToJmsInOutTest.testCxfToJmsInOut | 19.94s | ERROR
org.apache.camel.itest.jms.JmsHttpPostIssueWithMockTest.testJmsInOutHttpPostIssue | 20.03s | ERROR
org.apache.camel.itest.customerrelations.CustomerServicesTest.testCustomerService | 21.15s | ERROR
org.apache.camel.itest.jms.JmsHttpJmsTest.testResultReplyJms | 20.02s | FAILURE
org.apache.camel.itest.jetty.JettyJmsShutdownTest.testShutdown | 0.001s | ERROR
org.apache.camel.itest.tx.JmsToHttpTXTest.testSendToTXJms | 19.92s | ERROR
org.apache.camel.itest.jms.JmsHttpPostIssueTest.testJmsInOutHttpPostIssue | 20.02s | ERROR
org.apache.camel.itest.tx.JmsToHttpTXWithOnExceptionTest.testOK | 19.92s | ERROR
org.apache.camel.itest.tx.JmsToHttpTXWithOnExceptionTest.test404 | 19.92s | ERROR
org.apache.camel.itest.tx.JmsToHttpTXWithOnExceptionTest.testRollback | 19.92s | FAILURE
org.apache.camel.itest.netty.NettyAsyncRequestReplyTest.testNetty | 3.016s | ERROR
org.apache.camel.itest.shiro.ShiroOverJmsTest.testShiroOverJms | 20.02s | FAILURE
--
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-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
Posted by "Croway (via GitHub)" <gi...@apache.org>.
Croway commented on PR #25876:
URL: https://github.com/apache/camel/pull/25876#issuecomment-5476483925
```
There are uncommitted changes
HEAD detached at pull/25876/merge
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-agent-component.adoc
modified: catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-embeddings-component.adoc
modified: catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/spring-ai-chat-component.adoc
no changes added to commit (use "git add" and/or "git commit -a")
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-agent-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-agent-component.adoc
index a331982d11df..e70651121988 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-agent-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-agent-component.adoc
@@ -1178,7 +1178,6 @@ You can also define the `ResponseFormat` at the `ChatModel` level. See the https
* The same schema file can be shared across `camel-openai` and `camel-langchain4j-agent` components
====
-[[structured_error_exchange_properties]]
=== Structured error exchange properties
When a LangChain4j agent call fails, Camel sets structured metadata on the exchange **before** the model exception propagates. This works even when GenAI observability is disabled.
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-embeddings-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-embeddings-component.adoc
index 387d9e382f24..7ea8ec94431c 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-embeddings-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/langchain4j-embeddings-component.adoc
@@ -395,7 +395,6 @@ YAML::
----
====
-[[structured_error_exchange_properties]]
=== Structured error exchange properties
When a LangChain4j embeddings call fails, Camel sets structured metadata on the exchange **before** the model exception propagates. This works even when GenAI observability is disabled.
diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/spring-ai-chat-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/spring-ai-chat-component.adoc
index c8d8c0a84040..2dea4dd89a09 100644
--- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/spring-ai-chat-component.adoc
+++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/spring-ai-chat-component.adoc
@@ -1407,7 +1407,6 @@ The component automatically adds Spring AI's `SimpleLoggerAdvisor` to log reques
logging.level.org.springframework.ai.chat.client.advisor=DEBUG
----
-[[structured_error_exchange_properties]]
=== Structured error exchange properties
When a Spring AI chat call fails, Camel sets structured metadata on the exchange **before** the Spring AI exception propagates. This works even when GenAI observability is disabled.
```
--
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-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #25876:
URL: https://github.com/apache/camel/pull/25876#discussion_r3882062864
##########
components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/AbstractSalesforceMojo.java:
##########
@@ -243,6 +244,15 @@ private void validateAuthenticationParameters() throws MojoExecutionException {
"Property 'keystorePassword' must be provided when property 'keystoreResource' was provided."); // NOSONAR
}
}
+
+ if (authenticationType == null && clientSecret != null && userName != null && password == null
Review Comment:
This is the headline new safety behavior described in the PR body, but it has no fast/unit test covering it. The three new tests in `CamelSalesforceLoginManualIT` need live Salesforce credentials and are excluded from normal `mvn test`/CI runs by the `ManualIT` naming convention, so they give no regression protection here.
`validateAuthenticationParameters()` runs before `setup()`/`execution.execute()` (see `execute()` above), so a plain JUnit test could construct a Mojo subclass, set `clientId`/`clientSecret`/`userName` with `password == null` and `keystoreResource == null`, call `execute()`, and assert a `MojoExecutionException` is thrown with this message — no network access needed. Worth adding, per the project's "every PR must include tests for new functionality or bug fixes" rule.
##########
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_23.adoc:
##########
@@ -459,6 +459,16 @@ Ordinary listings are unaffected, as a listed name is normally a single path seg
resolves back inside the polled directory remains accepted. Two configurations can newly see files skipped: a
server that reports names navigating above the polled directory, and a `fileName` expression (used when
`useList=false`) that navigates above it. Set `jailStartingDirectory=false` if such a path is intended.
+=== camel-salesforce
Review Comment:
Missing the blank line before the new heading that every other section boundary in this file has.
```suggestion
`useList=false`) that navigates above it. Set `jailStartingDirectory=false` if such a path is intended.
=== camel-salesforce
```
--
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-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
Posted by "tmielke (via GitHub)" <gi...@apache.org>.
tmielke commented on PR #25876:
URL: https://github.com/apache/camel/pull/25876#issuecomment-5454070980
Thanks for the review Federico.
About P1:
The full check is
```
if (authenticationType == null && clientSecret != null && userName != null && password == null
&& keystoreResource == null) {
```
and checks for ambiguous user configuration. If true, it returns a meaningful message back to the user.
This check was added to prevent users that may forget to supply the password (and like to use username-password authentication) to automatically switch the client credential auth type, which may not work either, if not configured / enabled for the user in Salesforce.
P2: Good catch, I forgot to remove it from `AbstractSalesforceMojo.java`. Let me do that and resubmit.
--
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-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #25876:
URL: https://github.com/apache/camel/pull/25876
--
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-24495: camel-salesforce-maven-plugin - support JWT and Client Credentials authentication [camel]
Posted by "tmielke (via GitHub)" <gi...@apache.org>.
tmielke commented on code in PR #25876:
URL: https://github.com/apache/camel/pull/25876#discussion_r3892648566
##########
components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/AbstractSalesforceMojo.java:
##########
@@ -243,6 +244,15 @@ private void validateAuthenticationParameters() throws MojoExecutionException {
"Property 'keystorePassword' must be provided when property 'keystoreResource' was provided."); // NOSONAR
}
}
+
+ if (authenticationType == null && clientSecret != null && userName != null && password == null
Review Comment:
I agree there is a need for a unit test that verifies the required authentication parameter. Let me add one.
--
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