org.apache.tools.ant.taskdefs.optional.ssh

Class SSHUserInfo

public class SSHUserInfo extends Object implements UserInfo, UIKeyboardInteractive

Class containing information on an SSH user.
Constructor Summary
SSHUserInfo()
Constructor for SSHUserInfo.
SSHUserInfo(String password, boolean trustAllCertificates)
Constructor for SSHUserInfo.
Method Summary
StringgetKeyfile()
Returns the keyfile.
StringgetName()
Gets the user name.
StringgetPassphrase(String message)
Gets the pass phrase of the user.
StringgetPassphrase()
Returns the passphrase.
StringgetPassword()
Gets the user's password.
booleangetTrust()
booleanprompt(String str)
Prompts a string.
String[]promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo)
Implementation of UIKeyboardInteractive#promptKeyboardInteractive.
booleanpromptPassphrase(String message)
Implement the UserInfo interface.
booleanpromptPassword(String passwordPrompt)
Implement the UserInfo interface.
booleanpromptYesNo(String message)
Implement the UserInfo interface.
booleanretry()
Indicates whether a retry was done.
voidsetKeyfile(String keyfile)
Sets the keyfile.
voidsetName(String name)
Sets the name.
voidsetPassphrase(String passphrase)
Sets the passphrase.
voidsetPassword(String password)
Sets the password.
voidsetTrust(boolean trust)
Sets the trust.
voidshowMessage(String message)
Implement the UserInfo interface (noop).

Constructor Detail

SSHUserInfo

public SSHUserInfo()
Constructor for SSHUserInfo.

SSHUserInfo

public SSHUserInfo(String password, boolean trustAllCertificates)
Constructor for SSHUserInfo.

Parameters: password the user's password trustAllCertificates if true trust hosts whose identity is unknown

Method Detail

getKeyfile

public String getKeyfile()
Returns the keyfile.

Returns: String

getName

public String getName()
Gets the user name.

Returns: the user name

getPassphrase

public String getPassphrase(String message)
Gets the pass phrase of the user.

Parameters: message a message

Returns: the passphrase

getPassphrase

public String getPassphrase()
Returns the passphrase.

Returns: String

getPassword

public String getPassword()
Gets the user's password.

Returns: the user's password

getTrust

public boolean getTrust()

Returns: whether to trust or not.

prompt

public boolean prompt(String str)
Prompts a string.

Parameters: str the string

Returns: whether the string was prompted

promptKeyboardInteractive

public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo)
Implementation of UIKeyboardInteractive#promptKeyboardInteractive.

Parameters: destination not used. name not used. instruction not used. prompt the method checks if this is one in length. echo the method checks if the first element is false.

Returns: the password in an size one array if there is a password and if the prompt and echo checks pass.

promptPassphrase

public boolean promptPassphrase(String message)
Implement the UserInfo interface.

Parameters: message ignored

Returns: true always

promptPassword

public boolean promptPassword(String passwordPrompt)
Implement the UserInfo interface.

Parameters: passwordPrompt ignored

Returns: true the first time this is called, false otherwise

promptYesNo

public boolean promptYesNo(String message)
Implement the UserInfo interface.

Parameters: message ignored

Returns: the value of trustAllCertificates

retry

public boolean retry()
Indicates whether a retry was done.

Returns: whether a retry was done

setKeyfile

public void setKeyfile(String keyfile)
Sets the keyfile.

Parameters: keyfile The keyfile to set

setName

public void setName(String name)
Sets the name.

Parameters: name The name to set

setPassphrase

public void setPassphrase(String passphrase)
Sets the passphrase.

Parameters: passphrase The passphrase to set

setPassword

public void setPassword(String password)
Sets the password.

Parameters: password The password to set

setTrust

public void setTrust(boolean trust)
Sets the trust.

Parameters: trust whether to trust or not.

showMessage

public void showMessage(String message)
Implement the UserInfo interface (noop).

Parameters: message ignored