Merge pull request #364 from olegz/INT-2442

INT-2442 Fix DefaultSftpSessionFactory#OptimisticUserInfoImpl
This commit is contained in:
Gary Russell
2012-03-08 10:49:19 -05:00
2 changed files with 10 additions and 3 deletions

View File

@@ -29,6 +29,7 @@ import com.jcraft.jsch.ChannelSftp.LsEntry;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Proxy;
import com.jcraft.jsch.SocketFactory;
import com.jcraft.jsch.UIKeyboardInteractive;
import com.jcraft.jsch.UserInfo;
/**
@@ -225,7 +226,7 @@ public class DefaultSftpSessionFactory implements SessionFactory<LsEntry> {
* It returns in the positive where possible and handles interactive authentication
* (i.e. 'Please enter your password: ' prompts are dispatched automatically).
*/
private static class OptimisticUserInfoImpl implements UserInfo {
private static class OptimisticUserInfoImpl implements UserInfo, UIKeyboardInteractive {
private final String password;
@@ -255,6 +256,11 @@ public class DefaultSftpSessionFactory implements SessionFactory<LsEntry> {
public void showMessage(String string) {
}
public String[] promptKeyboardInteractive(String destination,
String name, String instruction, String[] prompt, boolean[] echo) {
return null;
}
}
}

View File

@@ -9,10 +9,11 @@
<bean id="sftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="localhost"/>
<property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/>
<property name="privateKeyPassphrase" value="springintegration"/>
<!-- <property name="privateKey" value="classpath:org/springframework/integration/sftp/config/sftp_rsa"/> -->
<!-- <property name="privateKeyPassphrase" value="springintegration"/> -->
<property name="port" value="22"/>
<property name="user" value="ozhurakousky"/>
<property name="password" value="password"/>
</bean>
<int:channel id="ftpChannel"/>