Package com.adaptris.core.ftp
Class SftpKeyAuthentication
- java.lang.Object
-
- com.adaptris.core.ftp.SftpKeyAuthentication
-
- All Implemented Interfaces:
SftpAuthenticationProvider
public class SftpKeyAuthentication extends java.lang.Object implements SftpAuthenticationProvider
SftpAuthenticationProviderusing 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
ConfigBuilderimplementation 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 Constructor Description SftpKeyAuthentication()SftpKeyAuthentication(java.lang.String filename, java.lang.String pkeyPassword)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SftpClientconnect(SftpClient sftp, FileTransferConnection.UserInfo ui)java.lang.StringgetPrivateKeyFilename()java.lang.StringgetPrivateKeyPassword()The password for the private key (if it has one)voidsetPrivateKeyFilename(java.lang.String filename)The name of the file where the private key is heldvoidsetPrivateKeyPassword(java.lang.String pw)The password for the private key (if it has one)
-
-
-
Method Detail
-
connect
public SftpClient connect(SftpClient sftp, FileTransferConnection.UserInfo ui) throws FileTransferException, java.io.IOException, PasswordException
- Specified by:
connectin interfaceSftpAuthenticationProvider- Throws:
FileTransferExceptionjava.io.IOExceptionPasswordException
-
getPrivateKeyFilename
public java.lang.String getPrivateKeyFilename()
-
setPrivateKeyFilename
public void setPrivateKeyFilename(java.lang.String filename)
The name of the file where the private key is held- Parameters:
filename- name of file holding the private key
-
getPrivateKeyPassword
public java.lang.String getPrivateKeyPassword()
The password for the private key (if it has one)- Returns:
- private key password
-
setPrivateKeyPassword
public void setPrivateKeyPassword(java.lang.String pw)
The password for the private key (if it has one)- Parameters:
pw-
-
-