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

davsclaus pushed a commit to branch CAMEL-27707-ssh-header-credentials
in repository https://gitbox.apache.org/repos/asf/camel.git

commit c959ad134bfa747879b02957042a3803560ac335
Author: Claus Ibsen <[email protected]>
AuthorDate: Fri Nov 27 17:29:56 2026 +0100

    CAMEL-27707: camel-ssh - the user name and password headers are used only 
when allowUsernameAndPasswordFromHeaders is enabled
    
    The producer took the user name from the CamelSshUsername header for every
    kind of authentication, so with certResource or keyPairProvider the
    configured key logged in as the user that the header named, and the
    CamelSshPassword header replaced the configured password. It now logs in
    with the username and password of the endpoint, unless the new
    allowUsernameAndPasswordFromHeaders option (default false) is enabled.
    
    The authentication failure message now names the user that was used, and
    the two headers have the producer label.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
    Signed-off-by: Claus Ibsen <[email protected]>
---
 .../org/apache/camel/catalog/components/ssh.json   |  54 ++++----
 .../apache/camel/catalog/docs/ssh-component.adoc   |  78 ++++++++++-
 .../component/ssh/SshComponentConfigurer.java      |   6 +
 .../camel/component/ssh/SshEndpointConfigurer.java |   6 +
 .../camel/component/ssh/SshEndpointUriFactory.java |   3 +-
 .../org/apache/camel/component/ssh/ssh.json        |  54 ++++----
 .../camel-ssh/src/main/docs/ssh-component.adoc     |  78 ++++++++++-
 .../camel/component/ssh/SshConfiguration.java      |  22 ++-
 .../apache/camel/component/ssh/SshConstants.java   |  14 +-
 .../apache/camel/component/ssh/SshEndpoint.java    |   8 ++
 .../org/apache/camel/component/ssh/SshHelper.java  |  14 +-
 .../component/ssh/SshComponentProducerTest.java    |   2 +-
 .../component/ssh/SshHeaderCredentialsTest.java    | 147 +++++++++++++++++++++
 .../component/ssh/SshProducerExitCodeTest.java     |   4 +-
 .../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc    |  10 ++
 .../component/dsl/SshComponentBuilderFactory.java  |  34 ++++-
 .../endpoint/dsl/SshEndpointBuilderFactory.java    |  86 +++++++++---
 17 files changed, 519 insertions(+), 101 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ssh.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ssh.json
