SSHUserInfo (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.taskdefs.optional.ssh, class: SSHUserInfo

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

# Class SSHUserInfo

java.lang.Object
org.apache.tools.ant.taskdefs.optional.ssh.SSHUserInfo

All Implemented Interfaces:
  `com.jcraft.jsch.UIKeyboardInteractive`, `com.jcraft.jsch.UserInfo`

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SSHUserInfo()`
  Constructor for SSHUserInfo.
  `SSHUserInfo​(String password, boolean trustAllCertificates)`
  Constructor for SSHUserInfo.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getKeyfile()`
  Returns the keyfile.
  `String`
  `getName()`
  Gets the user name.
  `String`
  `getPassphrase()`
  Returns the passphrase.
  `String`
  `getPassphrase​(String message)`
  Gets the pass phrase of the user.
  `String`
  `getPassword()`
  Gets the user's password.
  `boolean`
  `getTrust()`
  `boolean`
  `prompt​(String str)`
  Prompts a string.
  `String[]`
  `promptKeyboardInteractive​(String destination, String name, String instruction, String[] prompt, boolean[] echo)`
  Implementation of UIKeyboardInteractive#promptKeyboardInteractive.
  `boolean`
  `promptPassphrase​(String message)`
  Implement the UserInfo interface.
  `boolean`
  `promptPassword​(String passwordPrompt)`
  Implement the UserInfo interface.
  `boolean`
  `promptYesNo​(String message)`
  Implement the UserInfo interface.
  `boolean`
  `retry()`
  Indicates whether a retry was done.
  `void`
  `setKeyfile​(String keyfile)`
  Sets the keyfile.
  `void`
  `setName​(String name)`
  Sets the name.
  `void`
  `setPassphrase​(String passphrase)`
  Sets the passphrase.
  `void`
  `setPassword​(String password)`
  Sets the password.
  `void`
  `setTrust​(boolean trust)`
  Sets the trust.
  `void`
  `showMessage​(String message)`
  Implement the UserInfo interface (noop).

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### 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 Details

  - ### 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

  - ### getPassword

    public String getPassword()
    Gets the user's password.
    Specified by:
      `getPassword` in interface `com.jcraft.jsch.UserInfo`
    Returns:
      the user's password

  - ### prompt

    public boolean prompt​(String str)
    Prompts a string.
    Parameters:
      `str` - the string
    Returns:
      whether the string was prompted

  - ### retry

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

  - ### 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.

  - ### getTrust

    public boolean getTrust()
    Returns:
      whether to trust or not.

  - ### getPassphrase

    public String getPassphrase()
    Returns the passphrase.
    Specified by:
      `getPassphrase` in interface `com.jcraft.jsch.UserInfo`
    Returns:
      String

  - ### getKeyfile

    public String getKeyfile()
    Returns the keyfile.
    Returns:
      String

  - ### setKeyfile

    public void setKeyfile​(String keyfile)
    Sets the keyfile.
    Parameters:
      `keyfile` - The keyfile to set

  - ### promptPassphrase

    public boolean promptPassphrase​(String message)
    Implement the UserInfo interface.
    Specified by:
      `promptPassphrase` in interface `com.jcraft.jsch.UserInfo`
    Parameters:
      `message` - ignored
    Returns:
      true always

  - ### promptPassword

    public boolean promptPassword​(String passwordPrompt)
    Implement the UserInfo interface.
    Specified by:
      `promptPassword` in interface `com.jcraft.jsch.UserInfo`
    Parameters:
      `passwordPrompt` - ignored
    Returns:
      true the first time this is called, false otherwise

  - ### promptYesNo

    public boolean promptYesNo​(String message)
    Implement the UserInfo interface.
    Specified by:
      `promptYesNo` in interface `com.jcraft.jsch.UserInfo`
    Parameters:
      `message` - ignored
    Returns:
      the value of trustAllCertificates

  - ### showMessage

    public void showMessage​(String message)
    Implement the UserInfo interface (noop).
    Specified by:
      `showMessage` in interface `com.jcraft.jsch.UserInfo`
    Parameters:
      `message` - ignored

  - ### promptKeyboardInteractive

    public String[] promptKeyboardInteractive​(String destination, String name, String instruction, String[] prompt, boolean[] echo)
    Implementation of UIKeyboardInteractive#promptKeyboardInteractive.
    Specified by:
      `promptKeyboardInteractive` in interface `com.jcraft.jsch.UIKeyboardInteractive`
    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.