commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "steve" <st...@dyrdahl.net>
Subject [VFS] [PATCH] SftpFileProvider.java
Date Tue, 10 Jun 2003 15:01:53 GMT
Key based authentication simply requires loading the private key.  This patch is a bit of a
cludge.  It might be nice to configure properties for where to look for the key file (and
the known hosts for that matter).

Index: SftpFileProvider.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/provider/sftp/SftpFileProvider.java,v
retrieving revision 1.1
diff -r1.1 SftpFileProvider.java
64a65,67
> import com.jcraft.jsch.JSchException;
>
> import java.io.File;
83a87
>         String privateKeyPath = null;
92c96,101
<             knownHostsPath = System.getProperty( "user.home") + "/.ssh/known_hosts";
---
>             String userHome = System.getProperty( "user.home" );
>             knownHostsPath = userHome + "/.ssh/known_hosts";
>             File f = new File(userHome + "/.ssh/id_rsa");
>             if(f.canRead()) {
>                 privateKeyPath = f.getAbsolutePath();
>             }
94d102
<
95a104,110
>         if(privateKeyPath!=null) {
>             try {
>                 jSch.addIdentity(privateKeyPath);
>             } catch (JSchException e) {
>                 throw new FileSystemException(e);
>             }
>         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message