index 377e0dd70a6d..e76a6683a16a 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ssh.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/ssh.json
@@ -44,22 +44,23 @@
     "sleepForShellPrompt": { "index": 16, "kind": "property", "displayName": 
"Sleep For Shell Prompt", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": 100, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The time in milliseconds between two reads of 
the shell output while the component [...]
     "healthCheckConsumerEnabled": { "index": 17, "kind": "property", 
"displayName": "Health Check Consumer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all consumer based health checks 
from this component" },
     "healthCheckProducerEnabled": { "index": 18, "kind": "property", 
"displayName": "Health Check Producer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all producer based health checks 
from this component. Notice: Camel has by default disabled all producer based 
health-checks. You can turn on produce [...]
-    "certResource": { "index": 19, "kind": "property", "displayName": "Cert 
Resource", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The resource with the private key for public 
key authentication, in OpenSSH or PEM format, for example class [...]
-    "certResourcePassword": { "index": 20, "kind": "property", "displayName": 
"Cert Resource Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The passphrase of the private key in 
certResource, when that key is en [...]
-    "ciphers": { "index": 21, "kind": "property", "displayName": "Ciphers", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the ciphers that the 
client proposes, in order of preference, for example aes256-ctr,aes128-c [...]
-    "failOnUnknownHost": { "index": 22, "kind": "property", "displayName": 
"Fail On Unknown Host", "group": "security", "label": "security", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"insecureValue": "false", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether to reject a server  [...]
-    "kex": { "index": 23, "kind": "property", "displayName": "Kex", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the key exchange 
algorithms that the client proposes, in order of preference, for example 
mlkem768x25 [...]
-    "keyPairProvider": { "index": 24, "kind": "property", "displayName": "Key 
Pair Provider", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": 
"org.apache.sshd.common.keyprovider.KeyPairProvider", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The 
org.apache.sshd.common.keyprovider.KeyPairProvider that gives t [...]
-    "keyType": { "index": 25, "kind": "property", "displayName": "Key Type", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The key type of the key pair to use from 
certResource or keyPairProvider, for example ssh-rsa, ssh-ed25519 or ecdsa-sh 
[...]
-    "knownHostsResource": { "index": 26, "kind": "property", "displayName": 
"Known Hosts Resource", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration", 
"configurationField": "configuration", "description": "The resource of a file 
in the OpenSSH known_hosts format, such as f [...]
-    "macs": { "index": 27, "kind": "property", "displayName": "Macs", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the message 
authentication code (MAC) algorithms that the client proposes, in order of 
preference,  [...]
-    "password": { "index": 28, "kind": "property", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The password for password authentication, 
which is used only when neither certResource nor keyPa [...]
-    "signatures": { "index": 29, "kind": "property", "displayName": 
"Signatures", "group": "security", "label": "security", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the signature 
algorithms that the client supports, in order of preference, for example  [...]
-    "username": { "index": 30, "kind": "property", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The user name to log in with. The 
CamelSshUsername header replaces it for the producer." }
+    "allowUsernameAndPasswordFromHeaders": { "index": 19, "kind": "property", 
"displayName": "Allow Username And Password From Headers", "group": "security", 
"label": "producer,security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether the producer may take the  [...]
+    "certResource": { "index": 20, "kind": "property", "displayName": "Cert 
Resource", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The resource with the private key for public 
key authentication, in OpenSSH or PEM format, for example class [...]
+    "certResourcePassword": { "index": 21, "kind": "property", "displayName": 
"Cert Resource Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The passphrase of the private key in 
certResource, when that key is en [...]
+    "ciphers": { "index": 22, "kind": "property", "displayName": "Ciphers", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the ciphers that the 
client proposes, in order of preference, for example aes256-ctr,aes128-c [...]
+    "failOnUnknownHost": { "index": 23, "kind": "property", "displayName": 
"Fail On Unknown Host", "group": "security", "label": "security", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"insecureValue": "false", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether to reject a server  [...]
+    "kex": { "index": 24, "kind": "property", "displayName": "Kex", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the key exchange 
algorithms that the client proposes, in order of preference, for example 
mlkem768x25 [...]
+    "keyPairProvider": { "index": 25, "kind": "property", "displayName": "Key 
Pair Provider", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": 
"org.apache.sshd.common.keyprovider.KeyPairProvider", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The 
org.apache.sshd.common.keyprovider.KeyPairProvider that gives t [...]
+    "keyType": { "index": 26, "kind": "property", "displayName": "Key Type", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The key type of the key pair to use from 
certResource or keyPairProvider, for example ssh-rsa, ssh-ed25519 or ecdsa-sh 
[...]
+    "knownHostsResource": { "index": 27, "kind": "property", "displayName": 
"Known Hosts Resource", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration", 
"configurationField": "configuration", "description": "The resource of a file 
in the OpenSSH known_hosts format, such as f [...]
+    "macs": { "index": 28, "kind": "property", "displayName": "Macs", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the message 
authentication code (MAC) algorithms that the client proposes, in order of 
preference,  [...]
+    "password": { "index": 29, "kind": "property", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The password for password authentication, 
which is used only when neither certResource nor keyPa [...]
+    "signatures": { "index": 30, "kind": "property", "displayName": 
"Signatures", "group": "security", "label": "security", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the signature 
algorithms that the client supports, in order of preference, for example  [...]
+    "username": { "index": 31, "kind": "property", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The user name to log in with. With 
allowUsernameAndPasswordFromHeaders=true, the CamelSshUsernam [...]
   },
   "headers": {
-    "CamelSshUsername": { "index": 0, "kind": "header", "displayName": "", 
"group": "common", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
user name that the producer logs in with, instead of the username option.", 
"constantName": "org.apache.camel.component.ssh.SshConstants#USERNAME_HEADER" },
-    "CamelSshPassword": { "index": 1, "kind": "header", "displayName": "", 
"group": "common", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
password that the producer uses for password authentication, instead of the 
password option. It is not used when certResource or keyPairProvider is set.", 
"constantName": "org.apache.camel.component.ssh.SshConstants#PASSWORD_HEADER" },
+    "CamelSshUsername": { "index": 0, "kind": "header", "displayName": "", 
"group": "producer", "label": "producer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The user name that the producer logs in with, instead of the 
username option. Used only when allowUsernameAndPasswordFromHeaders=true; 
otherwise ignored. It applies to every kind of authentication: with 
certResource or keyPairProvider, the configured key logs  [...]
+    "CamelSshPassword": { "index": 1, "kind": "header", "displayName": "", 
"group": "producer", "label": "producer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": true, 
"description": "The password that the producer uses for password 
authentication, instead of the password option. Used only when 
allowUsernameAndPasswordFromHeaders=true; otherwise ignored. It is not used 
when certResource or keyPairProvider is set.", "constantName": "org.apach [...]
     "CamelSshStderr": { "index": 2, "kind": "header", "displayName": "", 
"group": "common", "label": "", "required": false, "javaType": "InputStream", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
standard error of the command, as an InputStream.", "constantName": 
"org.apache.camel.component.ssh.SshConstants#STDERR" },
     "CamelSshExitValue": { "index": 3, "kind": "header", "displayName": "", 
"group": "common", "label": "", "required": false, "javaType": "Integer", 
"deprecated": false, "autowired": false, "secret": false, "important": true, 
"description": "The exit status of the command. By convention, a value other 
than 0 means that the command failed, but the exchange does not fail for it. 
With channelType=shell it is usually null, as the shell is still running when 
the output is read.", "constantNa [...]
   },
@@ -105,17 +106,18 @@
     "startScheduler": { "index": 33, "kind": "parameter", "displayName": 
"Start Scheduler", "group": "scheduler", "label": "consumer,scheduler", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Whether the scheduler should be auto started." },
     "timeUnit": { "index": 34, "kind": "parameter", "displayName": "Time 
Unit", "group": "scheduler", "label": "consumer,scheduler", "required": false, 
"type": "enum", "javaType": "java.util.concurrent.TimeUnit", "enum": [ 
"NANOSECONDS", "MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", 
"DAYS" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "MILLISECONDS", "description": "Time unit for initialDelay and 
delay options." },
     "useFixedDelay": { "index": 35, "kind": "parameter", "displayName": "Use 
Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in 
JDK for details." },
-    "certResource": { "index": 36, "kind": "parameter", "displayName": "Cert 
Resource", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The resource with the private key for public 
key authentication, in OpenSSH or PEM format, for example clas [...]
-    "certResourcePassword": { "index": 37, "kind": "parameter", "displayName": 
"Cert Resource Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The passphrase of the private key in 
certResource, when that key is e [...]
-    "ciphers": { "index": 38, "kind": "parameter", "displayName": "Ciphers", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the ciphers that the 
client proposes, in order of preference, for example aes256-ctr,aes128- [...]
-    "failOnUnknownHost": { "index": 39, "kind": "parameter", "displayName": 
"Fail On Unknown Host", "group": "security", "label": "security", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"insecureValue": "false", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether to reject a server [...]
-    "kex": { "index": 40, "kind": "parameter", "displayName": "Kex", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the key exchange 
algorithms that the client proposes, in order of preference, for example 
mlkem768x2 [...]
-    "keyPairProvider": { "index": 41, "kind": "parameter", "displayName": "Key 
Pair Provider", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": 
"org.apache.sshd.common.keyprovider.KeyPairProvider", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The 
org.apache.sshd.common.keyprovider.KeyPairProvider that gives  [...]
-    "keyType": { "index": 42, "kind": "parameter", "displayName": "Key Type", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The key type of the key pair to use from 
certResource or keyPairProvider, for example ssh-rsa, ssh-ed25519 or ecdsa-s 
[...]
-    "knownHostsResource": { "index": 43, "kind": "parameter", "displayName": 
"Known Hosts Resource", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration", 
"configurationField": "configuration", "description": "The resource of a file 
in the OpenSSH known_hosts format, such as  [...]
-    "macs": { "index": 44, "kind": "parameter", "displayName": "Macs", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the message 
authentication code (MAC) algorithms that the client proposes, in order of 
preference, [...]
-    "password": { "index": 45, "kind": "parameter", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The password for password authentication, 
which is used only when neither certResource nor keyP [...]
-    "signatures": { "index": 46, "kind": "parameter", "displayName": 
"Signatures", "group": "security", "label": "security", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the signature 
algorithms that the client supports, in order of preference, for example [...]
-    "username": { "index": 47, "kind": "parameter", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The user name to log in with. The 
CamelSshUsername header replaces it for the producer." }
+    "allowUsernameAndPasswordFromHeaders": { "index": 36, "kind": "parameter", 
"displayName": "Allow Username And Password From Headers", "group": "security", 
"label": "producer,security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether the producer may take the [...]
+    "certResource": { "index": 37, "kind": "parameter", "displayName": "Cert 
Resource", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The resource with the private key for public 
key authentication, in OpenSSH or PEM format, for example clas [...]
+    "certResourcePassword": { "index": 38, "kind": "parameter", "displayName": 
"Cert Resource Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The passphrase of the private key in 
certResource, when that key is e [...]
+    "ciphers": { "index": 39, "kind": "parameter", "displayName": "Ciphers", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the ciphers that the 
client proposes, in order of preference, for example aes256-ctr,aes128- [...]
+    "failOnUnknownHost": { "index": 40, "kind": "parameter", "displayName": 
"Fail On Unknown Host", "group": "security", "label": "security", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"insecureValue": "false", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether to reject a server [...]
+    "kex": { "index": 41, "kind": "parameter", "displayName": "Kex", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the key exchange 
algorithms that the client proposes, in order of preference, for example 
mlkem768x2 [...]
+    "keyPairProvider": { "index": 42, "kind": "parameter", "displayName": "Key 
Pair Provider", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": 
"org.apache.sshd.common.keyprovider.KeyPairProvider", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The 
org.apache.sshd.common.keyprovider.KeyPairProvider that gives  [...]
+    "keyType": { "index": 43, "kind": "parameter", "displayName": "Key Type", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The key type of the key pair to use from 
certResource or keyPairProvider, for example ssh-rsa, ssh-ed25519 or ecdsa-s 
[...]
+    "knownHostsResource": { "index": 44, "kind": "parameter", "displayName": 
"Known Hosts Resource", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration", 
"configurationField": "configuration", "description": "The resource of a file 
in the OpenSSH known_hosts format, such as  [...]
+    "macs": { "index": 45, "kind": "parameter", "displayName": "Macs", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the message 
authentication code (MAC) algorithms that the client proposes, in order of 
preference, [...]
+    "password": { "index": 46, "kind": "parameter", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The password for password authentication, 
which is used only when neither certResource nor keyP [...]
+    "signatures": { "index": 47, "kind": "parameter", "displayName": 
"Signatures", "group": "security", "label": "security", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the signature 
algorithms that the client supports, in order of preference, for example [...]
+    "username": { "index": 48, "kind": "parameter", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The user name to log in with. With 
allowUsernameAndPasswordFromHeaders=true, the CamelSshUserna [...]
   }
 }
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ssh-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ssh-component.adoc
index 52e5aae9d87c..9ce460648b2f 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ssh-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/ssh-component.adoc
@@ -125,11 +125,10 @@ and use that for authentication.
 `keyPairProvider` has been set, and if so, it will use that for
 certificate-based authentication.
 3.  If neither `certResource` nor `keyPairProvider` are set, it will use
-the `username` and `password` options for authentication. Even though the 
`username` 
-and `password` are provided in the endpoint configuration and headers set with 
-`CamelSshUsername` and
-`CamelSshPassword`, the endpoint 
-configuration is surpassed and credentials set in the headers are used.
+the `username` and `password` options for authentication.
+
+In all three cases, the client logs in as the user of the `username` option, 
unless the producer takes the user from
+a header (see below).
 
 The following route fragment shows an SSH polling consumer using a
 certificate from the classpath.
@@ -175,6 +174,75 @@ YAML::
 An example of using Public Key authentication is provided in
 `examples/camel-example-ssh-security`.
 
+==== User name and password from headers
+
+The producer can log in with a user name and password chosen by the route, 
from the `CamelSshUsername` and
+`CamelSshPassword` headers, when the `allowUsernameAndPasswordFromHeaders` 
option is enabled. Without this option
+(the default), these headers are ignored, and the producer logs in with the 
`username` and `password` options.
+
+With the option enabled:
+
+* The `CamelSshUsername` header replaces the `username` option for every kind 
of authentication. With `certResource`
+or `keyPairProvider` set, the configured key logs in as the user that the 
header names.
+* The `CamelSshPassword` header replaces the `password` option. It is used 
only for password authentication, so not
+when `certResource` or `keyPairProvider` is set.
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("direct:status")
+    .setHeader("CamelSshUsername", constant("scott"))
+    .setHeader("CamelSshPassword", constant("{{scott.password}}"))
+    .to("ssh://db.example.com?allowUsernameAndPasswordFromHeaders=true");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+  <from uri="direct:status"/>
+  <setHeader name="CamelSshUsername">
+    <constant>scott</constant>
+  </setHeader>
+  <setHeader name="CamelSshPassword">
+    <constant>{{scott.password}}</constant>
+  </setHeader>
+  <to uri="ssh://db.example.com?allowUsernameAndPasswordFromHeaders=true"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+    from:
+      uri: direct:status
+      steps:
+        - setHeader:
+            name: CamelSshUsername
+            expression:
+              constant:
+                expression: scott
+        - setHeader:
+            name: CamelSshPassword
+            expression:
+              constant:
+                expression: "{{scott.password}}"
+        - to:
+            uri: ssh://db.example.com
+            parameters:
+              allowUsernameAndPasswordFromHeaders: true
+----
+====
+
+Enable `allowUsernameAndPasswordFromHeaders` only when the route sets these 
headers itself, and remove them from
+messages that come from elsewhere, for example with 
`removeHeaders("CamelSsh*")` after an HTTP or JMS consumer.
+
 === Server host key verification
 
 The SSH Component verifies the host key of the SSH server only when the 
`knownHostsResource` option
diff --git 
a/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshComponentConfigurer.java
 
b/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshComponentConfigurer.java
index c947c1132058..aac4700ebf0e 100644
--- 
a/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshComponentConfigurer.java
+++ 
b/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshComponentConfigurer.java
@@ -31,6 +31,8 @@ public class SshComponentConfigurer extends 
PropertyConfigurerSupport implements
     public boolean configure(CamelContext camelContext, Object obj, String 
name, Object value, boolean ignoreCase) {
         SshComponent target = (SshComponent) obj;
         switch (ignoreCase ? name.toLowerCase(Locale.ROOT) : name) {
+        case "allowusernameandpasswordfromheaders":
+        case "allowUsernameAndPasswordFromHeaders": 
getOrCreateConfiguration(target).setAllowUsernameAndPasswordFromHeaders(property(camelContext,
 boolean.class, value)); return true;
         case "authtimeout":
         case "authTimeout": 
getOrCreateConfiguration(target).setAuthTimeout(property(camelContext, 
long.class, value)); return true;
         case "autowiredenabled":
@@ -96,6 +98,8 @@ public class SshComponentConfigurer extends 
PropertyConfigurerSupport implements
     @Override
     public Class<?> getOptionType(String name, boolean ignoreCase) {
         switch (ignoreCase ? name.toLowerCase(Locale.ROOT) : name) {
+        case "allowusernameandpasswordfromheaders":
+        case "allowUsernameAndPasswordFromHeaders": return boolean.class;
         case "authtimeout":
         case "authTimeout": return long.class;
         case "autowiredenabled":
@@ -157,6 +161,8 @@ public class SshComponentConfigurer extends 
PropertyConfigurerSupport implements
     public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
         SshComponent target = (SshComponent) obj;
         switch (ignoreCase ? name.toLowerCase(Locale.ROOT) : name) {
+        case "allowusernameandpasswordfromheaders":
+        case "allowUsernameAndPasswordFromHeaders": return 
getOrCreateConfiguration(target).isAllowUsernameAndPasswordFromHeaders();
         case "authtimeout":
         case "authTimeout": return 
getOrCreateConfiguration(target).getAuthTimeout();
         case "autowiredenabled":
diff --git 
a/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshEndpointConfigurer.java
 
b/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshEndpointConfigurer.java
index 6242ae3002ab..bc02d7aa8d6b 100644
--- 
a/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshEndpointConfigurer.java
+++ 
b/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshEndpointConfigurer.java
@@ -24,6 +24,8 @@ public class SshEndpointConfigurer extends 
PropertyConfigurerSupport implements
     public boolean configure(CamelContext camelContext, Object obj, String 
name, Object value, boolean ignoreCase) {
         SshEndpoint target = (SshEndpoint) obj;
         switch (ignoreCase ? name.toLowerCase(Locale.ROOT) : name) {
+        case "allowusernameandpasswordfromheaders":
+        case "allowUsernameAndPasswordFromHeaders": 
target.getConfiguration().setAllowUsernameAndPasswordFromHeaders(property(camelContext,
 boolean.class, value)); return true;
         case "authtimeout":
         case "authTimeout": 
target.getConfiguration().setAuthTimeout(property(camelContext, long.class, 
value)); return true;
         case "backofferrorthreshold":
@@ -117,6 +119,8 @@ public class SshEndpointConfigurer extends 
PropertyConfigurerSupport implements
     @Override
     public Class<?> getOptionType(String name, boolean ignoreCase) {
         switch (ignoreCase ? name.toLowerCase(Locale.ROOT) : name) {
+        case "allowusernameandpasswordfromheaders":
+        case "allowUsernameAndPasswordFromHeaders": return boolean.class;
         case "authtimeout":
         case "authTimeout": return long.class;
         case "backofferrorthreshold":
@@ -206,6 +210,8 @@ public class SshEndpointConfigurer extends 
PropertyConfigurerSupport implements
     public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
         SshEndpoint target = (SshEndpoint) obj;
         switch (ignoreCase ? name.toLowerCase(Locale.ROOT) : name) {
+        case "allowusernameandpasswordfromheaders":
+        case "allowUsernameAndPasswordFromHeaders": return 
target.getConfiguration().isAllowUsernameAndPasswordFromHeaders();
         case "authtimeout":
         case "authTimeout": return target.getConfiguration().getAuthTimeout();
         case "backofferrorthreshold":
diff --git 
a/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshEndpointUriFactory.java
 
b/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshEndpointUriFactory.java
index 99c46bd9b80f..c7cd32a06fab 100644
--- 
a/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshEndpointUriFactory.java
+++ 
b/components/camel-ssh/src/generated/java/org/apache/camel/component/ssh/SshEndpointUriFactory.java
@@ -24,7 +24,8 @@ public class SshEndpointUriFactory 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<>(48);
+        Set<String> props = new HashSet<>(49);
+        props.add("allowUsernameAndPasswordFromHeaders");
         props.add("authTimeout");
         props.add("backoffErrorThreshold");
         props.add("backoffIdleThreshold");
diff --git 
a/components/camel-ssh/src/generated/resources/META-INF/org/apache/camel/component/ssh/ssh.json
 
b/components/camel-ssh/src/generated/resources/META-INF/org/apache/camel/component/ssh/ssh.json
index 377e0dd70a6d..e76a6683a16a 100644
--- 
a/components/camel-ssh/src/generated/resources/META-INF/org/apache/camel/component/ssh/ssh.json
+++ 
b/components/camel-ssh/src/generated/resources/META-INF/org/apache/camel/component/ssh/ssh.json
@@ -44,22 +44,23 @@
     "sleepForShellPrompt": { "index": 16, "kind": "property", "displayName": 
"Sleep For Shell Prompt", "group": "advanced", "label": "advanced", "required": 
false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": 
false, "secret": false, "defaultValue": 100, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The time in milliseconds between two reads of 
the shell output while the component [...]
     "healthCheckConsumerEnabled": { "index": 17, "kind": "property", 
"displayName": "Health Check Consumer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all consumer based health checks 
from this component" },
     "healthCheckProducerEnabled": { "index": 18, "kind": "property", 
"displayName": "Health Check Producer Enabled", "group": "health", "label": 
"health", "required": false, "type": "boolean", "javaType": "boolean", 
"deprecated": false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Used for enabling or disabling all producer based health checks 
from this component. Notice: Camel has by default disabled all producer based 
health-checks. You can turn on produce [...]
-    "certResource": { "index": 19, "kind": "property", "displayName": "Cert 
Resource", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The resource with the private key for public 
key authentication, in OpenSSH or PEM format, for example class [...]
-    "certResourcePassword": { "index": 20, "kind": "property", "displayName": 
"Cert Resource Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The passphrase of the private key in 
certResource, when that key is en [...]
-    "ciphers": { "index": 21, "kind": "property", "displayName": "Ciphers", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the ciphers that the 
client proposes, in order of preference, for example aes256-ctr,aes128-c [...]
-    "failOnUnknownHost": { "index": 22, "kind": "property", "displayName": 
"Fail On Unknown Host", "group": "security", "label": "security", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"insecureValue": "false", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether to reject a server  [...]
-    "kex": { "index": 23, "kind": "property", "displayName": "Kex", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the key exchange 
algorithms that the client proposes, in order of preference, for example 
mlkem768x25 [...]
-    "keyPairProvider": { "index": 24, "kind": "property", "displayName": "Key 
Pair Provider", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": 
"org.apache.sshd.common.keyprovider.KeyPairProvider", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The 
org.apache.sshd.common.keyprovider.KeyPairProvider that gives t [...]
-    "keyType": { "index": 25, "kind": "property", "displayName": "Key Type", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The key type of the key pair to use from 
certResource or keyPairProvider, for example ssh-rsa, ssh-ed25519 or ecdsa-sh 
[...]
-    "knownHostsResource": { "index": 26, "kind": "property", "displayName": 
"Known Hosts Resource", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration", 
"configurationField": "configuration", "description": "The resource of a file 
in the OpenSSH known_hosts format, such as f [...]
-    "macs": { "index": 27, "kind": "property", "displayName": "Macs", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the message 
authentication code (MAC) algorithms that the client proposes, in order of 
preference,  [...]
-    "password": { "index": 28, "kind": "property", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The password for password authentication, 
which is used only when neither certResource nor keyPa [...]
-    "signatures": { "index": 29, "kind": "property", "displayName": 
"Signatures", "group": "security", "label": "security", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the signature 
algorithms that the client supports, in order of preference, for example  [...]
-    "username": { "index": 30, "kind": "property", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The user name to log in with. The 
CamelSshUsername header replaces it for the producer." }
+    "allowUsernameAndPasswordFromHeaders": { "index": 19, "kind": "property", 
"displayName": "Allow Username And Password From Headers", "group": "security", 
"label": "producer,security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether the producer may take the  [...]
+    "certResource": { "index": 20, "kind": "property", "displayName": "Cert 
Resource", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The resource with the private key for public 
key authentication, in OpenSSH or PEM format, for example class [...]
+    "certResourcePassword": { "index": 21, "kind": "property", "displayName": 
"Cert Resource Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The passphrase of the private key in 
certResource, when that key is en [...]
+    "ciphers": { "index": 22, "kind": "property", "displayName": "Ciphers", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the ciphers that the 
client proposes, in order of preference, for example aes256-ctr,aes128-c [...]
+    "failOnUnknownHost": { "index": 23, "kind": "property", "displayName": 
"Fail On Unknown Host", "group": "security", "label": "security", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"insecureValue": "false", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether to reject a server  [...]
+    "kex": { "index": 24, "kind": "property", "displayName": "Kex", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the key exchange 
algorithms that the client proposes, in order of preference, for example 
mlkem768x25 [...]
+    "keyPairProvider": { "index": 25, "kind": "property", "displayName": "Key 
Pair Provider", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": 
"org.apache.sshd.common.keyprovider.KeyPairProvider", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The 
org.apache.sshd.common.keyprovider.KeyPairProvider that gives t [...]
+    "keyType": { "index": 26, "kind": "property", "displayName": "Key Type", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The key type of the key pair to use from 
certResource or keyPairProvider, for example ssh-rsa, ssh-ed25519 or ecdsa-sh 
[...]
+    "knownHostsResource": { "index": 27, "kind": "property", "displayName": 
"Known Hosts Resource", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration", 
"configurationField": "configuration", "description": "The resource of a file 
in the OpenSSH known_hosts format, such as f [...]
+    "macs": { "index": 28, "kind": "property", "displayName": "Macs", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the message 
authentication code (MAC) algorithms that the client proposes, in order of 
preference,  [...]
+    "password": { "index": 29, "kind": "property", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The password for password authentication, 
which is used only when neither certResource nor keyPa [...]
+    "signatures": { "index": 30, "kind": "property", "displayName": 
"Signatures", "group": "security", "label": "security", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the signature 
algorithms that the client supports, in order of preference, for example  [...]
+    "username": { "index": 31, "kind": "property", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The user name to log in with. With 
allowUsernameAndPasswordFromHeaders=true, the CamelSshUsernam [...]
   },
   "headers": {
-    "CamelSshUsername": { "index": 0, "kind": "header", "displayName": "", 
"group": "common", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
user name that the producer logs in with, instead of the username option.", 
"constantName": "org.apache.camel.component.ssh.SshConstants#USERNAME_HEADER" },
-    "CamelSshPassword": { "index": 1, "kind": "header", "displayName": "", 
"group": "common", "label": "", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
password that the producer uses for password authentication, instead of the 
password option. It is not used when certResource or keyPairProvider is set.", 
"constantName": "org.apache.camel.component.ssh.SshConstants#PASSWORD_HEADER" },
+    "CamelSshUsername": { "index": 0, "kind": "header", "displayName": "", 
"group": "producer", "label": "producer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The user name that the producer logs in with, instead of the 
username option. Used only when allowUsernameAndPasswordFromHeaders=true; 
otherwise ignored. It applies to every kind of authentication: with 
certResource or keyPairProvider, the configured key logs  [...]
+    "CamelSshPassword": { "index": 1, "kind": "header", "displayName": "", 
"group": "producer", "label": "producer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": true, 
"description": "The password that the producer uses for password 
authentication, instead of the password option. Used only when 
allowUsernameAndPasswordFromHeaders=true; otherwise ignored. It is not used 
when certResource or keyPairProvider is set.", "constantName": "org.apach [...]
     "CamelSshStderr": { "index": 2, "kind": "header", "displayName": "", 
"group": "common", "label": "", "required": false, "javaType": "InputStream", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
standard error of the command, as an InputStream.", "constantName": 
"org.apache.camel.component.ssh.SshConstants#STDERR" },
     "CamelSshExitValue": { "index": 3, "kind": "header", "displayName": "", 
"group": "common", "label": "", "required": false, "javaType": "Integer", 
"deprecated": false, "autowired": false, "secret": false, "important": true, 
"description": "The exit status of the command. By convention, a value other 
than 0 means that the command failed, but the exchange does not fail for it. 
With channelType=shell it is usually null, as the shell is still running when 
the output is read.", "constantNa [...]
   },
@@ -105,17 +106,18 @@
     "startScheduler": { "index": 33, "kind": "parameter", "displayName": 
"Start Scheduler", "group": "scheduler", "label": "consumer,scheduler", 
"required": false, "type": "boolean", "javaType": "boolean", "deprecated": 
false, "autowired": false, "secret": false, "defaultValue": true, 
"description": "Whether the scheduler should be auto started." },
     "timeUnit": { "index": 34, "kind": "parameter", "displayName": "Time 
Unit", "group": "scheduler", "label": "consumer,scheduler", "required": false, 
"type": "enum", "javaType": "java.util.concurrent.TimeUnit", "enum": [ 
"NANOSECONDS", "MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", 
"DAYS" ], "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": "MILLISECONDS", "description": "Time unit for initialDelay and 
delay options." },
     "useFixedDelay": { "index": 35, "kind": "parameter", "displayName": "Use 
Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "defaultValue": true, "description": 
"Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in 
JDK for details." },
-    "certResource": { "index": 36, "kind": "parameter", "displayName": "Cert 
Resource", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The resource with the private key for public 
key authentication, in OpenSSH or PEM format, for example clas [...]
-    "certResourcePassword": { "index": 37, "kind": "parameter", "displayName": 
"Cert Resource Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The passphrase of the private key in 
certResource, when that key is e [...]
-    "ciphers": { "index": 38, "kind": "parameter", "displayName": "Ciphers", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the ciphers that the 
client proposes, in order of preference, for example aes256-ctr,aes128- [...]
-    "failOnUnknownHost": { "index": 39, "kind": "parameter", "displayName": 
"Fail On Unknown Host", "group": "security", "label": "security", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"insecureValue": "false", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether to reject a server [...]
-    "kex": { "index": 40, "kind": "parameter", "displayName": "Kex", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the key exchange 
algorithms that the client proposes, in order of preference, for example 
mlkem768x2 [...]
-    "keyPairProvider": { "index": 41, "kind": "parameter", "displayName": "Key 
Pair Provider", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": 
"org.apache.sshd.common.keyprovider.KeyPairProvider", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The 
org.apache.sshd.common.keyprovider.KeyPairProvider that gives  [...]
-    "keyType": { "index": 42, "kind": "parameter", "displayName": "Key Type", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The key type of the key pair to use from 
certResource or keyPairProvider, for example ssh-rsa, ssh-ed25519 or ecdsa-s 
[...]
-    "knownHostsResource": { "index": 43, "kind": "parameter", "displayName": 
"Known Hosts Resource", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration", 
"configurationField": "configuration", "description": "The resource of a file 
in the OpenSSH known_hosts format, such as  [...]
-    "macs": { "index": 44, "kind": "parameter", "displayName": "Macs", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the message 
authentication code (MAC) algorithms that the client proposes, in order of 
preference, [...]
-    "password": { "index": 45, "kind": "parameter", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The password for password authentication, 
which is used only when neither certResource nor keyP [...]
-    "signatures": { "index": 46, "kind": "parameter", "displayName": 
"Signatures", "group": "security", "label": "security", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the signature 
algorithms that the client supports, in order of preference, for example [...]
-    "username": { "index": 47, "kind": "parameter", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The user name to log in with. The 
CamelSshUsername header replaces it for the producer." }
+    "allowUsernameAndPasswordFromHeaders": { "index": 36, "kind": "parameter", 
"displayName": "Allow Username And Password From Headers", "group": "security", 
"label": "producer,security", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether the producer may take the [...]
+    "certResource": { "index": 37, "kind": "parameter", "displayName": "Cert 
Resource", "group": "security", "label": "security", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The resource with the private key for public 
key authentication, in OpenSSH or PEM format, for example clas [...]
+    "certResourcePassword": { "index": 38, "kind": "parameter", "displayName": 
"Cert Resource Password", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The passphrase of the private key in 
certResource, when that key is e [...]
+    "ciphers": { "index": 39, "kind": "parameter", "displayName": "Ciphers", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the ciphers that the 
client proposes, in order of preference, for example aes256-ctr,aes128- [...]
+    "failOnUnknownHost": { "index": 40, "kind": "parameter", "displayName": 
"Fail On Unknown Host", "group": "security", "label": "security", "required": 
false, "type": "boolean", "javaType": "boolean", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"insecureValue": "false", "defaultValue": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "Whether to reject a server [...]
+    "kex": { "index": 41, "kind": "parameter", "displayName": "Kex", "group": 
"security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the key exchange 
algorithms that the client proposes, in order of preference, for example 
mlkem768x2 [...]
+    "keyPairProvider": { "index": 42, "kind": "parameter", "displayName": "Key 
Pair Provider", "group": "security", "label": "security", "required": false, 
"type": "object", "javaType": 
"org.apache.sshd.common.keyprovider.KeyPairProvider", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The 
org.apache.sshd.common.keyprovider.KeyPairProvider that gives  [...]
+    "keyType": { "index": 43, "kind": "parameter", "displayName": "Key Type", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The key type of the key pair to use from 
certResource or keyPairProvider, for example ssh-rsa, ssh-ed25519 or ecdsa-s 
[...]
+    "knownHostsResource": { "index": 44, "kind": "parameter", "displayName": 
"Known Hosts Resource", "group": "security", "label": "security", "required": 
false, "type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "security": "insecure:ssl", 
"configurationClass": "org.apache.camel.component.ssh.SshConfiguration", 
"configurationField": "configuration", "description": "The resource of a file 
in the OpenSSH known_hosts format, such as  [...]
+    "macs": { "index": 45, "kind": "parameter", "displayName": "Macs", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the message 
authentication code (MAC) algorithms that the client proposes, in order of 
preference, [...]
+    "password": { "index": 46, "kind": "parameter", "displayName": "Password", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The password for password authentication, 
which is used only when neither certResource nor keyP [...]
+    "signatures": { "index": 47, "kind": "parameter", "displayName": 
"Signatures", "group": "security", "label": "security", "required": false, 
"type": "string", "javaType": "java.lang.String", "deprecated": false, 
"autowired": false, "secret": false, "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "A comma-separated list of the signature 
algorithms that the client supports, in order of preference, for example [...]
+    "username": { "index": 48, "kind": "parameter", "displayName": "Username", 
"group": "security", "label": "security", "required": false, "type": "string", 
"javaType": "java.lang.String", "deprecated": false, "autowired": false, 
"secret": true, "security": "secret", "configurationClass": 
"org.apache.camel.component.ssh.SshConfiguration", "configurationField": 
"configuration", "description": "The user name to log in with. With 
allowUsernameAndPasswordFromHeaders=true, the CamelSshUserna [...]
   }
 }
diff --git a/components/camel-ssh/src/main/docs/ssh-component.adoc 
b/components/camel-ssh/src/main/docs/ssh-component.adoc
index 52e5aae9d87c..9ce460648b2f 100644
--- a/components/camel-ssh/src/main/docs/ssh-component.adoc
+++ b/components/camel-ssh/src/main/docs/ssh-component.adoc
@@ -125,11 +125,10 @@ and use that for authentication.
 `keyPairProvider` has been set, and if so, it will use that for
 certificate-based authentication.
 3.  If neither `certResource` nor `keyPairProvider` are set, it will use
-the `username` and `password` options for authentication. Even though the 
`username` 
-and `password` are provided in the endpoint configuration and headers set with 
-`CamelSshUsername` and
-`CamelSshPassword`, the endpoint 
-configuration is surpassed and credentials set in the headers are used.
+the `username` and `password` options for authentication.
+
+In all three cases, the client logs in as the user of the `username` option, 
unless the producer takes the user from
+a header (see below).
 
 The following route fragment shows an SSH polling consumer using a
 certificate from the classpath.
@@ -175,6 +174,75 @@ YAML::
 An example of using Public Key authentication is provided in
 `examples/camel-example-ssh-security`.
 
+==== User name and password from headers
+
+The producer can log in with a user name and password chosen by the route, 
from the `CamelSshUsername` and
+`CamelSshPassword` headers, when the `allowUsernameAndPasswordFromHeaders` 
option is enabled. Without this option
+(the default), these headers are ignored, and the producer logs in with the 
`username` and `password` options.
+
+With the option enabled:
+
+* The `CamelSshUsername` header replaces the `username` option for every kind 
of authentication. With `certResource`
+or `keyPairProvider` set, the configured key logs in as the user that the 
header names.
+* The `CamelSshPassword` header replaces the `password` option. It is used 
only for password authentication, so not
+when `certResource` or `keyPairProvider` is set.
+
+[tabs]
+====
+Java::
++
+[source,java]
+----
+from("direct:status")
+    .setHeader("CamelSshUsername", constant("scott"))
+    .setHeader("CamelSshPassword", constant("{{scott.password}}"))
+    .to("ssh://db.example.com?allowUsernameAndPasswordFromHeaders=true");
+----
+
+XML::
++
+[source,xml]
+----
+<route>
+  <from uri="direct:status"/>
+  <setHeader name="CamelSshUsername">
+    <constant>scott</constant>
+  </setHeader>
+  <setHeader name="CamelSshPassword">
+    <constant>{{scott.password}}</constant>
+  </setHeader>
+  <to uri="ssh://db.example.com?allowUsernameAndPasswordFromHeaders=true"/>
+</route>
+----
+
+YAML::
++
+[source,yaml]
+----
+- route:
+    from:
+      uri: direct:status
+      steps:
+        - setHeader:
+            name: CamelSshUsername
+            expression:
+              constant:
+                expression: scott
+        - setHeader:
+            name: CamelSshPassword
+            expression:
+              constant:
+                expression: "{{scott.password}}"
+        - to:
+            uri: ssh://db.example.com
+            parameters:
+              allowUsernameAndPasswordFromHeaders: true
+----
+====
+
+Enable `allowUsernameAndPasswordFromHeaders` only when the route sets these 
headers itself, and remove them from
+messages that come from elsewhere, for example with 
`removeHeaders("CamelSsh*")` after an HTTP or JMS consumer.
+
 === Server host key verification
 
 The SSH Component verifies the host key of the SSH server only when the 
`knownHostsResource` option
diff --git 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
index 8f33beb18268..84bf680b93c7 100644
--- 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
+++ 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConfiguration.java
@@ -40,12 +40,22 @@ public class SshConfiguration implements Cloneable {
     @UriPath(defaultValue = "" + DEFAULT_SSH_PORT, description = "The port of 
the SSH server.")
     private int port = DEFAULT_SSH_PORT;
     @UriParam(label = "security", security = "secret",
-              description = "The user name to log in with. The 
CamelSshUsername header replaces it for the producer.")
+              description = "The user name to log in with. With 
allowUsernameAndPasswordFromHeaders=true, the"
+                            + " CamelSshUsername header replaces it for the 
producer.")
     private String username;
     @UriParam(label = "security", security = "secret",
               description = "The password for password authentication, which 
is used only when neither certResource nor"
-                            + " keyPairProvider is set. The CamelSshPassword 
header replaces it for the producer.")
+                            + " keyPairProvider is set. With 
allowUsernameAndPasswordFromHeaders=true, the CamelSshPassword"
+                            + " header replaces it for the producer.")
     private String password;
+    @UriParam(label = "producer,security",
+              description = "Whether the producer may take the user name and 
the password from the CamelSshUsername and"
+                            + " CamelSshPassword headers, in place of the 
username and password options. The"
+                            + " CamelSshUsername header is then also used with 
public key authentication (certResource or"
+                            + " keyPairProvider): the configured key logs in 
as the user that the header names. This is"
+                            + " disabled by default, and the headers are then 
ignored. Enable it only when the route sets"
+                            + " these headers itself.")
+    private boolean allowUsernameAndPasswordFromHeaders;
     @UriParam(label = "consumer",
               description = "The command that the consumer runs on the SSH 
server at each poll. The consumer needs it, as"
                             + " each poll fails without it. Some servers need 
the command to end with a newline, which is"
@@ -235,6 +245,14 @@ public class SshConfiguration implements Cloneable {
         this.password = password;
     }
 
+    public boolean isAllowUsernameAndPasswordFromHeaders() {
+        return allowUsernameAndPasswordFromHeaders;
+    }
+
+    public void setAllowUsernameAndPasswordFromHeaders(boolean 
allowUsernameAndPasswordFromHeaders) {
+        this.allowUsernameAndPasswordFromHeaders = 
allowUsernameAndPasswordFromHeaders;
+    }
+
     public String getPollCommand() {
         return pollCommand;
     }
diff --git 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConstants.java
 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConstants.java
index f3cf1b2c0aa6..31d61c978639 100644
--- 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConstants.java
+++ 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshConstants.java
@@ -20,12 +20,18 @@ import org.apache.camel.spi.Metadata;
 
 public interface SshConstants {
 
-    @Metadata(description = "The user name that the producer logs in with, 
instead of the username option.",
+    @Metadata(label = "producer",
+              description = "The user name that the producer logs in with, 
instead of the username option. Used only"
+                            + " when allowUsernameAndPasswordFromHeaders=true; 
otherwise ignored. It applies to every kind"
+                            + " of authentication: with certResource or 
keyPairProvider, the configured key logs in as"
+                            + " this user.",
               javaType = "String")
     String USERNAME_HEADER = "CamelSshUsername";
-    @Metadata(description = "The password that the producer uses for password 
authentication, instead of the password"
-                            + " option. It is not used when certResource or 
keyPairProvider is set.",
-              javaType = "String")
+    @Metadata(label = "producer",
+              description = "The password that the producer uses for password 
authentication, instead of the password"
+                            + " option. Used only when 
allowUsernameAndPasswordFromHeaders=true; otherwise ignored. It is"
+                            + " not used when certResource or keyPairProvider 
is set.",
+              javaType = "String", secret = true)
     String PASSWORD_HEADER = "CamelSshPassword";
     @Metadata(description = "The standard error of the command, as an 
InputStream.", javaType = "InputStream")
     String STDERR = "CamelSshStderr";
diff --git 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
index 0323284234fe..3868ded201e1 100644
--- 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
+++ 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshEndpoint.java
@@ -154,6 +154,14 @@ public class SshEndpoint extends ScheduledPollEndpoint 
implements EndpointServic
         getConfiguration().setPassword(password);
     }
 
+    public boolean isAllowUsernameAndPasswordFromHeaders() {
+        return getConfiguration().isAllowUsernameAndPasswordFromHeaders();
+    }
+
+    public void setAllowUsernameAndPasswordFromHeaders(boolean 
allowUsernameAndPasswordFromHeaders) {
+        
getConfiguration().setAllowUsernameAndPasswordFromHeaders(allowUsernameAndPasswordFromHeaders);
+    }
+
     public String getPollCommand() {
         return getConfiguration().getPollCommand();
     }
diff --git 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
index 66e048facc87..b8a2c6d0be0c 100644
--- 
a/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
+++ 
b/components/camel-ssh/src/main/java/org/apache/camel/component/ssh/SshHelper.java
@@ -80,10 +80,10 @@ public final class SshHelper {
             throw new IllegalStateException("Configuration must be set");
         }
 
+        final boolean credentialsFromHeaders = 
configuration.isAllowUsernameAndPasswordFromHeaders();
         String userName = configuration.getUsername();
-        Object userNameHeaderObj = headers.get(SshConstants.USERNAME_HEADER);
-        if (userNameHeaderObj instanceof String) {
-            userName = (String) headers.get(SshConstants.USERNAME_HEADER);
+        if (credentialsFromHeaders && 
headers.get(SshConstants.USERNAME_HEADER) instanceof String headerUserName) {
+            userName = headerUserName;
         }
 
         // resolve the host configuration once, and connect with it: the host 
key is verified against the host that this
@@ -143,10 +143,8 @@ public final class SshHelper {
                 session.addPublicKeyIdentity(pair);
             } else {
                 String password = configuration.getPassword();
-
-                Object passwordHeaderObj = 
headers.get(SshConstants.PASSWORD_HEADER);
-                if (passwordHeaderObj instanceof String) {
-                    password = (String) 
headers.get(SshConstants.PASSWORD_HEADER);
+                if (credentialsFromHeaders && 
headers.get(SshConstants.PASSWORD_HEADER) instanceof String headerPassword) {
+                    password = headerPassword;
                 }
 
                 LOG.debug("Attempting to authenticate username '{}' using a 
password identity", userName);
@@ -160,7 +158,7 @@ public final class SshHelper {
 
             if (!authResult.isDone() || authResult.isFailure()) {
                 LOG.debug("Failed to authenticate");
-                throw new RuntimeCamelException("Failed to authenticate 
username " + configuration.getUsername());
+                throw new RuntimeCamelException("Failed to authenticate 
username " + userName);
             }
 
             InputStream in = null;
diff --git 
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentProducerTest.java
 
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentProducerTest.java
index ad67f0337f9e..bbe2621431e1 100644
--- 
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentProducerTest.java
+++ 
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshComponentProducerTest.java
@@ -91,7 +91,7 @@ public class SshComponentProducerTest extends 
SshComponentTestSupport {
                         .to("mock:password");
 
                 from("direct:sshCredentialsWithHeaders")
-                        .to("ssh://localhost:" + port + "?timeout=3000")
+                        .to("ssh://localhost:" + port + 
"?timeout=3000&allowUsernameAndPasswordFromHeaders=true")
                         .to("mock:password");
             }
         };
diff --git 
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshHeaderCredentialsTest.java
 
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshHeaderCredentialsTest.java
new file mode 100644
index 000000000000..e0befe0bf2f9
--- /dev/null
+++ 
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshHeaderCredentialsTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.ssh;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+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.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * The user name and password that the producer logs in with, with and without 
the allowUsernameAndPasswordFromHeaders
+ * option.
+ */
+public class SshHeaderCredentialsTest extends SshComponentTestSupport {
+
+    /**
+     * The passwords that the test server received, by user.
+     */
+    private final Map<String, String> passwords = new ConcurrentHashMap<>();
+
+    @Override
+    public void doPreSetup() throws Exception {
+        super.doPreSetup();
+        sshd.setPasswordAuthenticator((username, password, session) -> {
+            authenticatedUsers.add(username);
+            passwords.put(username, password);
+            return true;
+        });
+    }
+
+    @Test
+    public void testPasswordHeadersIgnoredByDefault() throws Exception {
+        sendWithHeaders("direct:password", "headerUser", "headerPassword");
+
+        assertTrue(authenticatedUsers.contains("smx"), "the producer should 
log in as the configured user");
+        assertEquals("smx", passwords.get("smx"), "the producer should use the 
configured password");
+        assertFalse(authenticatedUsers.contains("headerUser"), "the 
CamelSshUsername header should be ignored");
+    }
+
+    @Test
+    public void testPasswordHeadersAllowed() throws Exception {
+        sendWithHeaders("direct:passwordAllowed", "headerUser", 
"headerPassword");
+
+        assertTrue(authenticatedUsers.contains("headerUser"), "the producer 
should log in as the header user");
+        assertEquals("headerPassword", passwords.get("headerUser"), "the 
producer should use the header password");
+        assertFalse(authenticatedUsers.contains("smx"), "the configured user 
should not be used");
+    }
+
+    @Test
+    public void testKeyUsernameHeaderIgnoredByDefault() throws Exception {
+        sendWithHeaders("direct:key", "headerUser", null);
+
+        assertTrue(authenticatedUsers.contains("smx"), "the key should log in 
as the configured user");
+        assertFalse(authenticatedUsers.contains("headerUser"), "the 
CamelSshUsername header should be ignored");
+    }
+
+    @Test
+    public void testKeyUsernameHeaderAllowed() throws Exception {
+        sendWithHeaders("direct:keyAllowed", "headerUser", "headerPassword");
+
+        assertTrue(authenticatedUsers.contains("headerUser"), "the key should 
log in as the header user");
+        assertFalse(authenticatedUsers.contains("smx"), "the configured user 
should not be used");
+        assertNull(passwords.get("headerUser"), "the CamelSshPassword header 
should not be used with a key");
+    }
+
+    @Test
+    public void testComponentOption() throws Exception {
+        sendWithHeaders("direct:component", "headerUser", "headerPassword");
+
+        assertTrue(authenticatedUsers.contains("headerUser"), "the component 
option should allow the header user");
+        assertEquals("headerPassword", passwords.get("headerUser"), "the 
component option should allow the header password");
+    }
+
+    private void sendWithHeaders(String uri, String username, String password) 
throws Exception {
+        MockEndpoint mock = getMockEndpoint("mock:result");
+        mock.expectedBodiesReceived("test");
+        MockEndpoint error = getMockEndpoint("mock:error");
+        error.expectedMessageCount(0);
+
+        Map<String, Object> headers = new ConcurrentHashMap<>();
+        headers.put(SshConstants.USERNAME_HEADER, username);
+        if (password != null) {
+            headers.put(SshConstants.PASSWORD_HEADER, password);
+        }
+        template.sendBodyAndHeaders(uri, "test", headers);
+
+        MockEndpoint.assertIsSatisfied(context);
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                onException(Exception.class)
+                        .handled(true)
+                        .to("mock:error");
+
+                SshComponent allowing = new SshComponent();
+                
allowing.getConfiguration().setAllowUsernameAndPasswordFromHeaders(true);
+                getContext().addComponent("ssh-allowing", allowing);
+
+                from("direct:password")
+                        .to("ssh://smx:smx@localhost:" + port + 
"?timeout=3000")
+                        .to("mock:result");
+
+                from("direct:passwordAllowed")
+                        .to("ssh://smx:smx@localhost:" + port + 
"?timeout=3000&allowUsernameAndPasswordFromHeaders=true")
+                        .to("mock:result");
+
+                from("direct:key")
+                        .to("ssh://smx@localhost:" + port + 
"?timeout=3000&certResource=file:src/test/resources/hostkey.pem")
+                        .to("mock:result");
+
+                from("direct:keyAllowed")
+                        .to("ssh://smx@localhost:" + port + 
"?timeout=3000&certResource=file:src/test/resources/hostkey.pem"
+                            + "&allowUsernameAndPasswordFromHeaders=true")
+                        .to("mock:result");
+
+                from("direct:component")
+                        .to("ssh-allowing://smx:smx@localhost:" + port + 
"?timeout=3000")
+                        .to("mock:result");
+            }
+        };
+    }
+}
diff --git 
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshProducerExitCodeTest.java
 
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshProducerExitCodeTest.java
index 3e0fe9b23234..8a62a45e465d 100644
--- 
a/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshProducerExitCodeTest.java
+++ 
b/components/camel-ssh/src/test/java/org/apache/camel/component/ssh/SshProducerExitCodeTest.java
@@ -53,12 +53,12 @@ public class SshProducerExitCodeTest extends 
SshComponentTestSupport {
                 // 1st try (expected: ExitValue=1)
                 from("direct:start")
                         .setBody().simple("exit 1")
-                        .to("ssh:localhost:" + port)
+                        .to("ssh:localhost:" + port + 
"?allowUsernameAndPasswordFromHeaders=true")
                         .log("1st try: ExitValue=${header.CamelSshExitValue}")
 
                         // 2nd try (expected: ExitValue=2)
                         .setBody().simple("exit 2")
-                        .to("ssh:localhost:" + port)
+                        .to("ssh:localhost:" + port + 
"?allowUsernameAndPasswordFromHeaders=true")
                         .log("2nd try: ExitValue=${header.CamelSshExitValue}")
 
                         .to("mock:result");
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 25708c2cd51b..1b6420130b29 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -12297,6 +12297,16 @@ With `allowUrlBody=true`, a body that does not start 
with `version: 1` and is no
 with a space or a relative name, now fails with an `InvalidPayloadException`, 
as a URL with an unknown scheme already
 did. Before, it failed with an `IllegalArgumentException`. A URL that cannot 
be fetched keeps its own exception.
 
+=== camel-ssh - the user name and password headers need the 
allowUsernameAndPasswordFromHeaders option
+
+The producer took the user name from the `CamelSshUsername` header, and for 
password authentication the password from
+the `CamelSshPassword` header, over the `username` and `password` options of 
the endpoint. The header user was also used
+with public key authentication (`certResource` or `keyPairProvider`), so the 
configured key logged in as the user that
+the header named. The producer now logs in with the `username` and `password` 
of the endpoint, and ignores these
+headers, unless the endpoint sets the new 
`allowUsernameAndPasswordFromHeaders=true` option (disabled by default), or
+the component sets 
`camel.component.ssh.allowUsernameAndPasswordFromHeaders=true`. A route that 
relies on these headers
+must set this option.
+
 === Kamelets - removed Kamelets
 
 The Kamelet catalog (camel-kamelets 4.24) removes Kamelets that could not work 
on Camel 4.23 or 4.24:
diff --git 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SshComponentBuilderFactory.java
 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SshComponentBuilderFactory.java
index 702de39aa0a0..234ffba0e147 100644
--- 
a/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SshComponentBuilderFactory.java
+++ 
b/dsl/camel-componentdsl/src/generated/java/org/apache/camel/builder/component/dsl/SshComponentBuilderFactory.java
@@ -415,6 +415,29 @@ public interface SshComponentBuilderFactory {
             return this;
         }
     
+        
+        /**
+         * Whether the producer may take the user name and the password from 
the
+         * CamelSshUsername and CamelSshPassword headers, in place of the
+         * username and password options. The CamelSshUsername header is then
+         * also used with public key authentication (certResource or
+         * keyPairProvider): the configured key logs in as the user that the
+         * header names. This is disabled by default, and the headers are then
+         * ignored. Enable it only when the route sets these headers itself.
+         * 
+         * The option is a: &lt;code&gt;boolean&lt;/code&gt; type.
+         * 
+         * Default: false
+         * Group: security
+         * 
+         * @param allowUsernameAndPasswordFromHeaders the value to set
+         * @return the dsl builder
+         */
+        default SshComponentBuilder 
allowUsernameAndPasswordFromHeaders(boolean 
allowUsernameAndPasswordFromHeaders) {
+            doSetProperty("allowUsernameAndPasswordFromHeaders", 
allowUsernameAndPasswordFromHeaders);
+            return this;
+        }
+    
         /**
          * The resource with the private key for public key authentication, in
          * OpenSSH or PEM format, for example classpath:id_ed25519 or
@@ -587,8 +610,9 @@ public interface SshComponentBuilderFactory {
     
         /**
          * The password for password authentication, which is used only when
-         * neither certResource nor keyPairProvider is set. The 
CamelSshPassword
-         * header replaces it for the producer.
+         * neither certResource nor keyPairProvider is set. With
+         * allowUsernameAndPasswordFromHeaders=true, the CamelSshPassword 
header
+         * replaces it for the producer.
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
@@ -621,8 +645,9 @@ public interface SshComponentBuilderFactory {
         }
     
         /**
-         * The user name to log in with. The CamelSshUsername header replaces 
it
-         * for the producer.
+         * The user name to log in with. With
+         * allowUsernameAndPasswordFromHeaders=true, the CamelSshUsername 
header
+         * replaces it for the producer.
          * 
          * The option is a: &lt;code&gt;java.lang.String&lt;/code&gt; type.
          * 
@@ -675,6 +700,7 @@ public interface SshComponentBuilderFactory {
             case "sleepForShellPrompt": 
getOrCreateConfiguration((SshComponent) 
component).setSleepForShellPrompt((long) value); return true;
             case "healthCheckConsumerEnabled": ((SshComponent) 
component).setHealthCheckConsumerEnabled((boolean) value); return true;
             case "healthCheckProducerEnabled": ((SshComponent) 
component).setHealthCheckProducerEnabled((boolean) value); return true;
+            case "allowUsernameAndPasswordFromHeaders": 
getOrCreateConfiguration((SshComponent) 
component).setAllowUsernameAndPasswordFromHeaders((boolean) value); return true;
             case "certResource": getOrCreateConfiguration((SshComponent) 
component).setCertResource((java.lang.String) value); return true;
             case "certResourcePassword": 
getOrCreateConfiguration((SshComponent) 
component).setCertResourcePassword((java.lang.String) value); return true;
             case "ciphers": getOrCreateConfiguration((SshComponent) 
component).setCiphers((java.lang.String) value); return true;
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
index 120d69ce3800..fa9922de5b10 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/SshEndpointBuilderFactory.java
@@ -825,8 +825,9 @@ public interface SshEndpointBuilderFactory {
         }
         /**
          * The password for password authentication, which is used only when
-         * neither certResource nor keyPairProvider is set. The 
CamelSshPassword
-         * header replaces it for the producer.
+         * neither certResource nor keyPairProvider is set. With
+         * allowUsernameAndPasswordFromHeaders=true, the CamelSshPassword 
header
+         * replaces it for the producer.
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
@@ -857,8 +858,9 @@ public interface SshEndpointBuilderFactory {
             return this;
         }
         /**
-         * The user name to log in with. The CamelSshUsername header replaces 
it
-         * for the producer.
+         * The user name to log in with. With
+         * allowUsernameAndPasswordFromHeaders=true, the CamelSshUsername 
header
+         * replaces it for the producer.
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
@@ -1399,6 +1401,48 @@ public interface SshEndpointBuilderFactory {
             doSetProperty("timeout", timeout);
             return this;
         }
+        /**
+         * Whether the producer may take the user name and the password from 
the
+         * CamelSshUsername and CamelSshPassword headers, in place of the
+         * username and password options. The CamelSshUsername header is then
+         * also used with public key authentication (certResource or
+         * keyPairProvider): the configured key logs in as the user that the
+         * header names. This is disabled by default, and the headers are then
+         * ignored. Enable it only when the route sets these headers itself.
+         * 
+         * The option is a: <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: security
+         * 
+         * @param allowUsernameAndPasswordFromHeaders the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointProducerBuilder 
allowUsernameAndPasswordFromHeaders(boolean 
allowUsernameAndPasswordFromHeaders) {
+            doSetProperty("allowUsernameAndPasswordFromHeaders", 
allowUsernameAndPasswordFromHeaders);
+            return this;
+        }
+        /**
+         * Whether the producer may take the user name and the password from 
the
+         * CamelSshUsername and CamelSshPassword headers, in place of the
+         * username and password options. The CamelSshUsername header is then
+         * also used with public key authentication (certResource or
+         * keyPairProvider): the configured key logs in as the user that the
+         * header names. This is disabled by default, and the headers are then
+         * ignored. Enable it only when the route sets these headers itself.
+         * 
+         * The option will be converted to a <code>boolean</code> type.
+         * 
+         * Default: false
+         * Group: security
+         * 
+         * @param allowUsernameAndPasswordFromHeaders the value to set
+         * @return the dsl builder
+         */
+        default SshEndpointProducerBuilder 
allowUsernameAndPasswordFromHeaders(String allowUsernameAndPasswordFromHeaders) 
{
+            doSetProperty("allowUsernameAndPasswordFromHeaders", 
allowUsernameAndPasswordFromHeaders);
+            return this;
+        }
         /**
          * The resource with the private key for public key authentication, in
          * OpenSSH or PEM format, for example classpath:id_ed25519 or
@@ -1599,8 +1643,9 @@ public interface SshEndpointBuilderFactory {
         }
         /**
          * The password for password authentication, which is used only when
-         * neither certResource nor keyPairProvider is set. The 
CamelSshPassword
-         * header replaces it for the producer.
+         * neither certResource nor keyPairProvider is set. With
+         * allowUsernameAndPasswordFromHeaders=true, the CamelSshPassword 
header
+         * replaces it for the producer.
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
@@ -1631,8 +1676,9 @@ public interface SshEndpointBuilderFactory {
             return this;
         }
         /**
-         * The user name to log in with. The CamelSshUsername header replaces 
it
-         * for the producer.
+         * The user name to log in with. With
+         * allowUsernameAndPasswordFromHeaders=true, the CamelSshUsername 
header
+         * replaces it for the producer.
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
@@ -2266,8 +2312,9 @@ public interface SshEndpointBuilderFactory {
         }
         /**
          * The password for password authentication, which is used only when
-         * neither certResource nor keyPairProvider is set. The 
CamelSshPassword
-         * header replaces it for the producer.
+         * neither certResource nor keyPairProvider is set. With
+         * allowUsernameAndPasswordFromHeaders=true, the CamelSshPassword 
header
+         * replaces it for the producer.
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
@@ -2298,8 +2345,9 @@ public interface SshEndpointBuilderFactory {
             return this;
         }
         /**
-         * The user name to log in with. The CamelSshUsername header replaces 
it
-         * for the producer.
+         * The user name to log in with. With
+         * allowUsernameAndPasswordFromHeaders=true, the CamelSshUsername 
header
+         * replaces it for the producer.
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
@@ -2725,11 +2773,14 @@ public interface SshEndpointBuilderFactory {
 
         /**
          * The user name that the producer logs in with, instead of the 
username
-         * option.
+         * option. Used only when allowUsernameAndPasswordFromHeaders=true;
+         * otherwise ignored. It applies to every kind of authentication: with
+         * certResource or keyPairProvider, the configured key logs in as this
+         * user.
          * 
          * The option is a: {@code String} type.
          * 
-         * Group: common
+         * Group: producer
          * 
          * @return the name of the header {@code SshUsername}.
          */
@@ -2738,12 +2789,13 @@ public interface SshEndpointBuilderFactory {
         }
         /**
          * The password that the producer uses for password authentication,
-         * instead of the password option. It is not used when certResource or
-         * keyPairProvider is set.
+         * instead of the password option. Used only when
+         * allowUsernameAndPasswordFromHeaders=true; otherwise ignored. It is
+         * not used when certResource or keyPairProvider is set.
          * 
          * The option is a: {@code String} type.
          * 
-         * Group: common
+         * Group: producer
          * 
          * @return the name of the header {@code SshPassword}.
          */

Reply via email to