camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1182201 - in /camel/branches/camel-2.8.x: ./ components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
Date Wed, 12 Oct 2011 04:36:16 GMT
Author: dkulp
Date: Wed Oct 12 04:36:15 2011
New Revision: 1182201

URL: http://svn.apache.org/viewvc?rev=1182201&view=rev
Log:
Merged revisions 1179060 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1179060 | davsclaus | 2011-10-05 02:29:55 -0400 (Wed, 05 Oct 2011) | 1 line
  
  CAMEL-4506: sftp component supports interactive keyboard mode by returning the password.
Thanks to Eugene for the patch.
........

Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java?rev=1182201&r1=1182200&r2=1182201&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
Wed Oct 12 04:36:15 2011
@@ -32,6 +32,7 @@ import com.jcraft.jsch.JSch;
 import com.jcraft.jsch.JSchException;
 import com.jcraft.jsch.Session;
 import com.jcraft.jsch.SftpException;
+import com.jcraft.jsch.UIKeyboardInteractive;
 import com.jcraft.jsch.UserInfo;
 import org.apache.camel.Exchange;
 import org.apache.camel.InvalidPayloadException;
@@ -58,6 +59,12 @@ public class SftpOperations implements R
     private ChannelSftp channel;
     private Session session;
 
+    /**
+     * Extended user info which supports interactive keyboard mode, by entering the password.
+     */
+    public static interface ExtendedUserInfo extends UserInfo, UIKeyboardInteractive {
+    }
+
     public void setEndpoint(GenericFileEndpoint endpoint) {
         this.endpoint = (SftpEndpoint) endpoint;
     }
@@ -173,7 +180,7 @@ public class SftpOperations implements R
         session.setServerAliveCountMax(sftpConfig.getServerAliveCountMax());
 
         // set user information
-        session.setUserInfo(new UserInfo() {
+        session.setUserInfo(new ExtendedUserInfo() {
             public String getPassphrase() {
                 return null;
             }
@@ -199,6 +206,12 @@ public class SftpOperations implements R
             public void showMessage(String s) {
                 LOG.trace("Message received from Server: " + s);
             }
+
+            public String[] promptKeyboardInteractive(String destination, String name,
+                                                      String instruction, String[] prompt,
boolean[] echo) {
+                return new String[]{configuration.getPassword()};
+            }
+
         });
         return session;
     }



Mime
View raw message