This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new a4a4d6ed6eaa CAMEL-27373: camel-cxf - first-class WS-Security 
UsernameToken options (#30595)
a4a4d6ed6eaa is described below

commit a4a4d6ed6eaa557454e9bce052b28d67c728989e
Author: Claus Ibsen <[email protected]>
AuthorDate: Sun Nov 22 12:01:12 2026 +0100

    CAMEL-27373: camel-cxf - first-class WS-Security UsernameToken options 
(#30595)
    
    New endpoint options wsSecurityUsername, wsSecurityPassword,
    wsSecurityPasswordType (Text/Digest), wsSecurityCallbackHandler and
    wsSecurityCredentials (a map bean of users) set up a WS-Security
    UsernameToken for the producer and the consumer without Java code.
    
    A new WsSecurityUsernameTokenConfigurer in the chained configurer sets
    the CXF security properties, which a WS-SecurityPolicy in the WSDL uses,
    and adds a WSS4JOutInterceptor or WSS4JInInterceptor only when the WSDL
    has no WS-SecurityPolicy. CxfConsumer now applies the chained configurer,
    so the configurer also runs on the server side. RAW mode is rejected, and
    a missing cxf-rt-ws-security dependency gives a clear error.
    
    #bean: references in properties.* are already resolved on main; tests
    pin that, and the docs mention it.
    
    - camel-cxf - drop the YAML test (reactor cycle), copy the credentials map, 
document the password type with a policy
    The camel-yaml-dsl test dependency made a reactor cycle (camel-catalog ->
    camel-allcomponents -> camel-cxf-soap -> camel-yaml-dsl), so the YAML test 
is
    removed. CxfWsSecurityUsernameTokenTest now covers what it added: a map 
bean with
    a password that is not a String.
    
    The callback handler copies the wsSecurityCredentials map, as it is read by
    several requests at once and the bean may change. A test checks that a user
    added to the bean later is not accepted.
    
    The options table notes that wsSecurityPasswordType is not used when the 
WSDL
    has a WS-SecurityPolicy, and that the credentials map is copied at start.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../org/apache/camel/catalog/components/cxf.json   |  17 +-
 .../apache/camel/catalog/docs/cxf-component.adoc   |  76 ++++
 .../component/cxf/jaxws/CxfEndpointConfigurer.java |  32 ++
 .../component/cxf/jaxws/CxfEndpointUriFactory.java |  11 +-
 .../org/apache/camel/component/cxf/jaxws/cxf.json  |  17 +-
 .../src/main/docs/cxf-component.adoc               |  76 ++++
 .../camel/component/cxf/jaxws/CxfConsumer.java     |   6 +-
 .../camel/component/cxf/jaxws/CxfEndpoint.java     | 110 +++++-
 .../jaxws/WsSecurityUsernameTokenConfigurer.java   | 253 +++++++++++++
 .../cxf/jaxws/CxfWsSecurityUsernameTokenTest.java  | 343 +++++++++++++++++
 .../src/test/resources/wssec/orders-ut.wsdl        | 101 +++++
 .../src/test/resources/wssec/orders.wsdl           |  80 ++++
 .../endpoint/dsl/CxfEndpointBuilderFactory.java    | 417 +++++++++++++++++++++
 13 files changed, 1520 insertions(+), 19 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/cxf.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/cxf.json
index 466640e6e11f..f6bb97a377ce 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/cxf.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/cxf.json
@@ -81,11 +81,16 @@
     "skipFaultLogging": { "index": 30, "kind": "parameter", "displayName": 
"Skip Fault Logging", "group": "logging", "label": "logging", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Whether to skip the log entry that the PhaseInterceptorChain writes when an 
interceptor throws an exception, for example the exception of a failed exchange 
of the consumer. Sets the CXF property or [...]
     "password": { "index": 31, "kind": "parameter", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "description": "The password for HTTP 
Basic authentication. The producer puts it, together with the user name, in the 
protocol header Authorization of its HTTP requests. Only used when the username 
option is set. Not used f [...]
     "username": { "index": 32, "kind": "parameter", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "description": "The user name for HTTP 
Basic authentication. The producer puts it, together with the password, in the 
protocol header Authorization of its HTTP requests. Only used when the password 
option is set. Not used f [...]
-    "bindingId": { "index": 33, "kind": "parameter", "displayName": "Binding 
Id", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The id of the CXF binding, which is a 
namespace URI, for example http:\/\/cxf.apache.org\/bindings\/xformat for the 
XML binding without a SOAP envelope. If not set, CXF uses the binding of the 
wsdl:port. The id http:\/\/schemas [...]
-    "portName": { "index": 34, "kind": "parameter", "displayName": "Port 
Name", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The WSDL port, which is the name 
attribute of the wsdl:port element. Written as a QName in the form 
{namespaceURI}localPart, for example {http:\/\/example.org\/orders}OrderPort." 
},
-    "publishedEndpointUrl": { "index": 35, "kind": "parameter", "displayName": 
"Published Endpoint Url", "group": "service", "label": "service", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "The address to publish in 
the WSDL that the consumer serves at the service address followed by ?wsdl. It 
replaces the location of the address element in the wsdl:port. Use it when 
clients reach the servic [...]
-    "serviceClass": { "index": 36, "kind": "parameter", "displayName": 
"Service Class", "group": "service", "label": "service", "required": false, 
"type": "string", "javaType": "java.lang.Class<java.lang.Object>", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
Java class of the service, for example a service endpoint interface or a class 
that implements one. Written as a fully qualified class name, for example 
org.example.orders.OrderService. Required when  [...]
-    "serviceName": { "index": 37, "kind": "parameter", "displayName": "Service 
Name", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The WSDL service, which is the name 
attribute of the wsdl:service element. Written as a QName in the form 
{namespaceURI}localPart, for example 
{http:\/\/example.org\/orders}OrderService. If not set and wsdlURL points to a 
W [...]
-    "wsdlURL": { "index": 38, "kind": "parameter", "displayName": "Wsdl URL", 
"group": "service", "label": "service", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The location of the WSDL. Can be on the 
classpath, file system, or be hosted remotely." }
+    "wsSecurityCallbackHandler": { "index": 33, "kind": "parameter", 
"displayName": "WS-Security Callback Handler", "group": "security", "label": 
"security", "required": false, "type": "object", "javaType": 
"javax.security.auth.callback.CallbackHandler", "deprecated": false, 
"autowired": false, "secret": false, "description": "To use a custom 
javax.security.auth.callback.CallbackHandler for the WS-Security UsernameToken. 
CXF calls it with an org.apache.wss4j.common.ext.WSPasswordCallback [...]
+    "wsSecurityCredentials": { "index": 34, "kind": "parameter", 
"displayName": "WS-Security Credentials", "group": "security", "label": 
"security", "required": false, "type": "object", "javaType": 
"java.util.Map<java.lang.String, java.lang.String>", "deprecated": false, 
"autowired": false, "secret": false, "description": "A map of user name to 
password with the users that the consumer accepts in a WS-Security 
UsernameToken, as a reference to a java.util.Map bean, for example #bean:users 
[...]
+    "wsSecurityPassword": { "index": 35, "kind": "parameter", "displayName": 
"WS-Security Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "description": "The 
password of a WS-Security UsernameToken. The producer sends it in the 
UsernameToken, and the consumer requires it for the user of the 
wsSecurityUsername option." },
+    "wsSecurityPasswordType": { "index": 36, "kind": "parameter", 
"displayName": "WS-Security Password Type", "group": "security", "label": 
"security", "required": false, "type": "enum", "javaType": "java.lang.String", 
"enum": [ "Text", "Digest" ], "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "Text", "description": "The type of the 
password in a WS-Security UsernameToken: Text for PasswordText, or Digest for 
PasswordDigest. The producer sends this type, and t [...]
+    "wsSecurityUsername": { "index": 37, "kind": "parameter", "displayName": 
"WS-Security Username", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "description": "The 
user name of a WS-Security UsernameToken. The producer sends a UsernameToken 
with this user name in the SOAP header of its requests. The consumer accepts 
only this user, with the pa [...]
+    "bindingId": { "index": 38, "kind": "parameter", "displayName": "Binding 
Id", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The id of the CXF binding, which is a 
namespace URI, for example http:\/\/cxf.apache.org\/bindings\/xformat for the 
XML binding without a SOAP envelope. If not set, CXF uses the binding of the 
wsdl:port. The id http:\/\/schemas [...]
+    "portName": { "index": 39, "kind": "parameter", "displayName": "Port 
Name", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The WSDL port, which is the name 
attribute of the wsdl:port element. Written as a QName in the form 
{namespaceURI}localPart, for example {http:\/\/example.org\/orders}OrderPort." 
},
+    "publishedEndpointUrl": { "index": 40, "kind": "parameter", "displayName": 
"Published Endpoint Url", "group": "service", "label": "service", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "The address to publish in 
the WSDL that the consumer serves at the service address followed by ?wsdl. It 
replaces the location of the address element in the wsdl:port. Use it when 
clients reach the servic [...]
+    "serviceClass": { "index": 41, "kind": "parameter", "displayName": 
"Service Class", "group": "service", "label": "service", "required": false, 
"type": "string", "javaType": "java.lang.Class<java.lang.Object>", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
Java class of the service, for example a service endpoint interface or a class 
that implements one. Written as a fully qualified class name, for example 
org.example.orders.OrderService. Required when  [...]
+    "serviceName": { "index": 42, "kind": "parameter", "displayName": "Service 
Name", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The WSDL service, which is the name 
attribute of the wsdl:service element. Written as a QName in the form 
{namespaceURI}localPart, for example 
{http:\/\/example.org\/orders}OrderService. If not set and wsdlURL points to a 
W [...]
+    "wsdlURL": { "index": 43, "kind": "parameter", "displayName": "Wsdl URL", 
"group": "service", "label": "service", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The location of the WSDL. Can be on the 
classpath, file system, or be hosted remotely." }
   }
 }
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/cxf-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/cxf-component.adoc
index 84e1d51ac698..5ae5e472a57f 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/cxf-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/cxf-component.adoc
@@ -129,6 +129,82 @@ Using CXF with Spring Boot or Quarkus comes automatic 
integrated with the embedd
 
 See more details in the https://cxf.apache.org/docs/http-transport.html[CXF 
Transport] documentation.
 
+== WS-Security UsernameToken
+
+The `wsSecurity` options set up a WS-Security UsernameToken without Java code. 
The producer sends a UsernameToken in
+the SOAP header of its requests, and the consumer rejects a request without a 
valid UsernameToken with a SOAP fault.
+The options need the `org.apache.cxf:cxf-rt-ws-security` dependency, which 
`camel-cxf-soap` does not bring by itself.
+
+NOTE: The `username` and `password` options are for HTTP Basic authentication, 
not for WS-Security.
+
+[cols="1,2,2",options="header"]
+|===
+| Option | Producer | Consumer
+| `wsSecurityUsername` | The user name to send. | The one user that is 
accepted.
+| `wsSecurityPassword` | The password to send. | The password of that user.
+| `wsSecurityPasswordType` | `Text` (default) sends a PasswordText, `Digest` a 
PasswordDigest. Not used when the WSDL has a WS-SecurityPolicy. | The password 
type that is required. Not used when the WSDL has a WS-SecurityPolicy.
+| `wsSecurityCredentials` | Not used. | A `java.util.Map` bean of user name to 
password, to accept more than one user. The map is copied when the consumer 
starts: use `wsSecurityCallbackHandler` for users that change at runtime.
+| `wsSecurityCallbackHandler` | A `CallbackHandler` bean that sets the 
password, instead of `wsSecurityPassword`. | A `CallbackHandler` bean that 
looks up the password of any user, for example from a vault.
+|===
+
+When the WSDL of the service has a WS-SecurityPolicy, the policy decides how 
the UsernameToken is sent and checked,
+including the password type, and the options give the user name, the password 
and the callback handler to the policy.
+When the WSDL has no WS-SecurityPolicy, or there is no WSDL, the endpoint adds 
the CXF `WSS4JOutInterceptor` (producer)
+or `WSS4JInInterceptor` (consumer) for the UsernameToken.
+
+The consumer sets the authenticated user in the `CamelAuthentication` header, 
as a `javax.security.auth.Subject`.
+
+The options are not supported with `dataFormat=RAW`, as CXF does not process 
the SOAP envelope in this mode.
+
+WARNING: A UsernameToken with a plain text password must only be sent over 
HTTPS. `Digest` is no replacement for
+HTTPS: it uses SHA-1, and the consumer needs the plain password to check it.
+
+A consumer that accepts two users with a PasswordDigest:
+
+[source,yaml]
+----
+- beans:
+    - name: users
+      type: java.util.HashMap
+      properties:
+        alice: "{{alice.password}}"
+        bob: "{{bob.password}}"
+- route:
+    from:
+      uri: cxf://https://0.0.0.0:8443/orders
+      parameters:
+        wsdlURL: classpath:orders.wsdl
+        dataFormat: PAYLOAD
+        wsSecurityCredentials: "#bean:users"
+        wsSecurityPasswordType: Digest
+      steps:
+        - log: "Order request from ${header.CamelAuthentication}"
+----
+
+A producer that calls this service:
+
+[source,yaml]
+----
+- route:
+    from:
+      uri: direct:getOrder
+      steps:
+        - to:
+            uri: cxf://https://orders.example.com/orders
+            parameters:
+              wsdlURL: classpath:orders.wsdl
+              dataFormat: PAYLOAD
+              defaultOperationName: getOrder
+              wsSecurityUsername: alice
+              wsSecurityPassword: "{{alice.password}}"
+              wsSecurityPasswordType: Digest
+----
+
+Other WS-Security features, such as a Timestamp, a signature or encryption, 
are set up with the CXF properties in
+`properties.*`, or with CXF interceptors or a `cxfConfigurer` in Java code. A 
value of `properties.*` that is a
+`#bean:name` reference is resolved from the registry, for example
+`properties.security.callback-handler=#bean:myCallbackHandler`. A plain 
`#name` is not resolved.
+
 == Usage
 
 === RAW Mode
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/generated/java/org/apache/camel/component/cxf/jaxws/CxfEndpointConfigurer.java
 
b/components/camel-cxf/camel-cxf-soap/src/generated/java/org/apache/camel/component/cxf/jaxws/CxfEndpointConfigurer.java
index 4bac1c85b440..069bf587d39d 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/generated/java/org/apache/camel/component/cxf/jaxws/CxfEndpointConfigurer.java
+++ 
b/components/camel-cxf/camel-cxf-soap/src/generated/java/org/apache/camel/component/cxf/jaxws/CxfEndpointConfigurer.java
@@ -90,6 +90,16 @@ public class CxfEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "wrapped": target.setWrapped(property(camelContext, 
boolean.class, value)); return true;
         case "wrappedstyle":
         case "wrappedStyle": target.setWrappedStyle(property(camelContext, 
java.lang.Boolean.class, value)); return true;
+        case "wssecuritycallbackhandler":
+        case "wsSecurityCallbackHandler": 
target.setWsSecurityCallbackHandler(property(camelContext, 
javax.security.auth.callback.CallbackHandler.class, value)); return true;
+        case "wssecuritycredentials":
+        case "wsSecurityCredentials": 
target.setWsSecurityCredentials(property(camelContext, java.util.Map.class, 
value)); return true;
+        case "wssecuritypassword":
+        case "wsSecurityPassword": 
target.setWsSecurityPassword(property(camelContext, java.lang.String.class, 
value)); return true;
+        case "wssecuritypasswordtype":
+        case "wsSecurityPasswordType": 
target.setWsSecurityPasswordType(property(camelContext, java.lang.String.class, 
value)); return true;
+        case "wssecurityusername":
+        case "wsSecurityUsername": 
target.setWsSecurityUsername(property(camelContext, java.lang.String.class, 
value)); return true;
         case "wsdlurl":
         case "wsdlURL": target.setWsdlURL(property(camelContext, 
java.lang.String.class, value)); return true;
         default: return false;
@@ -165,6 +175,16 @@ public class CxfEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "wrapped": return boolean.class;
         case "wrappedstyle":
         case "wrappedStyle": return java.lang.Boolean.class;
+        case "wssecuritycallbackhandler":
+        case "wsSecurityCallbackHandler": return 
javax.security.auth.callback.CallbackHandler.class;
+        case "wssecuritycredentials":
+        case "wsSecurityCredentials": return java.util.Map.class;
+        case "wssecuritypassword":
+        case "wsSecurityPassword": return java.lang.String.class;
+        case "wssecuritypasswordtype":
+        case "wsSecurityPasswordType": return java.lang.String.class;
+        case "wssecurityusername":
+        case "wsSecurityUsername": return java.lang.String.class;
         case "wsdlurl":
         case "wsdlURL": return java.lang.String.class;
         default: return null;
@@ -241,6 +261,16 @@ public class CxfEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "wrapped": return target.isWrapped();
         case "wrappedstyle":
         case "wrappedStyle": return target.getWrappedStyle();
+        case "wssecuritycallbackhandler":
+        case "wsSecurityCallbackHandler": return 
target.getWsSecurityCallbackHandler();
+        case "wssecuritycredentials":
+        case "wsSecurityCredentials": return target.getWsSecurityCredentials();
+        case "wssecuritypassword":
+        case "wsSecurityPassword": return target.getWsSecurityPassword();
+        case "wssecuritypasswordtype":
+        case "wsSecurityPasswordType": return 
target.getWsSecurityPasswordType();
+        case "wssecurityusername":
+        case "wsSecurityUsername": return target.getWsSecurityUsername();
         case "wsdlurl":
         case "wsdlURL": return target.getWsdlURL();
         default: return null;
@@ -253,6 +283,8 @@ public class CxfEndpointConfigurer extends 
PropertyConfigurerSupport implements
         case "properties": return java.lang.Object.class;
         case "serviceclass":
         case "serviceClass": return java.lang.Object.class;
+        case "wssecuritycredentials":
+        case "wsSecurityCredentials": return java.lang.String.class;
         default: return null;
         }
     }
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/generated/java/org/apache/camel/component/cxf/jaxws/CxfEndpointUriFactory.java
 
b/components/camel-cxf/camel-cxf-soap/src/generated/java/org/apache/camel/component/cxf/jaxws/CxfEndpointUriFactory.java
index 5fc4c2799284..44af904133af 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/generated/java/org/apache/camel/component/cxf/jaxws/CxfEndpointUriFactory.java
+++ 
b/components/camel-cxf/camel-cxf-soap/src/generated/java/org/apache/camel/component/cxf/jaxws/CxfEndpointUriFactory.java
@@ -24,7 +24,7 @@ public class CxfEndpointUriFactory extends 
org.apache.camel.support.component.En
     private static final Set<String> ENDPOINT_IDENTITY_PROPERTY_NAMES;
     private static final Map<String, String> MULTI_VALUE_PREFIXES;
     static {
-        Set<String> props = new HashSet<>(39);
+        Set<String> props = new HashSet<>(44);
         props.add("address");
         props.add("allowStreaming");
         props.add("beanId");
@@ -63,11 +63,18 @@ public class CxfEndpointUriFactory extends 
org.apache.camel.support.component.En
         props.add("username");
         props.add("wrapped");
         props.add("wrappedStyle");
+        props.add("wsSecurityCallbackHandler");
+        props.add("wsSecurityCredentials");
+        props.add("wsSecurityPassword");
+        props.add("wsSecurityPasswordType");
+        props.add("wsSecurityUsername");
         props.add("wsdlURL");
         PROPERTY_NAMES = Collections.unmodifiableSet(props);
-        Set<String> secretProps = new HashSet<>(2);
+        Set<String> secretProps = new HashSet<>(4);
         secretProps.add("password");
         secretProps.add("username");
+        secretProps.add("wsSecurityPassword");
+        secretProps.add("wsSecurityUsername");
         SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps);
         ENDPOINT_IDENTITY_PROPERTY_NAMES = Collections.emptySet();
         Map<String, String> prefixes = new HashMap<>(1);
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/generated/resources/META-INF/org/apache/camel/component/cxf/jaxws/cxf.json
 
b/components/camel-cxf/camel-cxf-soap/src/generated/resources/META-INF/org/apache/camel/component/cxf/jaxws/cxf.json
index 466640e6e11f..f6bb97a377ce 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/generated/resources/META-INF/org/apache/camel/component/cxf/jaxws/cxf.json
+++ 
b/components/camel-cxf/camel-cxf-soap/src/generated/resources/META-INF/org/apache/camel/component/cxf/jaxws/cxf.json
@@ -81,11 +81,16 @@
     "skipFaultLogging": { "index": 30, "kind": "parameter", "displayName": 
"Skip Fault Logging", "group": "logging", "label": "logging", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": false, "description": 
"Whether to skip the log entry that the PhaseInterceptorChain writes when an 
interceptor throws an exception, for example the exception of a failed exchange 
of the consumer. Sets the CXF property or [...]
     "password": { "index": 31, "kind": "parameter", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "description": "The password for HTTP 
Basic authentication. The producer puts it, together with the user name, in the 
protocol header Authorization of its HTTP requests. Only used when the username 
option is set. Not used f [...]
     "username": { "index": 32, "kind": "parameter", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "description": "The user name for HTTP 
Basic authentication. The producer puts it, together with the password, in the 
protocol header Authorization of its HTTP requests. Only used when the password 
option is set. Not used f [...]
-    "bindingId": { "index": 33, "kind": "parameter", "displayName": "Binding 
Id", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The id of the CXF binding, which is a 
namespace URI, for example http:\/\/cxf.apache.org\/bindings\/xformat for the 
XML binding without a SOAP envelope. If not set, CXF uses the binding of the 
wsdl:port. The id http:\/\/schemas [...]
-    "portName": { "index": 34, "kind": "parameter", "displayName": "Port 
Name", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The WSDL port, which is the name 
attribute of the wsdl:port element. Written as a QName in the form 
{namespaceURI}localPart, for example {http:\/\/example.org\/orders}OrderPort." 
},
-    "publishedEndpointUrl": { "index": 35, "kind": "parameter", "displayName": 
"Published Endpoint Url", "group": "service", "label": "service", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "The address to publish in 
the WSDL that the consumer serves at the service address followed by ?wsdl. It 
replaces the location of the address element in the wsdl:port. Use it when 
clients reach the servic [...]
-    "serviceClass": { "index": 36, "kind": "parameter", "displayName": 
"Service Class", "group": "service", "label": "service", "required": false, 
"type": "string", "javaType": "java.lang.Class<java.lang.Object>", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
Java class of the service, for example a service endpoint interface or a class 
that implements one. Written as a fully qualified class name, for example 
org.example.orders.OrderService. Required when  [...]
-    "serviceName": { "index": 37, "kind": "parameter", "displayName": "Service 
Name", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The WSDL service, which is the name 
attribute of the wsdl:service element. Written as a QName in the form 
{namespaceURI}localPart, for example 
{http:\/\/example.org\/orders}OrderService. If not set and wsdlURL points to a 
W [...]
-    "wsdlURL": { "index": 38, "kind": "parameter", "displayName": "Wsdl URL", 
"group": "service", "label": "service", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The location of the WSDL. Can be on the 
classpath, file system, or be hosted remotely." }
+    "wsSecurityCallbackHandler": { "index": 33, "kind": "parameter", 
"displayName": "WS-Security Callback Handler", "group": "security", "label": 
"security", "required": false, "type": "object", "javaType": 
"javax.security.auth.callback.CallbackHandler", "deprecated": false, 
"autowired": false, "secret": false, "description": "To use a custom 
javax.security.auth.callback.CallbackHandler for the WS-Security UsernameToken. 
CXF calls it with an org.apache.wss4j.common.ext.WSPasswordCallback [...]
+    "wsSecurityCredentials": { "index": 34, "kind": "parameter", 
"displayName": "WS-Security Credentials", "group": "security", "label": 
"security", "required": false, "type": "object", "javaType": 
"java.util.Map<java.lang.String, java.lang.String>", "deprecated": false, 
"autowired": false, "secret": false, "description": "A map of user name to 
password with the users that the consumer accepts in a WS-Security 
UsernameToken, as a reference to a java.util.Map bean, for example #bean:users 
[...]
+    "wsSecurityPassword": { "index": 35, "kind": "parameter", "displayName": 
"WS-Security Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "description": "The 
password of a WS-Security UsernameToken. The producer sends it in the 
UsernameToken, and the consumer requires it for the user of the 
wsSecurityUsername option." },
+    "wsSecurityPasswordType": { "index": 36, "kind": "parameter", 
"displayName": "WS-Security Password Type", "group": "security", "label": 
"security", "required": false, "type": "enum", "javaType": "java.lang.String", 
"enum": [ "Text", "Digest" ], "deprecated": false, "autowired": false, 
"secret": false, "defaultValue": "Text", "description": "The type of the 
password in a WS-Security UsernameToken: Text for PasswordText, or Digest for 
PasswordDigest. The producer sends this type, and t [...]
+    "wsSecurityUsername": { "index": 37, "kind": "parameter", "displayName": 
"WS-Security Username", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "description": "The 
user name of a WS-Security UsernameToken. The producer sends a UsernameToken 
with this user name in the SOAP header of its requests. The consumer accepts 
only this user, with the pa [...]
+    "bindingId": { "index": 38, "kind": "parameter", "displayName": "Binding 
Id", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The id of the CXF binding, which is a 
namespace URI, for example http:\/\/cxf.apache.org\/bindings\/xformat for the 
XML binding without a SOAP envelope. If not set, CXF uses the binding of the 
wsdl:port. The id http:\/\/schemas [...]
+    "portName": { "index": 39, "kind": "parameter", "displayName": "Port 
Name", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The WSDL port, which is the name 
attribute of the wsdl:port element. Written as a QName in the form 
{namespaceURI}localPart, for example {http:\/\/example.org\/orders}OrderPort." 
},
+    "publishedEndpointUrl": { "index": 40, "kind": "parameter", "displayName": 
"Published Endpoint Url", "group": "service", "label": "service", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "description": "The address to publish in 
the WSDL that the consumer serves at the service address followed by ?wsdl. It 
replaces the location of the address element in the wsdl:port. Use it when 
clients reach the servic [...]
+    "serviceClass": { "index": 41, "kind": "parameter", "displayName": 
"Service Class", "group": "service", "label": "service", "required": false, 
"type": "string", "javaType": "java.lang.Class<java.lang.Object>", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
Java class of the service, for example a service endpoint interface or a class 
that implements one. Written as a fully qualified class name, for example 
org.example.orders.OrderService. Required when  [...]
+    "serviceName": { "index": 42, "kind": "parameter", "displayName": "Service 
Name", "group": "service", "label": "service", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The WSDL service, which is the name 
attribute of the wsdl:service element. Written as a QName in the form 
{namespaceURI}localPart, for example 
{http:\/\/example.org\/orders}OrderService. If not set and wsdlURL points to a 
W [...]
+    "wsdlURL": { "index": 43, "kind": "parameter", "displayName": "Wsdl URL", 
"group": "service", "label": "service", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "description": "The location of the WSDL. Can be on the 
classpath, file system, or be hosted remotely." }
   }
 }
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc 
b/components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc
index 84e1d51ac698..5ae5e472a57f 100644
--- a/components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc
+++ b/components/camel-cxf/camel-cxf-soap/src/main/docs/cxf-component.adoc
@@ -129,6 +129,82 @@ Using CXF with Spring Boot or Quarkus comes automatic 
integrated with the embedd
 
 See more details in the https://cxf.apache.org/docs/http-transport.html[CXF 
Transport] documentation.
 
+== WS-Security UsernameToken
+
+The `wsSecurity` options set up a WS-Security UsernameToken without Java code. 
The producer sends a UsernameToken in
+the SOAP header of its requests, and the consumer rejects a request without a 
valid UsernameToken with a SOAP fault.
+The options need the `org.apache.cxf:cxf-rt-ws-security` dependency, which 
`camel-cxf-soap` does not bring by itself.
+
+NOTE: The `username` and `password` options are for HTTP Basic authentication, 
not for WS-Security.
+
+[cols="1,2,2",options="header"]
+|===
+| Option | Producer | Consumer
+| `wsSecurityUsername` | The user name to send. | The one user that is 
accepted.
+| `wsSecurityPassword` | The password to send. | The password of that user.
+| `wsSecurityPasswordType` | `Text` (default) sends a PasswordText, `Digest` a 
PasswordDigest. Not used when the WSDL has a WS-SecurityPolicy. | The password 
type that is required. Not used when the WSDL has a WS-SecurityPolicy.
+| `wsSecurityCredentials` | Not used. | A `java.util.Map` bean of user name to 
password, to accept more than one user. The map is copied when the consumer 
starts: use `wsSecurityCallbackHandler` for users that change at runtime.
+| `wsSecurityCallbackHandler` | A `CallbackHandler` bean that sets the 
password, instead of `wsSecurityPassword`. | A `CallbackHandler` bean that 
looks up the password of any user, for example from a vault.
+|===
+
+When the WSDL of the service has a WS-SecurityPolicy, the policy decides how 
the UsernameToken is sent and checked,
+including the password type, and the options give the user name, the password 
and the callback handler to the policy.
+When the WSDL has no WS-SecurityPolicy, or there is no WSDL, the endpoint adds 
the CXF `WSS4JOutInterceptor` (producer)
+or `WSS4JInInterceptor` (consumer) for the UsernameToken.
+
+The consumer sets the authenticated user in the `CamelAuthentication` header, 
as a `javax.security.auth.Subject`.
+
+The options are not supported with `dataFormat=RAW`, as CXF does not process 
the SOAP envelope in this mode.
+
+WARNING: A UsernameToken with a plain text password must only be sent over 
HTTPS. `Digest` is no replacement for
+HTTPS: it uses SHA-1, and the consumer needs the plain password to check it.
+
+A consumer that accepts two users with a PasswordDigest:
+
+[source,yaml]
+----
+- beans:
+    - name: users
+      type: java.util.HashMap
+      properties:
+        alice: "{{alice.password}}"
+        bob: "{{bob.password}}"
+- route:
+    from:
+      uri: cxf://https://0.0.0.0:8443/orders
+      parameters:
+        wsdlURL: classpath:orders.wsdl
+        dataFormat: PAYLOAD
+        wsSecurityCredentials: "#bean:users"
+        wsSecurityPasswordType: Digest
+      steps:
+        - log: "Order request from ${header.CamelAuthentication}"
+----
+
+A producer that calls this service:
+
+[source,yaml]
+----
+- route:
+    from:
+      uri: direct:getOrder
+      steps:
+        - to:
+            uri: cxf://https://orders.example.com/orders
+            parameters:
+              wsdlURL: classpath:orders.wsdl
+              dataFormat: PAYLOAD
+              defaultOperationName: getOrder
+              wsSecurityUsername: alice
+              wsSecurityPassword: "{{alice.password}}"
+              wsSecurityPasswordType: Digest
+----
+
+Other WS-Security features, such as a Timestamp, a signature or encryption, 
are set up with the CXF properties in
+`properties.*`, or with CXF interceptors or a `cxfConfigurer` in Java code. A 
value of `properties.*` that is a
+`#bean:name` reference is resolved from the registry, for example
+`properties.security.callback-handler=#bean:myCallbackHandler`. A plain 
`#name` is not resolved.
+
 == Usage
 
 === RAW Mode
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfConsumer.java
 
b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfConsumer.java
index 698f2a69640e..469843c8a6a5 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfConsumer.java
+++ 
b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfConsumer.java
@@ -90,10 +90,8 @@ public class CxfConsumer extends DefaultConsumer implements 
Suspendable {
         ServerFactoryBean svrBean = cxfEndpoint.createServerFactoryBean();
         svrBean.setInvoker(new CxfConsumerInvoker(cxfEndpoint));
         final Server ret = svrBean.create();
-        // Apply the server configurer if it is possible
-        if (cxfEndpoint.getCxfConfigurer() != null) {
-            cxfEndpoint.getCxfConfigurer().configureServer(ret);
-        }
+        // apply the server configurers: the custom cxfConfigurer, and the 
ones of the endpoint options (WS-Security)
+        cxfEndpoint.getChainedCxfConfigurer().configureServer(ret);
         ret.getEndpoint().getEndpointInfo().setProperty("serviceClass", 
cxfEndpoint.getServiceClass());
         if (ObjectHelper.isNotEmpty(cxfEndpoint.getPublishedEndpointUrl())) {
             
ret.getEndpoint().getEndpointInfo().setProperty("publishedEndpointUrl", 
cxfEndpoint.getPublishedEndpointUrl());
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfEndpoint.java
 
b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfEndpoint.java
index 3a446a17b255..43f3efe9fa31 100644
--- 
a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfEndpoint.java
+++ 
b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/CxfEndpoint.java
@@ -32,6 +32,7 @@ import jakarta.xml.ws.WebServiceProvider;
 import jakarta.xml.ws.handler.Handler;
 
 import javax.net.ssl.HostnameVerifier;
+import javax.security.auth.callback.CallbackHandler;
 import javax.wsdl.Definition;
 import javax.wsdl.WSDLException;
 import javax.xml.namespace.QName;
@@ -401,6 +402,37 @@ public class CxfEndpoint extends DefaultEndpoint 
implements AsyncEndpoint, Heade
                             + " the protocol header Authorization of its HTTP 
requests. Only used when the username option is"
                             + " set. Not used for reading the WSDL that 
wsdlURL points to. The consumer does not use it.")
     private String password;
+    @UriParam(label = "security", displayName = "WS-Security Username", 
security = "secret",
+              description = "The user name of a WS-Security UsernameToken. The 
producer sends a UsernameToken with this user"
+                            + " name in the SOAP header of its requests. The 
consumer accepts only this user, with the"
+                            + " password of the wsSecurityPassword option, 
unless wsSecurityCallbackHandler or"
+                            + " wsSecurityCredentials is set. Needs the 
org.apache.cxf:cxf-rt-ws-security dependency."
+                            + " Send a UsernameToken with a plain text 
password over HTTPS only.")
+    private String wsSecurityUsername;
+    @UriParam(label = "security", displayName = "WS-Security Password", 
security = "secret",
+              description = "The password of a WS-Security UsernameToken. The 
producer sends it in the UsernameToken, and"
+                            + " the consumer requires it for the user of the 
wsSecurityUsername option.")
+    private String wsSecurityPassword;
+    @UriParam(label = "security", displayName = "WS-Security Password Type", 
enums = "Text,Digest", defaultValue = "Text",
+              description = "The type of the password in a WS-Security 
UsernameToken: Text for PasswordText, or Digest for"
+                            + " PasswordDigest. The producer sends this type, 
and the consumer requires it. Not used when"
+                            + " the WSDL of the service has a 
WS-SecurityPolicy, which then decides the type. Digest is no"
+                            + " replacement for HTTPS: it uses SHA-1, and the 
consumer needs the plain password.")
+    private String wsSecurityPasswordType = "Text";
+    @UriParam(label = "security", displayName = "WS-Security Callback Handler",
+              description = "To use a custom 
javax.security.auth.callback.CallbackHandler for the WS-Security"
+                            + " UsernameToken. CXF calls it with an 
org.apache.wss4j.common.ext.WSPasswordCallback that"
+                            + " names the user, and the handler sets the 
password of that user. The producer uses it"
+                            + " instead of wsSecurityPassword. The consumer 
uses it to look up the password of any user,"
+                            + " for example from a vault, instead of 
wsSecurityUsername, wsSecurityPassword and"
+                            + " wsSecurityCredentials.")
+    private CallbackHandler wsSecurityCallbackHandler;
+    @UriParam(label = "security", displayName = "WS-Security Credentials",
+              description = "A map of user name to password with the users 
that the consumer accepts in a WS-Security"
+                            + " UsernameToken, as a reference to a 
java.util.Map bean, for example #bean:users. Used instead"
+                            + " of wsSecurityUsername and wsSecurityPassword 
to accept more than one user without Java"
+                            + " code. Not used when wsSecurityCallbackHandler 
is set. The producer does not use it.")
+    private Map<String, String> wsSecurityCredentials;
     @UriParam(label = "advanced", prefix = "properties.", multiValue = true)
     private Map<String, Object> properties;
     @UriParam(label = "producer",
@@ -1309,6 +1341,28 @@ public class CxfEndpoint extends DefaultEndpoint 
implements AsyncEndpoint, Heade
         if (cxfBinding instanceof HeaderFilterStrategyAware 
headerFilterStrategyAware) {
             
headerFilterStrategyAware.setHeaderFilterStrategy(getHeaderFilterStrategy());
         }
+        if (isWsSecurityUsernameTokenEnabled()) {
+            validateWsSecurityOptions();
+        }
+    }
+
+    private void validateWsSecurityOptions() {
+        if (getDataFormat().dealias() == DataFormat.RAW) {
+            // CXF does not process the SOAP envelope in RAW mode, so no token 
would be sent or checked
+            throw new IllegalArgumentException(
+                    "The wsSecurity options are not supported with 
dataFormat=RAW. Use PAYLOAD, POJO or CXF_MESSAGE instead.");
+        }
+        if (!"Text".equals(wsSecurityPasswordType) && 
!"Digest".equals(wsSecurityPasswordType)) {
+            throw new IllegalArgumentException(
+                    "The option wsSecurityPasswordType must be Text or Digest, 
was: " + wsSecurityPasswordType);
+        }
+        try {
+            getCamelContext().getClassResolver()
+                    
.resolveMandatoryClass("org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor");
+        } catch (ClassNotFoundException e) {
+            throw new IllegalStateException(
+                    "The wsSecurity options need the 
org.apache.cxf:cxf-rt-ws-security dependency on the classpath", e);
+        }
     }
 
     @Override
@@ -1355,11 +1409,65 @@ public class CxfEndpoint extends DefaultEndpoint 
implements AsyncEndpoint, Heade
         this.username = username;
     }
 
+    public String getWsSecurityUsername() {
+        return wsSecurityUsername;
+    }
+
+    public void setWsSecurityUsername(String wsSecurityUsername) {
+        this.wsSecurityUsername = wsSecurityUsername;
+    }
+
+    public String getWsSecurityPassword() {
+        return wsSecurityPassword;
+    }
+
+    public void setWsSecurityPassword(String wsSecurityPassword) {
+        this.wsSecurityPassword = wsSecurityPassword;
+    }
+
+    public String getWsSecurityPasswordType() {
+        return wsSecurityPasswordType;
+    }
+
+    public void setWsSecurityPasswordType(String wsSecurityPasswordType) {
+        this.wsSecurityPasswordType = wsSecurityPasswordType;
+    }
+
+    public CallbackHandler getWsSecurityCallbackHandler() {
+        return wsSecurityCallbackHandler;
+    }
+
+    public void setWsSecurityCallbackHandler(CallbackHandler 
wsSecurityCallbackHandler) {
+        this.wsSecurityCallbackHandler = wsSecurityCallbackHandler;
+    }
+
+    public Map<String, String> getWsSecurityCredentials() {
+        return wsSecurityCredentials;
+    }
+
+    public void setWsSecurityCredentials(Map<String, String> 
wsSecurityCredentials) {
+        this.wsSecurityCredentials = wsSecurityCredentials;
+    }
+
+    /**
+     * Whether a WS-Security UsernameToken option (wsSecurityUsername, 
wsSecurityPassword, wsSecurityCallbackHandler or
+     * wsSecurityCredentials) is set.
+     */
+    public boolean isWsSecurityUsernameTokenEnabled() {
+        return ObjectHelper.isNotEmpty(wsSecurityUsername) || 
ObjectHelper.isNotEmpty(wsSecurityPassword)
+                || wsSecurityCallbackHandler != null || wsSecurityCredentials 
!= null;
+    }
+
     public CxfConfigurer getChainedCxfConfigurer() {
-        return ChainedCxfConfigurer
+        ChainedCxfConfigurer answer = ChainedCxfConfigurer
                 .create(getNullSafeCxfConfigurer(),
                         SslCxfConfigurer.create(sslContextParameters, 
getCamelContext()))
                 
.addChild(HostnameVerifierCxfConfigurer.create(hostnameVerifier));
+        if (isWsSecurityUsernameTokenEnabled()) {
+            // only loaded when an option is set, as it needs the optional 
cxf-rt-ws-security dependency
+            answer = 
answer.addChild(WsSecurityUsernameTokenConfigurer.create(this));
+        }
+        return answer;
     }
 
     private CxfConfigurer getNullSafeCxfConfigurer() {
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/WsSecurityUsernameTokenConfigurer.java
 
b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/WsSecurityUsernameTokenConfigurer.java
new file mode 100644
index 000000000000..dd04125d6edf
--- /dev/null
+++ 
b/components/camel-cxf/camel-cxf-soap/src/main/java/org/apache/camel/component/cxf/jaxws/WsSecurityUsernameTokenConfigurer.java
@@ -0,0 +1,253 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.cxf.jaxws;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.UnsupportedCallbackException;
+
+import org.apache.camel.util.ObjectHelper;
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.rt.security.SecurityConstants;
+import org.apache.cxf.service.model.BindingOperationInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.ws.policy.PolicyEngineImpl;
+import org.apache.cxf.ws.policy.PolicyProvider;
+import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
+import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyContainingAssertion;
+import org.apache.neethi.PolicyOperator;
+import org.apache.wss4j.common.ConfigurationConstants;
+import org.apache.wss4j.common.WSS4JConstants;
+import org.apache.wss4j.common.ext.WSPasswordCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Sets up a WS-Security UsernameToken from the wsSecurity options of the 
{@link CxfEndpoint}.
+ * <p>
+ * It always sets the CXF security properties (user name, password and 
callback handler), which the WS-SecurityPolicy
+ * interceptors use when the WSDL of the service has a WS-SecurityPolicy. When 
it has none, it also adds a
+ * {@link WSS4JOutInterceptor} (producer) or a {@link WSS4JInInterceptor} 
(consumer) for the UsernameToken. It does not
+ * add both, as the security header would then be processed twice.
+ * <p>
+ * This is the only class of the endpoint options that uses the optional 
cxf-rt-ws-security dependency, and it is loaded
+ * only when one of the options is set.
+ */
+final class WsSecurityUsernameTokenConfigurer implements CxfConfigurer {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(WsSecurityUsernameTokenConfigurer.class);
+
+    // the namespaces of WS-SecurityPolicy 1.1, 1.2 and 1.3
+    private static final Set<String> SECURITY_POLICY_NAMESPACES = Set.of(
+            "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy";,
+            "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";,
+            "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200802";);
+
+    private final CxfEndpoint endpoint;
+
+    private WsSecurityUsernameTokenConfigurer(CxfEndpoint endpoint) {
+        this.endpoint = endpoint;
+    }
+
+    static CxfConfigurer create(CxfEndpoint endpoint) {
+        return new WsSecurityUsernameTokenConfigurer(endpoint);
+    }
+
+    @Override
+    public void configure(AbstractWSDLBasedEndpointFactory factoryBean) {
+        // the client and server are configured once created, as the policy of 
the WSDL is known only then
+    }
+
+    @Override
+    public void configureClient(Client client) {
+        String username = endpoint.getWsSecurityUsername();
+        String password = endpoint.getWsSecurityPassword();
+        CallbackHandler callbackHandler = 
endpoint.getWsSecurityCallbackHandler();
+        if (ObjectHelper.isEmpty(username)) {
+            throw new IllegalArgumentException(
+                    "The option wsSecurityUsername must be set to send a 
WS-Security UsernameToken");
+        }
+        if (ObjectHelper.isEmpty(password) && callbackHandler == null) {
+            throw new IllegalArgumentException(
+                    "The option wsSecurityPassword or 
wsSecurityCallbackHandler must be set to send a WS-Security"
+                                               + " UsernameToken");
+        }
+        CallbackHandler handler = callbackHandler != null ? callbackHandler : 
new PasswordCallbackHandler(username, password);
+
+        Endpoint ep = client.getEndpoint();
+        ep.put(SecurityConstants.USERNAME, username);
+        if (ObjectHelper.isNotEmpty(password)) {
+            ep.put(SecurityConstants.PASSWORD, password);
+        }
+        ep.put(SecurityConstants.CALLBACK_HANDLER, handler);
+
+        if (hasSecurityPolicy(client.getBus(), ep.getEndpointInfo())) {
+            LOG.debug("The WSDL of {} has a WS-SecurityPolicy, which sends the 
UsernameToken", endpoint);
+        } else {
+            Map<String, Object> props = new HashMap<>();
+            props.put(ConfigurationConstants.ACTION, 
ConfigurationConstants.USERNAME_TOKEN);
+            props.put(ConfigurationConstants.USER, username);
+            props.put(ConfigurationConstants.PASSWORD_TYPE, passwordType());
+            props.put(ConfigurationConstants.PW_CALLBACK_REF, handler);
+            ep.getOutInterceptors().add(new WSS4JOutInterceptor(props));
+            LOG.debug("Added a WSS4JOutInterceptor that sends a UsernameToken 
to {}", endpoint);
+        }
+    }
+
+    @Override
+    public void configureServer(Server server) {
+        CallbackHandler handler = serverCallbackHandler();
+
+        Endpoint ep = server.getEndpoint();
+        ep.put(SecurityConstants.CALLBACK_HANDLER, handler);
+
+        if (hasSecurityPolicy(endpoint.getBus(), ep.getEndpointInfo())) {
+            LOG.debug("The WSDL of {} has a WS-SecurityPolicy, which checks 
the UsernameToken", endpoint);
+        } else {
+            Map<String, Object> props = new HashMap<>();
+            props.put(ConfigurationConstants.ACTION, 
ConfigurationConstants.USERNAME_TOKEN);
+            // on the inbound side the password type is the type that is 
required
+            props.put(ConfigurationConstants.PASSWORD_TYPE, passwordType());
+            props.put(ConfigurationConstants.PW_CALLBACK_REF, handler);
+            ep.getInInterceptors().add(new WSS4JInInterceptor(props));
+            LOG.debug("Added a WSS4JInInterceptor that requires a 
UsernameToken to {}", endpoint);
+        }
+    }
+
+    private CallbackHandler serverCallbackHandler() {
+        if (endpoint.getWsSecurityCallbackHandler() != null) {
+            return endpoint.getWsSecurityCallbackHandler();
+        }
+        if (endpoint.getWsSecurityCredentials() != null) {
+            return new 
PasswordCallbackHandler(endpoint.getWsSecurityCredentials());
+        }
+        String username = endpoint.getWsSecurityUsername();
+        String password = endpoint.getWsSecurityPassword();
+        if (ObjectHelper.isEmpty(username) || ObjectHelper.isEmpty(password)) {
+            throw new IllegalArgumentException(
+                    "The options wsSecurityUsername and wsSecurityPassword, or 
wsSecurityCredentials, or"
+                                               + " wsSecurityCallbackHandler 
must be set to check a WS-Security"
+                                               + " UsernameToken");
+        }
+        return new PasswordCallbackHandler(username, password);
+    }
+
+    private String passwordType() {
+        return "Digest".equals(endpoint.getWsSecurityPasswordType()) ? 
WSS4JConstants.PW_DIGEST : WSS4JConstants.PW_TEXT;
+    }
+
+    /**
+     * Whether the WSDL of the endpoint has a WS-SecurityPolicy, on the 
service, the port, the binding, or an operation
+     * or message of the binding.
+     */
+    static boolean hasSecurityPolicy(Bus bus, EndpointInfo ei) {
+        PolicyEngine engine = bus != null ? 
bus.getExtension(PolicyEngine.class) : null;
+        if (engine == null || !engine.isEnabled() || ei == null) {
+            return false;
+        }
+        if (!(engine instanceof PolicyEngineImpl engineImpl)) {
+            LOG.debug("Cannot check the WS-SecurityPolicy with the policy 
engine {}", engine);
+            return false;
+        }
+        Message message = new MessageImpl();
+        for (PolicyProvider provider : engineImpl.getPolicyProviders()) {
+            if (isSecurityPolicy(provider.getEffectivePolicy(ei.getService(), 
message))
+                    || isSecurityPolicy(provider.getEffectivePolicy(ei, 
message))) {
+                return true;
+            }
+            if (ei.getBinding() == null) {
+                continue;
+            }
+            for (BindingOperationInfo boi : ei.getBinding().getOperations()) {
+                if (isSecurityPolicy(provider.getEffectivePolicy(boi, message))
+                        || boi.getInput() != null && 
isSecurityPolicy(provider.getEffectivePolicy(boi.getInput(), message))
+                        || boi.getOutput() != null
+                                && 
isSecurityPolicy(provider.getEffectivePolicy(boi.getOutput(), message))) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    private static boolean isSecurityPolicy(PolicyComponent component) {
+        if (component instanceof Assertion assertion) {
+            if (assertion.getName() != null
+                    && 
SECURITY_POLICY_NAMESPACES.contains(assertion.getName().getNamespaceURI())) {
+                return true;
+            }
+            return assertion instanceof PolicyContainingAssertion pca && 
isSecurityPolicy(pca.getPolicy());
+        }
+        if (component instanceof PolicyOperator operator) {
+            for (PolicyComponent child : operator.getPolicyComponents()) {
+                if (isSecurityPolicy(child)) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Sets the password of the user in a {@link WSPasswordCallback}, from a 
map of user name to password. It sets no
+     * password for an unknown user, so that the UsernameToken of that user is 
rejected. The map is copied when the
+     * handler is created, so a later change of the map bean does not change 
the users.
+     */
+    static final class PasswordCallbackHandler implements CallbackHandler {
+
+        // a map bean may hold values that are not String, such as a number in 
YAML
+        private final Map<?, ?> passwords;
+
+        PasswordCallbackHandler(String username, String password) {
+            this(Map.of(username, password));
+        }
+
+        PasswordCallbackHandler(Map<?, ?> passwords) {
+            // a copy, as the map bean may be changed while the handler is 
called by several requests at once
+            this.passwords = Collections.unmodifiableMap(new 
HashMap<>(passwords));
+        }
+
+        @Override
+        public void handle(Callback[] callbacks) throws 
UnsupportedCallbackException {
+            for (Callback callback : callbacks) {
+                if (callback instanceof WSPasswordCallback pc) {
+                    Object password = pc.getIdentifier() != null ? 
passwords.get(pc.getIdentifier()) : null;
+                    if (password != null) {
+                        pc.setPassword(password.toString());
+                    }
+                } else {
+                    throw new UnsupportedCallbackException(callback);
+                }
+            }
+        }
+    }
+}
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfWsSecurityUsernameTokenTest.java
 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfWsSecurityUsernameTokenTest.java
new file mode 100644
index 000000000000..d049395d005c
--- /dev/null
+++ 
b/components/camel-cxf/camel-cxf-soap/src/test/java/org/apache/camel/component/cxf/jaxws/CxfWsSecurityUsernameTokenTest.java
@@ -0,0 +1,343 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.cxf.jaxws;
+
+import java.security.Principal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.FailedToStartRouteException;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.cxf.common.message.CxfConstants;
+import org.apache.camel.test.AvailablePortFinder;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor;
+import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
+import org.apache.wss4j.common.ext.WSPasswordCallback;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * WS-Security UsernameToken with the wsSecurity options of the endpoint, for 
a WSDL without and with a
+ * WS-SecurityPolicy, and #bean: references in properties.*.
+ */
+class CxfWsSecurityUsernameTokenTest extends CamelTestSupport {
+
+    private static final String REQUEST
+            = "<getOrder 
xmlns=\"http://camel.apache.org/wssec/orders\";><orderId>1</orderId></getOrder>";
+
+    private static AvailablePortFinder.Port port;
+
+    @BeforeAll
+    static void allocatePort() {
+        port = AvailablePortFinder.find();
+    }
+
+    @AfterAll
+    static void releasePort() {
+        if (port != null) {
+            port.release();
+        }
+    }
+
+    private final Map<String, Object> users = new HashMap<>();
+
+    private static String address(String path) {
+        return "http://localhost:"; + port.getPort() + 
"/CxfWsSecurityUsernameTokenTest/" + path;
+    }
+
+    private static String server(String path, String wsdl, String options) {
+        return "cxf://" + address(path) + "?wsdlURL=classpath:wssec/" + wsdl + 
"&dataFormat=PAYLOAD" + options;
+    }
+
+    private static String client(String path, String wsdl, String options) {
+        return "cxf://" + address(path) + "?wsdlURL=classpath:wssec/" + wsdl
+               + "&dataFormat=PAYLOAD&defaultOperationName=getOrder" + options;
+    }
+
+    @Override
+    protected CamelContext createCamelContext() throws Exception {
+        CamelContext context = super.createCamelContext();
+        users.put("bob", "builder");
+        users.put("carol", "secret");
+        // a map bean may hold a password that is not a String, such as a 
number from a YAML bean
+        users.put("kryten", 4000);
+        context.getRegistry().bind("users", users);
+        context.getRegistry().bind("serverCallback", new 
FixedPasswordCallbackHandler("alice", "wonderland"));
+        context.getRegistry().bind("clientCallback", new 
FixedPasswordCallbackHandler("alice", "wonderland"));
+        return context;
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                // no WS-Policy in the WSDL: one user, PasswordText
+                from(server("text", "orders.wsdl", 
"&wsSecurityUsername=alice&wsSecurityPassword=wonderland"))
+                        
.routeId("text").process(CxfWsSecurityUsernameTokenTest::reply);
+                // no WS-Policy in the WSDL: several users from a map bean, 
PasswordDigest
+                from(server("digest", "orders.wsdl", 
"&wsSecurityCredentials=#bean:users&wsSecurityPasswordType=Digest"))
+                        
.routeId("digest").process(CxfWsSecurityUsernameTokenTest::reply);
+                // a WS-SecurityPolicy in the WSDL: the policy asks for the 
UsernameToken, the handler checks it
+                from(server("policy", "orders-ut.wsdl", 
"&wsSecurityCallbackHandler=#bean:serverCallback"))
+                        
.routeId("policy").process(CxfWsSecurityUsernameTokenTest::reply);
+                // the CXF property set in properties.* with a #bean: reference
+                from(server("properties", "orders-ut.wsdl", 
"&properties.security.callback-handler=#bean:serverCallback"))
+                        
.routeId("properties").process(CxfWsSecurityUsernameTokenTest::reply);
+            }
+        };
+    }
+
+    private static void reply(Exchange exchange) {
+        Subject subject = 
exchange.getIn().getHeader(CxfConstants.AUTHENTICATION, Subject.class);
+        String user = subject == null
+                ? "none"
+                : 
subject.getPrincipals().stream().map(Principal::getName).findFirst().orElse("none");
+        exchange.getMessage().setBody("<getOrderResponse 
xmlns=\"http://camel.apache.org/wssec/orders\";>"
+                                      + "<orderId>1</orderId><user>" + user + 
"</user></getOrderResponse>");
+    }
+
+    private String call(String uri) {
+        Exchange exchange = template.request(uri, e -> 
e.getIn().setBody(REQUEST));
+        if (exchange.getException() != null) {
+            throw new AssertionError("Unexpected exception", 
exchange.getException());
+        }
+        return exchange.getMessage().getBody(String.class);
+    }
+
+    private void callRejected(String uri) {
+        Exchange exchange = template.request(uri, e -> 
e.getIn().setBody(REQUEST));
+        SoapFault fault = assertInstanceOf(SoapFault.class, 
exchange.getException());
+        assertTrue(fault.getMessage().contains("security"), 
fault.getMessage());
+    }
+
+    @Test
+    void textWithoutPolicy() {
+        String reply = call(client("text", "orders.wsdl", 
"&wsSecurityUsername=alice&wsSecurityPassword=wonderland"));
+        assertTrue(reply.contains("<user>alice</user>"), reply);
+    }
+
+    @Test
+    void textWithoutPolicyWrongPassword() {
+        callRejected(client("text", "orders.wsdl", 
"&wsSecurityUsername=alice&wsSecurityPassword=wrong"));
+    }
+
+    @Test
+    void textWithoutPolicyNoToken() {
+        callRejected(client("text", "orders.wsdl", ""));
+    }
+
+    @Test
+    void textWithoutPolicyClientCallbackHandler() {
+        String reply = call(
+                client("text", "orders.wsdl", 
"&wsSecurityUsername=alice&wsSecurityCallbackHandler=#bean:clientCallback"));
+        assertTrue(reply.contains("<user>alice</user>"), reply);
+    }
+
+    @Test
+    void digestWithoutPolicy() {
+        String uri = client("digest", "orders.wsdl",
+                
"&wsSecurityUsername=bob&wsSecurityPassword=builder&wsSecurityPasswordType=Digest");
+        String reply = call(uri);
+        assertTrue(reply.contains("<user>bob</user>"), reply);
+
+        String uri2 = client("digest", "orders.wsdl",
+                
"&wsSecurityUsername=carol&wsSecurityPassword=secret&wsSecurityPasswordType=Digest");
+        reply = call(uri2);
+        assertTrue(reply.contains("<user>carol</user>"), reply);
+    }
+
+    @Test
+    void digestWithoutPolicyNumberPassword() {
+        String reply = call(client("digest", "orders.wsdl",
+                
"&wsSecurityUsername=kryten&wsSecurityPassword=4000&wsSecurityPasswordType=Digest"));
+        assertTrue(reply.contains("<user>kryten</user>"), reply);
+    }
+
+    @Test
+    void digestWithoutPolicyCredentialsCopied() {
+        // the consumer has copied the map when it started, so a user added to 
the bean later is not accepted
+        users.put("mallory", "builder");
+        callRejected(client("digest", "orders.wsdl",
+                
"&wsSecurityUsername=mallory&wsSecurityPassword=builder&wsSecurityPasswordType=Digest"));
+    }
+
+    @Test
+    void digestWithoutPolicyWrongPassword() {
+        callRejected(client("digest", "orders.wsdl",
+                
"&wsSecurityUsername=bob&wsSecurityPassword=wrong&wsSecurityPasswordType=Digest"));
+    }
+
+    @Test
+    void digestWithoutPolicyUnknownUser() {
+        callRejected(client("digest", "orders.wsdl",
+                
"&wsSecurityUsername=mallory&wsSecurityPassword=builder&wsSecurityPasswordType=Digest"));
+    }
+
+    @Test
+    void digestRequiredTextRejected() {
+        // the consumer requires PasswordDigest
+        callRejected(client("digest", "orders.wsdl", 
"&wsSecurityUsername=bob&wsSecurityPassword=builder"));
+    }
+
+    @Test
+    void withPolicy() throws Exception {
+        String uri = client("policy", "orders-ut.wsdl", 
"&wsSecurityUsername=alice&wsSecurityPassword=wonderland");
+        String reply = call(uri);
+        assertTrue(reply.contains("<user>alice</user>"), reply);
+
+        // the policy sends and checks the token: no plain WSS4J interceptors 
as well
+        CxfProducer producer = (CxfProducer) 
context.getEndpoint(uri).createProducer();
+        producer.start();
+        try {
+            
assertFalse(hasInterceptor(producer.getClient().getEndpoint().getOutInterceptors(),
 WSS4JOutInterceptor.class));
+        } finally {
+            producer.stop();
+        }
+        CxfConsumer consumer = (CxfConsumer) 
context.getRoute("policy").getConsumer();
+        
assertFalse(hasInterceptor(consumer.getServer().getEndpoint().getInInterceptors(),
 WSS4JInInterceptor.class));
+    }
+
+    @Test
+    void withoutPolicyAddsInterceptors() throws Exception {
+        String uri = client("text", "orders.wsdl", 
"&wsSecurityUsername=alice&wsSecurityPassword=wonderland");
+        CxfProducer producer = (CxfProducer) 
context.getEndpoint(uri).createProducer();
+        producer.start();
+        try {
+            
assertTrue(hasInterceptor(producer.getClient().getEndpoint().getOutInterceptors(),
 WSS4JOutInterceptor.class));
+        } finally {
+            producer.stop();
+        }
+        CxfConsumer consumer = (CxfConsumer) 
context.getRoute("text").getConsumer();
+        
assertTrue(hasInterceptor(consumer.getServer().getEndpoint().getInInterceptors(),
 WSS4JInInterceptor.class));
+    }
+
+    @Test
+    void withPolicyWrongPassword() {
+        callRejected(client("policy", "orders-ut.wsdl", 
"&wsSecurityUsername=alice&wsSecurityPassword=wrong"));
+    }
+
+    @Test
+    void withPolicyPropertiesBeanReference() {
+        CxfEndpoint endpoint = (CxfEndpoint) 
context.getRoute("properties").getEndpoint();
+        assertSame(context.getRegistry().lookupByName("serverCallback"),
+                endpoint.getProperties().get("security.callback-handler"));
+
+        // the client side with the CXF properties of before, which work as 
the WSDL has a policy
+        String reply = call(client("properties", "orders-ut.wsdl",
+                
"&properties.security.username=alice&properties.security.password=wonderland"));
+        assertTrue(reply.contains("<user>alice</user>"), reply);
+
+        callRejected(client("properties", "orders-ut.wsdl",
+                
"&properties.security.username=alice&properties.security.password=wrong"));
+    }
+
+    @Test
+    void propertiesOnlyBeanPrefixResolved() {
+        // a value that only starts with # is free-form CXF configuration, and 
not a bean lookup
+        CxfEndpoint endpoint = context.getEndpoint(
+                client("text", "orders.wsdl", 
"&properties.security.password=#secret"), CxfEndpoint.class);
+        assertEquals("#secret", 
endpoint.getProperties().get("security.password"));
+    }
+
+    @Test
+    void propertiesUnknownBean() {
+        Exception e = assertThrows(Exception.class, () -> context.getEndpoint(
+                client("text", "orders.wsdl", 
"&properties.security.callback-handler=#bean:doesNotExist")));
+        assertTrue(e.getMessage().contains("doesNotExist"), e.getMessage());
+    }
+
+    @Test
+    void clientWithoutUsername() {
+        Exception e = assertThrows(Exception.class, () -> {
+            CxfProducer producer = (CxfProducer) context.getEndpoint(
+                    client("text", "orders.wsdl", 
"&wsSecurityPassword=wonderland")).createProducer();
+            producer.start();
+        });
+        assertTrue(e.getMessage().contains("wsSecurityUsername"), 
e.getMessage());
+    }
+
+    @Test
+    void rawNotSupported() {
+        Exception e = assertThrows(Exception.class, () -> context.getEndpoint(
+                "cxf://" + address("raw") + 
"?wsdlURL=classpath:wssec/orders.wsdl&dataFormat=RAW"
+                                                                              
+ "&wsSecurityUsername=alice&wsSecurityPassword=wonderland")
+                .createProducer().start());
+        assertTrue(e.getMessage().contains("RAW"), e.getMessage());
+    }
+
+    @Test
+    void serverWithoutPassword() throws Exception {
+        FailedToStartRouteException e = 
assertThrows(FailedToStartRouteException.class, () -> {
+            context.addRoutes(new RouteBuilder() {
+                @Override
+                public void configure() {
+                    from(server("nopassword", "orders.wsdl", 
"&wsSecurityUsername=alice")).routeId("nopassword")
+                            .process(CxfWsSecurityUsernameTokenTest::reply);
+                }
+            });
+        });
+        Throwable cause = e;
+        while (cause.getCause() != null) {
+            cause = cause.getCause();
+        }
+        assertTrue(cause.getMessage().contains("wsSecurityCredentials"), 
cause.getMessage());
+    }
+
+    private static boolean hasInterceptor(List<?> interceptors, Class<?> type) 
{
+        return interceptors.stream().anyMatch(type::isInstance);
+    }
+
+    /**
+     * Sets the password of one user, as a server or a client password 
callback handler.
+     */
+    static final class FixedPasswordCallbackHandler implements CallbackHandler 
{
+        private final String user;
+        private final String password;
+
+        FixedPasswordCallbackHandler(String user, String password) {
+            this.user = user;
+            this.password = password;
+        }
+
+        @Override
+        public void handle(Callback[] callbacks) {
+            for (Callback cb : callbacks) {
+                if (cb instanceof WSPasswordCallback pc && 
user.equals(pc.getIdentifier())) {
+                    pc.setPassword(password);
+                }
+            }
+        }
+    }
+}
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/test/resources/wssec/orders-ut.wsdl 
b/components/camel-cxf/camel-cxf-soap/src/test/resources/wssec/orders-ut.wsdl
new file mode 100644
index 000000000000..033402cc40c4
--- /dev/null
+++ 
b/components/camel-cxf/camel-cxf-soap/src/test/resources/wssec/orders-ut.wsdl
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!-- The same service as orders.wsdl, with a WS-SecurityPolicy that asks for a 
UsernameToken (plain text: use it over https) -->
+<wsdl:definitions name="OrderService"
+    targetNamespace="http://camel.apache.org/wssec/orders";
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+    xmlns:xs="http://www.w3.org/2001/XMLSchema";
+    xmlns:tns="http://camel.apache.org/wssec/orders";
+    xmlns:wsp="http://www.w3.org/ns/ws-policy";
+    xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702";
+    
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";>
+
+  <!-- WS-SecurityPolicy: every request carries a WS-Security UsernameToken -->
+  <wsp:Policy wsu:Id="UsernameTokenPolicy">
+    <wsp:ExactlyOne>
+      <wsp:All>
+        <sp:SupportingTokens>
+          <wsp:Policy>
+            <sp:UsernameToken 
sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient";>
+              <wsp:Policy>
+                <sp:WssUsernameToken10/>
+              </wsp:Policy>
+            </sp:UsernameToken>
+          </wsp:Policy>
+        </sp:SupportingTokens>
+      </wsp:All>
+    </wsp:ExactlyOne>
+  </wsp:Policy>
+
+  <wsdl:types>
+    <xs:schema targetNamespace="http://camel.apache.org/wssec/orders"; 
elementFormDefault="qualified">
+      <xs:element name="getOrder">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="orderId" type="xs:string"/>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="getOrderResponse">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="orderId" type="xs:string"/>
+            <xs:element name="user" type="xs:string"/>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+    </xs:schema>
+  </wsdl:types>
+
+  <wsdl:message name="getOrderRequest">
+    <wsdl:part name="parameters" element="tns:getOrder"/>
+  </wsdl:message>
+  <wsdl:message name="getOrderResponse">
+    <wsdl:part name="parameters" element="tns:getOrderResponse"/>
+  </wsdl:message>
+
+  <wsdl:portType name="OrderPortType">
+    <wsdl:operation name="getOrder">
+      <wsdl:input message="tns:getOrderRequest"/>
+      <wsdl:output message="tns:getOrderResponse"/>
+    </wsdl:operation>
+  </wsdl:portType>
+
+  <wsdl:binding name="OrderSoapBinding" type="tns:OrderPortType">
+    <wsp:PolicyReference URI="#UsernameTokenPolicy"/>
+    <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="getOrder">
+      <soap:operation 
soapAction="http://camel.apache.org/wssec/orders/getOrder"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+
+  <wsdl:service name="OrderService">
+    <wsdl:port name="OrderPort" binding="tns:OrderSoapBinding">
+      <soap:address location="http://localhost:9000/orders"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
diff --git 
a/components/camel-cxf/camel-cxf-soap/src/test/resources/wssec/orders.wsdl 
b/components/camel-cxf/camel-cxf-soap/src/test/resources/wssec/orders.wsdl
new file mode 100644
index 000000000000..856c77d72ee9
--- /dev/null
+++ b/components/camel-cxf/camel-cxf-soap/src/test/resources/wssec/orders.wsdl
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+
+-->
+<!-- A small document/literal wrapped SOAP 1.1 service without a WS-Policy, 
for the WS-Security UsernameToken tests -->
+<wsdl:definitions name="OrderService"
+    targetNamespace="http://camel.apache.org/wssec/orders";
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+    xmlns:xs="http://www.w3.org/2001/XMLSchema";
+    xmlns:tns="http://camel.apache.org/wssec/orders";>
+
+  <wsdl:types>
+    <xs:schema targetNamespace="http://camel.apache.org/wssec/orders"; 
elementFormDefault="qualified">
+      <xs:element name="getOrder">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="orderId" type="xs:string"/>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+      <xs:element name="getOrderResponse">
+        <xs:complexType>
+          <xs:sequence>
+            <xs:element name="orderId" type="xs:string"/>
+            <xs:element name="user" type="xs:string"/>
+          </xs:sequence>
+        </xs:complexType>
+      </xs:element>
+    </xs:schema>
+  </wsdl:types>
+
+  <wsdl:message name="getOrderRequest">
+    <wsdl:part name="parameters" element="tns:getOrder"/>
+  </wsdl:message>
+  <wsdl:message name="getOrderResponse">
+    <wsdl:part name="parameters" element="tns:getOrderResponse"/>
+  </wsdl:message>
+
+  <wsdl:portType name="OrderPortType">
+    <wsdl:operation name="getOrder">
+      <wsdl:input message="tns:getOrderRequest"/>
+      <wsdl:output message="tns:getOrderResponse"/>
+    </wsdl:operation>
+  </wsdl:portType>
+
+  <wsdl:binding name="OrderSoapBinding" type="tns:OrderPortType">
+    <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="getOrder">
+      <soap:operation 
soapAction="http://camel.apache.org/wssec/orders/getOrder"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+
+  <wsdl:service name="OrderService">
+    <wsdl:port name="OrderPort" binding="tns:OrderSoapBinding">
+      <soap:address location="http://localhost:9000/orders"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CxfEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CxfEndpointBuilderFactory.java
index 69338eacaff4..a9af5e5c37d6 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CxfEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CxfEndpointBuilderFactory.java
@@ -309,6 +309,145 @@ public interface CxfEndpointBuilderFactory {
             doSetProperty("username", username);
             return this;
         }
+        /**
+         * To use a custom javax.security.auth.callback.CallbackHandler for the
+         * WS-Security UsernameToken. CXF calls it with an
+         * org.apache.wss4j.common.ext.WSPasswordCallback that names the user,
+         * and the handler sets the password of that user. The producer uses it
+         * instead of wsSecurityPassword. The consumer uses it to look up the
+         * password of any user, for example from a vault, instead of
+         * wsSecurityUsername, wsSecurityPassword and wsSecurityCredentials.
+         * 
+         * The option is a:
+         * <code>javax.security.auth.callback.CallbackHandler</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCallbackHandler the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointConsumerBuilder 
wsSecurityCallbackHandler(javax.security.auth.callback.CallbackHandler 
wsSecurityCallbackHandler) {
+            doSetProperty("wsSecurityCallbackHandler", 
wsSecurityCallbackHandler);
+            return this;
+        }
+        /**
+         * To use a custom javax.security.auth.callback.CallbackHandler for the
+         * WS-Security UsernameToken. CXF calls it with an
+         * org.apache.wss4j.common.ext.WSPasswordCallback that names the user,
+         * and the handler sets the password of that user. The producer uses it
+         * instead of wsSecurityPassword. The consumer uses it to look up the
+         * password of any user, for example from a vault, instead of
+         * wsSecurityUsername, wsSecurityPassword and wsSecurityCredentials.
+         * 
+         * The option will be converted to a
+         * <code>javax.security.auth.callback.CallbackHandler</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCallbackHandler the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointConsumerBuilder wsSecurityCallbackHandler(String 
wsSecurityCallbackHandler) {
+            doSetProperty("wsSecurityCallbackHandler", 
wsSecurityCallbackHandler);
+            return this;
+        }
+        /**
+         * A map of user name to password with the users that the consumer
+         * accepts in a WS-Security UsernameToken, as a reference to a
+         * java.util.Map bean, for example #bean:users. Used instead of
+         * wsSecurityUsername and wsSecurityPassword to accept more than one
+         * user without Java code. Not used when wsSecurityCallbackHandler is
+         * set. The producer does not use it.
+         * 
+         * The option is a: <code>java.util.Map&lt;java.lang.String,
+         * java.lang.String&gt;</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCredentials the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointConsumerBuilder 
wsSecurityCredentials(Map<java.lang.String, java.lang.String> 
wsSecurityCredentials) {
+            doSetProperty("wsSecurityCredentials", wsSecurityCredentials);
+            return this;
+        }
+        /**
+         * A map of user name to password with the users that the consumer
+         * accepts in a WS-Security UsernameToken, as a reference to a
+         * java.util.Map bean, for example #bean:users. Used instead of
+         * wsSecurityUsername and wsSecurityPassword to accept more than one
+         * user without Java code. Not used when wsSecurityCallbackHandler is
+         * set. The producer does not use it.
+         * 
+         * The option will be converted to a
+         * <code>java.util.Map&lt;java.lang.String, java.lang.String&gt;</code>
+         * type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCredentials the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointConsumerBuilder wsSecurityCredentials(String 
wsSecurityCredentials) {
+            doSetProperty("wsSecurityCredentials", wsSecurityCredentials);
+            return this;
+        }
+        /**
+         * The password of a WS-Security UsernameToken. The producer sends it 
in
+         * the UsernameToken, and the consumer requires it for the user of the
+         * wsSecurityUsername option.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityPassword the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointConsumerBuilder wsSecurityPassword(String 
wsSecurityPassword) {
+            doSetProperty("wsSecurityPassword", wsSecurityPassword);
+            return this;
+        }
+        /**
+         * The type of the password in a WS-Security UsernameToken: Text for
+         * PasswordText, or Digest for PasswordDigest. The producer sends this
+         * type, and the consumer requires it. Not used when the WSDL of the
+         * service has a WS-SecurityPolicy, which then decides the type. Digest
+         * is no replacement for HTTPS: it uses SHA-1, and the consumer needs
+         * the plain password.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Default: Text
+         * Group: security
+         * 
+         * @param wsSecurityPasswordType the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointConsumerBuilder wsSecurityPasswordType(String 
wsSecurityPasswordType) {
+            doSetProperty("wsSecurityPasswordType", wsSecurityPasswordType);
+            return this;
+        }
+        /**
+         * The user name of a WS-Security UsernameToken. The producer sends a
+         * UsernameToken with this user name in the SOAP header of its 
requests.
+         * The consumer accepts only this user, with the password of the
+         * wsSecurityPassword option, unless wsSecurityCallbackHandler or
+         * wsSecurityCredentials is set. Needs the
+         * org.apache.cxf:cxf-rt-ws-security dependency. Send a UsernameToken
+         * with a plain text password over HTTPS only.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityUsername the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointConsumerBuilder wsSecurityUsername(String 
wsSecurityUsername) {
+            doSetProperty("wsSecurityUsername", wsSecurityUsername);
+            return this;
+        }
         /**
          * The id of the CXF binding, which is a namespace URI, for example
          * http://cxf.apache.org/bindings/xformat for the XML binding without a
@@ -1443,6 +1582,145 @@ public interface CxfEndpointBuilderFactory {
             doSetProperty("username", username);
             return this;
         }
+        /**
+         * To use a custom javax.security.auth.callback.CallbackHandler for the
+         * WS-Security UsernameToken. CXF calls it with an
+         * org.apache.wss4j.common.ext.WSPasswordCallback that names the user,
+         * and the handler sets the password of that user. The producer uses it
+         * instead of wsSecurityPassword. The consumer uses it to look up the
+         * password of any user, for example from a vault, instead of
+         * wsSecurityUsername, wsSecurityPassword and wsSecurityCredentials.
+         * 
+         * The option is a:
+         * <code>javax.security.auth.callback.CallbackHandler</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCallbackHandler the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointProducerBuilder 
wsSecurityCallbackHandler(javax.security.auth.callback.CallbackHandler 
wsSecurityCallbackHandler) {
+            doSetProperty("wsSecurityCallbackHandler", 
wsSecurityCallbackHandler);
+            return this;
+        }
+        /**
+         * To use a custom javax.security.auth.callback.CallbackHandler for the
+         * WS-Security UsernameToken. CXF calls it with an
+         * org.apache.wss4j.common.ext.WSPasswordCallback that names the user,
+         * and the handler sets the password of that user. The producer uses it
+         * instead of wsSecurityPassword. The consumer uses it to look up the
+         * password of any user, for example from a vault, instead of
+         * wsSecurityUsername, wsSecurityPassword and wsSecurityCredentials.
+         * 
+         * The option will be converted to a
+         * <code>javax.security.auth.callback.CallbackHandler</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCallbackHandler the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointProducerBuilder wsSecurityCallbackHandler(String 
wsSecurityCallbackHandler) {
+            doSetProperty("wsSecurityCallbackHandler", 
wsSecurityCallbackHandler);
+            return this;
+        }
+        /**
+         * A map of user name to password with the users that the consumer
+         * accepts in a WS-Security UsernameToken, as a reference to a
+         * java.util.Map bean, for example #bean:users. Used instead of
+         * wsSecurityUsername and wsSecurityPassword to accept more than one
+         * user without Java code. Not used when wsSecurityCallbackHandler is
+         * set. The producer does not use it.
+         * 
+         * The option is a: <code>java.util.Map&lt;java.lang.String,
+         * java.lang.String&gt;</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCredentials the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointProducerBuilder 
wsSecurityCredentials(Map<java.lang.String, java.lang.String> 
wsSecurityCredentials) {
+            doSetProperty("wsSecurityCredentials", wsSecurityCredentials);
+            return this;
+        }
+        /**
+         * A map of user name to password with the users that the consumer
+         * accepts in a WS-Security UsernameToken, as a reference to a
+         * java.util.Map bean, for example #bean:users. Used instead of
+         * wsSecurityUsername and wsSecurityPassword to accept more than one
+         * user without Java code. Not used when wsSecurityCallbackHandler is
+         * set. The producer does not use it.
+         * 
+         * The option will be converted to a
+         * <code>java.util.Map&lt;java.lang.String, java.lang.String&gt;</code>
+         * type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCredentials the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointProducerBuilder wsSecurityCredentials(String 
wsSecurityCredentials) {
+            doSetProperty("wsSecurityCredentials", wsSecurityCredentials);
+            return this;
+        }
+        /**
+         * The password of a WS-Security UsernameToken. The producer sends it 
in
+         * the UsernameToken, and the consumer requires it for the user of the
+         * wsSecurityUsername option.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityPassword the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointProducerBuilder wsSecurityPassword(String 
wsSecurityPassword) {
+            doSetProperty("wsSecurityPassword", wsSecurityPassword);
+            return this;
+        }
+        /**
+         * The type of the password in a WS-Security UsernameToken: Text for
+         * PasswordText, or Digest for PasswordDigest. The producer sends this
+         * type, and the consumer requires it. Not used when the WSDL of the
+         * service has a WS-SecurityPolicy, which then decides the type. Digest
+         * is no replacement for HTTPS: it uses SHA-1, and the consumer needs
+         * the plain password.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Default: Text
+         * Group: security
+         * 
+         * @param wsSecurityPasswordType the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointProducerBuilder wsSecurityPasswordType(String 
wsSecurityPasswordType) {
+            doSetProperty("wsSecurityPasswordType", wsSecurityPasswordType);
+            return this;
+        }
+        /**
+         * The user name of a WS-Security UsernameToken. The producer sends a
+         * UsernameToken with this user name in the SOAP header of its 
requests.
+         * The consumer accepts only this user, with the password of the
+         * wsSecurityPassword option, unless wsSecurityCallbackHandler or
+         * wsSecurityCredentials is set. Needs the
+         * org.apache.cxf:cxf-rt-ws-security dependency. Send a UsernameToken
+         * with a plain text password over HTTPS only.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityUsername the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointProducerBuilder wsSecurityUsername(String 
wsSecurityUsername) {
+            doSetProperty("wsSecurityUsername", wsSecurityUsername);
+            return this;
+        }
         /**
          * The id of the CXF binding, which is a namespace URI, for example
          * http://cxf.apache.org/bindings/xformat for the XML binding without a
@@ -2353,6 +2631,145 @@ public interface CxfEndpointBuilderFactory {
             doSetProperty("username", username);
             return this;
         }
+        /**
+         * To use a custom javax.security.auth.callback.CallbackHandler for the
+         * WS-Security UsernameToken. CXF calls it with an
+         * org.apache.wss4j.common.ext.WSPasswordCallback that names the user,
+         * and the handler sets the password of that user. The producer uses it
+         * instead of wsSecurityPassword. The consumer uses it to look up the
+         * password of any user, for example from a vault, instead of
+         * wsSecurityUsername, wsSecurityPassword and wsSecurityCredentials.
+         * 
+         * The option is a:
+         * <code>javax.security.auth.callback.CallbackHandler</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCallbackHandler the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointBuilder 
wsSecurityCallbackHandler(javax.security.auth.callback.CallbackHandler 
wsSecurityCallbackHandler) {
+            doSetProperty("wsSecurityCallbackHandler", 
wsSecurityCallbackHandler);
+            return this;
+        }
+        /**
+         * To use a custom javax.security.auth.callback.CallbackHandler for the
+         * WS-Security UsernameToken. CXF calls it with an
+         * org.apache.wss4j.common.ext.WSPasswordCallback that names the user,
+         * and the handler sets the password of that user. The producer uses it
+         * instead of wsSecurityPassword. The consumer uses it to look up the
+         * password of any user, for example from a vault, instead of
+         * wsSecurityUsername, wsSecurityPassword and wsSecurityCredentials.
+         * 
+         * The option will be converted to a
+         * <code>javax.security.auth.callback.CallbackHandler</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCallbackHandler the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointBuilder wsSecurityCallbackHandler(String 
wsSecurityCallbackHandler) {
+            doSetProperty("wsSecurityCallbackHandler", 
wsSecurityCallbackHandler);
+            return this;
+        }
+        /**
+         * A map of user name to password with the users that the consumer
+         * accepts in a WS-Security UsernameToken, as a reference to a
+         * java.util.Map bean, for example #bean:users. Used instead of
+         * wsSecurityUsername and wsSecurityPassword to accept more than one
+         * user without Java code. Not used when wsSecurityCallbackHandler is
+         * set. The producer does not use it.
+         * 
+         * The option is a: <code>java.util.Map&lt;java.lang.String,
+         * java.lang.String&gt;</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCredentials the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointBuilder wsSecurityCredentials(Map<java.lang.String, 
java.lang.String> wsSecurityCredentials) {
+            doSetProperty("wsSecurityCredentials", wsSecurityCredentials);
+            return this;
+        }
+        /**
+         * A map of user name to password with the users that the consumer
+         * accepts in a WS-Security UsernameToken, as a reference to a
+         * java.util.Map bean, for example #bean:users. Used instead of
+         * wsSecurityUsername and wsSecurityPassword to accept more than one
+         * user without Java code. Not used when wsSecurityCallbackHandler is
+         * set. The producer does not use it.
+         * 
+         * The option will be converted to a
+         * <code>java.util.Map&lt;java.lang.String, java.lang.String&gt;</code>
+         * type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityCredentials the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointBuilder wsSecurityCredentials(String 
wsSecurityCredentials) {
+            doSetProperty("wsSecurityCredentials", wsSecurityCredentials);
+            return this;
+        }
+        /**
+         * The password of a WS-Security UsernameToken. The producer sends it 
in
+         * the UsernameToken, and the consumer requires it for the user of the
+         * wsSecurityUsername option.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityPassword the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointBuilder wsSecurityPassword(String 
wsSecurityPassword) {
+            doSetProperty("wsSecurityPassword", wsSecurityPassword);
+            return this;
+        }
+        /**
+         * The type of the password in a WS-Security UsernameToken: Text for
+         * PasswordText, or Digest for PasswordDigest. The producer sends this
+         * type, and the consumer requires it. Not used when the WSDL of the
+         * service has a WS-SecurityPolicy, which then decides the type. Digest
+         * is no replacement for HTTPS: it uses SHA-1, and the consumer needs
+         * the plain password.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Default: Text
+         * Group: security
+         * 
+         * @param wsSecurityPasswordType the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointBuilder wsSecurityPasswordType(String 
wsSecurityPasswordType) {
+            doSetProperty("wsSecurityPasswordType", wsSecurityPasswordType);
+            return this;
+        }
+        /**
+         * The user name of a WS-Security UsernameToken. The producer sends a
+         * UsernameToken with this user name in the SOAP header of its 
requests.
+         * The consumer accepts only this user, with the password of the
+         * wsSecurityPassword option, unless wsSecurityCallbackHandler or
+         * wsSecurityCredentials is set. Needs the
+         * org.apache.cxf:cxf-rt-ws-security dependency. Send a UsernameToken
+         * with a plain text password over HTTPS only.
+         * 
+         * The option is a: <code>java.lang.String</code> type.
+         * 
+         * Group: security
+         * 
+         * @param wsSecurityUsername the value to set
+         * @return the dsl builder
+         */
+        default CxfEndpointBuilder wsSecurityUsername(String 
wsSecurityUsername) {
+            doSetProperty("wsSecurityUsername", wsSecurityUsername);
+            return this;
+        }
         /**
          * The id of the CXF binding, which is a namespace URI, for example
          * http://cxf.apache.org/bindings/xformat for the XML binding without a

Reply via email to