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

   Fixes CAMEL-27395.
   
   A cxf endpoint with a WS-Security UsernameToken (`wsSecurityUsername` and 
`wsSecurityPassword`, on a consumer or a producer) needs 
`org.apache.cxf:cxf-rt-ws-security` of the CXF version that Camel uses, which 
`camel-cxf-soap` does not bring. With `camel run` the user had to add it by 
hand (`--dep=mvn:org.apache.cxf:cxf-rt-ws-security:4.2.4`), and the 
`soap-source` / `soap-action` Kamelets tell users to do so.
   
   ## Changes
   
   - `DependencyDownloaderCxf` (camel-kamelet-main, from CAMEL-27389/27391) 
also looks at every endpoint of a route that is added: the input and the 
outputs, so consumers and producers, and routes of a template or Kamelet. When 
a `cxf:` endpoint sets `wsSecurityUsername`, `wsSecurityPassword`, 
`wsSecurityCallbackHandler` or `wsSecurityCredentials` (the options of 
`CxfEndpoint#isWsSecurityUsernameTokenEnabled`) to a value that is not empty, 
it downloads `org.apache.cxf:cxf-rt-ws-security:${cxf-version}` once. The 
download is a dependency of the integration, so `camel export` adds it.
   - The placeholders of the uri are resolved first, with the parameters of the 
route template as local properties (the previous local properties are 
restored). The Kamelets always have 
`wsSecurityUsername=RAW({{?wsSecurityUsername}})` in their uri, and only get 
the jar when the parameter is set. `wsSecurityPasswordType` alone does not 
count.
   - Quarkus export: `org.apache.cxf:cxf-rt-ws-security` becomes 
`io.quarkiverse.cxf:quarkus-cxf-rt-ws-security`, with its version from the 
Quarkus Platform BOM (`quarkus-dependencies.properties`). Main and Spring Boot 
keep the CXF artifact and version.
   - cxf docs: the Camel CLI adds the dependency, and with SOAP 1.1 a refused 
UsernameToken gives a SOAP fault with the code `SecurityError`, whatever the 
reason (no token, unknown user, wrong password, another password type). Catalog 
copy updated.
   
   Not covered: the options of a `cxf:bean:` endpoint that are set on the bean 
rather than in the uri.
   
   ## Tests
   
   - `DependencyDownloaderCxfTest`: a producer and a consumer with a 
UsernameToken, options that do not turn one on (empty value, 
`wsSecurityPasswordType` only, not a cxf endpoint), a Kamelet-style template 
with optional parameters (not set, then set, and no local properties left 
behind), and a value from a property placeholder. 10 tests pass.
   - `ProjectExporterTest#cxfWithAUsernameTokenHasWsSecurity` for main, 
spring-boot and quarkus. The 7 cxf export tests pass.
   - `CxfWsSecurityUsernameTokenTest` now checks the `SecurityError` fault code 
in each rejection test (19 tests pass).
   - End to end with the launcher of this branch: `camel run` of a cxf consumer 
that requires a UsernameToken, and a cxf producer that sends one, with no 
`--dep`. The call is authenticated. `camel export` writes 
`org.apache.cxf:cxf-rt-ws-security:4.2.4` (camel-main) and 
`io.quarkiverse.cxf:quarkus-cxf-rt-ws-security` without a version (quarkus).
   
   _Claude Code on behalf of Claus Ibsen_
   
   🤖 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to