Package dev.aherscu.qa.jgiven.ssh.model
Class SshInfo
- java.lang.Object
-
- dev.aherscu.qa.jgiven.ssh.model.SshInfo
-
public final class SshInfo extends Object
Encapsulates thessh-info
field as defined in Uniform Resource Identifier (URI) Scheme for Secure File Transfer Protocol (SFTP) and Secure Shell (SSH).- Author:
- aherscu
-
-
Field Summary
Fields Modifier and Type Field Description static File
DEFAULT_SSH_DIR
The default SSH directory; that's the.ssh
directory under the user's home directory.static String
SSH_PRIVATE_KEY_FILE
If you wish to specify a custom SSH private key location then you should launch your process with-Dssh.private.key.file=<your private key path>
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description net.schmizz.sshj.SSHClient
authenticate(net.schmizz.sshj.SSHClient client)
Authenticates an SSH client using this ssh-info.
-
-
-
Field Detail
-
DEFAULT_SSH_DIR
public static final File DEFAULT_SSH_DIR
The default SSH directory; that's the.ssh
directory under the user's home directory.
-
SSH_PRIVATE_KEY_FILE
public static final String SSH_PRIVATE_KEY_FILE
If you wish to specify a custom SSH private key location then you should launch your process with-Dssh.private.key.file=<your private key path>
. This system property will be consulted before trying to load an SSH private key from its default location (as specified inDEFAULT_SSH_DIR
).- See Also:
authenticate(SSHClient)
, Constant Field Values
-
-
Constructor Detail
-
SshInfo
public SshInfo(String sshInfo)
-
-
Method Detail
-
authenticate
public net.schmizz.sshj.SSHClient authenticate(net.schmizz.sshj.SSHClient client) throws net.schmizz.sshj.common.SSHException
Authenticates an SSH client using this ssh-info.The recognized
ssh-info
structure is as follows:<user-name>;auth=<method>:<password>
where:
<user-name>
-- required, the user name- auth=
<method>
-- required, the authentication method; one of:- PASSWORD
- PUBLIC_KEY; if this method is used, then an attempt to read an user
defined SSH private key file will be made using the
"ssh.private.key.file" system property, if that fails then it
will fallback on reading
id_rsa
file from theDEFAULT_SSH_DIR
<password>
-- required, the password; can be empty
- Parameters:
client
- the SSH client- Returns:
- the authenticated SSH client
- Throws:
net.schmizz.sshj.common.SSHException
- authentication or transport failure
-
-