StandardSftpConnection
instead.@ComponentProfile(summary="Deprecated: Use StandardSftpConnection instead", tag="connections,sftp") @Deprecated @Removal(version="3.9.0", message="Use StandardSftpConnection instead") public class SftpKeyAuthConnection extends FileTransferConnection
This connection implementation allows you to use a public / private key pair to authenticate against the sftp server. It deviates
from a standard SftpConnection
. Rather than specifying a default password for accessing the server, you specify a
setPrivateKeyFilename(String)
and setPrivateKeyPassword(String)
which contains your private key credentials
which are then supplied to the server.
It has the following behavioural changes from a standard SftpConnection :
ConfigBuilder
implementation that allows it.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 password associated with setPrivateKeyPassword(String)
may be encoded using any of the standard
Password
mechanisms and it will be decoded when the private key is first accessed.
In the adapter configuration file this class is aliased as sftp-key-auth-connection which is the preferred alternative to the fully qualified classname when building your configuration.
FileTransferConnection.UserInfo
DEFAULT_EXPIRATION, DEFAULT_MAX_CACHE_SIZE
log
Constructor and Description |
---|
SftpKeyAuthConnection()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
acceptProtocol(java.lang.String s)
Deprecated.
Validate the URL Protocol when a URL is used.
|
protected FileTransferClient |
create(java.lang.String remoteHost,
int port,
FileTransferConnection.UserInfo ui)
Deprecated.
Create an instance of the
FileTransferClient for use with the producer or consumer. |
protected FileTransferConnection.UserInfo |
createUserInfo()
Deprecated.
|
int |
defaultControlPort()
Deprecated.
|
ConfigBuilder |
getConfiguration()
Deprecated.
|
java.lang.String |
getKnownHostsFile()
Deprecated.
|
java.lang.String |
getPrivateKeyFilename()
Deprecated.
|
java.lang.String |
getPrivateKeyPassword()
Deprecated.
The password for the private key (if it has one)
|
java.lang.Integer |
getSocketTimeout()
Deprecated.
|
void |
setConfiguration(ConfigBuilder repo)
Deprecated.
Set the config repository.
|
void |
setKnownHostsFile(java.lang.String k)
Deprecated.
|
void |
setPrivateKeyFilename(java.lang.String privateKeyFilename)
Deprecated.
The name of the file where the private key is held
|
void |
setPrivateKeyPassword(java.lang.String privateKeyPassword)
Deprecated.
The password for the private key (if it has one)
|
void |
setSocketTimeout(java.lang.Integer t)
Deprecated.
The socket timeout in milliseconds for connect / read /write operations.
|
additionalDebug, cacheConnection, closeConnection, connect, disconnect, expirationMillis, forceRelativePath, getAdditionalDebug, getCacheConnection, getCacheExpiration, getDefaultControlPort, getDefaultUserName, getDirectoryRoot, getForceRelativePath, getMaxClientCacheSize, getWindowsWorkAround, initConnection, maxClientCacheSize, setAdditionalDebug, setCacheConnection, setCacheExpiration, setDefaultControlPort, setDefaultUserName, setForceRelativePath, setMaxClientCache, setWindowsWorkAround, windowsWorkaround, withCacheExpiration
prepareConnection, startConnection, stopConnection
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, getConnectionErrorHandler, getLookupName, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setLookupName, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
protected boolean acceptProtocol(java.lang.String s)
FileTransferConnection
acceptProtocol
in class FileTransferConnection
s
- the URL Protocolprotected FileTransferClient create(java.lang.String remoteHost, int port, FileTransferConnection.UserInfo ui) throws java.io.IOException, FileTransferException, PasswordException
FileTransferConnection
FileTransferClient
for use with the producer or consumer.create
in class FileTransferConnection
remoteHost
- the remote host.port
- the port to connect toui
- a local UserInfo containing username and passwordFileTransferClient
objectjava.io.IOException
- wrapping a general comms error.FileTransferException
- if a protocol specific exception occurred.PasswordException
public java.lang.Integer getSocketTimeout()
public void setSocketTimeout(java.lang.Integer t)
t
- The socketTimeout to set, default is 60000public java.lang.String getPrivateKeyFilename()
public void setPrivateKeyFilename(java.lang.String privateKeyFilename)
privateKeyFilename
- name of file holding the private keypublic java.lang.String getPrivateKeyPassword()
public void setPrivateKeyPassword(java.lang.String privateKeyPassword)
privateKeyPassword
- protected FileTransferConnection.UserInfo createUserInfo() throws FileTransferException
createUserInfo
in class FileTransferConnection
FileTransferException
public java.lang.String getKnownHostsFile()
public void setKnownHostsFile(java.lang.String k)
public int defaultControlPort()
defaultControlPort
in class FileTransferConnection
public ConfigBuilder getConfiguration()
public void setConfiguration(ConfigBuilder repo)
Use a config repository to set various SSH based settings (such as PreferredAuthentications
or
ServerAliveInterval
.
repo
- the configRepository to set