Package com.adaptris.core.ftp
Class SftpKeyAuthentication
java.lang.Object
com.adaptris.core.ftp.SftpKeyAuthentication
- All Implemented Interfaces:
SftpAuthenticationProvider
SftpAuthenticationProvider
using keys.
It has the following behaviour :
- If the private key is not accepted by the target server, then an exception will be thrown.
- Multiple private keys are supported, provided you specify a
ConfigBuilder
implementation that allows it. - Specifying the username+password in the destination (e.g.
sftp://lchan:myPassword@1.2.3.4:22//opt/sftp
), will override the username used to login but no other credentials. The only valid authentication is via the specified private key. - The private key and known_hosts file are expected to be in OpenSSH format
In the adapter configuration file this class is aliased as sftp-key-authentication which is the preferred alternative to the fully qualified classname when building your configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconnect
(SftpClient sftp, FileTransferConnection.UserInfo ui) The password for the private key (if it has one)void
setPrivateKeyFilename
(String filename) The name of the file where the private key is heldvoid
The password for the private key (if it has one)
-
Constructor Details
-
SftpKeyAuthentication
public SftpKeyAuthentication() -
SftpKeyAuthentication
-
-
Method Details
-
connect
public SftpClient connect(SftpClient sftp, FileTransferConnection.UserInfo ui) throws FileTransferException, IOException, PasswordException - Specified by:
connect
in interfaceSftpAuthenticationProvider
- Throws:
FileTransferException
IOException
PasswordException
-
getPrivateKeyFilename
-
setPrivateKeyFilename
The name of the file where the private key is held- Parameters:
filename
- name of file holding the private key
-
getPrivateKeyPassword
The password for the private key (if it has one)- Returns:
- private key password
-
setPrivateKeyPassword
The password for the private key (if it has one)- Parameters:
pw
-
-