FileDocCategorySizeDatePackage
SSHUserInfo.javaAPI DocApache Ant 1.705719Wed Dec 13 06:16:22 GMT 2006org.apache.tools.ant.taskdefs.optional.ssh

SSHUserInfo

public class SSHUserInfo extends Object implements com.jcraft.jsch.UIKeyboardInteractive, com.jcraft.jsch.UserInfo
Class containing information on an SSH user.

Fields Summary
private String
name
private String
password
private String
keyfile
private String
passphrase
private boolean
trustAllCertificates
Constructors Summary
public SSHUserInfo()
Constructor for SSHUserInfo.


        
      
        super();
        this.trustAllCertificates = false;
    
public SSHUserInfo(String password, boolean trustAllCertificates)
Constructor for SSHUserInfo.

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

        super();
        this.password = password;
        this.trustAllCertificates = trustAllCertificates;
    
Methods Summary
public java.lang.StringgetKeyfile()
Returns the keyfile.

return
String

        return keyfile;
    
public java.lang.StringgetName()
Gets the user name.

return
the user name

        return name;
    
public java.lang.StringgetPassphrase()
Returns the passphrase.

return
String

        return passphrase;
    
public java.lang.StringgetPassphrase(java.lang.String message)
Gets the pass phrase of the user.

param
message a message
return
the passphrase

        return passphrase;
    
public java.lang.StringgetPassword()
Gets the user's password.

return
the user's password

        return password;
    
public booleangetTrust()

return
whether to trust or not.

        return this.trustAllCertificates;
    
public booleanprompt(java.lang.String str)
Prompts a string.

param
str the string
return
whether the string was prompted

        return false;
    
public java.lang.String[]promptKeyboardInteractive(java.lang.String destination, java.lang.String name, java.lang.String instruction, java.lang.String[] prompt, boolean[] echo)
Implementation of UIKeyboardInteractive#promptKeyboardInteractive.

param
destination not used.
param
name not used.
param
instruction not used.
param
prompt the method checks if this is one in length.
param
echo the method checks if the first element is false.
return
the password in an size one array if there is a password and if the prompt and echo checks pass.

        if (prompt.length != 1 || echo[0] || this.password == null) {
            return null;
        }
        String[] response = new String[1];
        response[0] = this.password;
        return response;
    
public booleanpromptPassphrase(java.lang.String message)
Implement the UserInfo interface.

param
message ignored
return
true always

        return true;
    
public booleanpromptPassword(java.lang.String passwordPrompt)
Implement the UserInfo interface.

param
passwordPrompt ignored
return
true the first time this is called, false otherwise

        return true;
    
public booleanpromptYesNo(java.lang.String message)
Implement the UserInfo interface.

param
message ignored
return
the value of trustAllCertificates

        return trustAllCertificates;
    
public booleanretry()
Indicates whether a retry was done.

return
whether a retry was done

        return false;
    
public voidsetKeyfile(java.lang.String keyfile)
Sets the keyfile.

param
keyfile The keyfile to set

        this.keyfile = keyfile;
    
public voidsetName(java.lang.String name)
Sets the name.

param
name The name to set

        this.name = name;
    
public voidsetPassphrase(java.lang.String passphrase)
Sets the passphrase.

param
passphrase The passphrase to set

        this.passphrase = passphrase;
    
public voidsetPassword(java.lang.String password)
Sets the password.

param
password The password to set

        this.password = password;
    
public voidsetTrust(boolean trust)
Sets the trust.

param
trust whether to trust or not.

        this.trustAllCertificates = trust;
    
public voidshowMessage(java.lang.String message)
Implement the UserInfo interface (noop).

param
message ignored

        //log(message, Project.MSG_DEBUG);