Repository: camel
Updated Branches:
  refs/heads/master 200e097d9 -> bee13d290


Added 'preferredAuthentication' option for camel-jsch


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/2ebd2338
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/2ebd2338
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/2ebd2338

Branch: refs/heads/master
Commit: 2ebd233839e67413afafd8ab8a72e8e54cdde036
Parents: 200e097
Author: James Burton <the.james.bur...@gmail.com>
Authored: Thu Nov 3 14:30:34 2016 +0000
Committer: James Burton <the.james.bur...@gmail.com>
Committed: Thu Nov 3 14:30:34 2016 +0000

----------------------------------------------------------------------
 .../camel-jsch/src/main/docs/scp-component.adoc      |  1 +
 .../apache/camel/component/scp/ScpConfiguration.java | 15 +++++++++++++++
 .../apache/camel/component/scp/ScpOperations.java    |  5 +++++
 3 files changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2ebd2338/components/camel-jsch/src/main/docs/scp-component.adoc
----------------------------------------------------------------------
diff --git a/components/camel-jsch/src/main/docs/scp-component.adoc 
b/components/camel-jsch/src/main/docs/scp-component.adoc
index 2cd6fc9..a7b1766 100644
--- a/components/camel-jsch/src/main/docs/scp-component.adoc
+++ b/components/camel-jsch/src/main/docs/scp-component.adoc
@@ -89,6 +89,7 @@ The SCP component supports 21 endpoint options which are 
listed below:
 | timeout | advanced | 30000 | int | Sets the data timeout for waiting for 
reply Used only by FTPClient
 | knownHostsFile | security |  | String | Sets the known_hosts file so that 
the jsch endpoint can do host key verification.
 | password | security |  | String | Password to use for login
+| preferredAuthentications | security |  | String | Set the authentication 
methods that JSch will be allowed to use, e.g. 
gssapi-with-mic,publickey,keyboard-interactive,password
 | privateKeyFile | security |  | String | Set the private key file to that the 
SFTP endpoint can do private key verification.
 | privateKeyFilePassphrase | security |  | String | Set the private key file 
passphrase to that the SFTP endpoint can do private key verification.
 | username | security |  | String | Username to use for login

http://git-wip-us.apache.org/repos/asf/camel/blob/2ebd2338/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpConfiguration.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpConfiguration.java
 
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpConfiguration.java
index ad48ac7..6d0502f 100644
--- 
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpConfiguration.java
+++ 
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpConfiguration.java
@@ -46,6 +46,8 @@ public class ScpConfiguration extends RemoteFileConfiguration 
{
     // null means default jsch list will be used
     @UriParam(label = "security,advanced")
     private String ciphers;
+    @UriParam(label = "security", secret = true)
+    private String preferredAuthentications;
 
     public ScpConfiguration() {
         setProtocol("scp");
@@ -150,4 +152,17 @@ public class ScpConfiguration extends 
RemoteFileConfiguration {
         return ciphers;
     }
 
+    /**
+     * Set a comma separated list of authentications that will be used in 
order of preference.
+        * Possible authentication methods are defined by JCraft JSCH. Some 
examples include: gssapi-with-mic,publickey,keyboard-interactive,password
+     * If not specified the JSCH and/or system defaults will be used.
+     */
+    public void setPreferredAuthentications(final String 
preferredAuthentications) {
+      this.preferredAuthentications = preferredAuthentications;
+    }
+
+    public String getPreferredAuthentications() {
+      return preferredAuthentications;
+    }
+       
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/2ebd2338/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
----------------------------------------------------------------------
diff --git 
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
 
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
index fb5e34f..beec1a6 100644
--- 
a/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
+++ 
b/components/camel-jsch/src/main/java/org/apache/camel/component/scp/ScpOperations.java
@@ -245,6 +245,11 @@ public class ScpOperations implements 
RemoteFileOperations<ScpFile> {
                 session.setConfig("StrictHostKeyChecking", 
config.getStrictHostKeyChecking());
             }
 
+            if (ObjectHelper.isNotEmpty(config.getPreferredAuthentications())) 
{
+                LOG.trace("Using preferredAuthentications: {}", 
config.getPreferredAuthentications());
+                session.setConfig("PreferredAuthentications", 
config.getPreferredAuthentications());
+            }
+                       
             int timeout = config.getConnectTimeout();
             LOG.debug("Connecting to {} with {} timeout...", 
config.remoteServerInformation(),
                 timeout > 0 ? (Integer.toString(timeout) + " ms") : "no");

Reply via email to