Class SimpleUserInfo
- java.lang.Object
-
- com.github.robtimus.filesystems.sftp.SimpleUserInfo
-
- All Implemented Interfaces:
UserInfo
public class SimpleUserInfo extends Object implements UserInfo
A simpleUserInfoimplementation that always returns the same passphrase and password. It will not show any messages, andpromptYesNo(String)will always returnfalse. That means that it will not prompt if the authenticity of a host cannot be established, but will automatically answer the question with "no". Make sure to use aHostKeyRepositorythat can verify the host automatically.- Author:
- Rob Spoor
-
-
Constructor Summary
Constructors Constructor Description SimpleUserInfo(char[] password)Creates a newSimpleUserInfoobject with no passphrase.SimpleUserInfo(String passphrase, char[] password)Creates a newSimpleUserInfoobject.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetPassphrase()StringgetPassword()booleanpromptPassphrase(String message)booleanpromptPassword(String message)booleanpromptYesNo(String message)voidshowMessage(String message)
-
-
-
Constructor Detail
-
SimpleUserInfo
public SimpleUserInfo(char[] password)
Creates a newSimpleUserInfoobject with no passphrase.- Parameters:
password- The password to use.- Throws:
NullPointerException- If the password isnull.
-
SimpleUserInfo
public SimpleUserInfo(String passphrase, char[] password)
Creates a newSimpleUserInfoobject.- Parameters:
passphrase- The passphrase to use.password- The password to use.- Throws:
NullPointerException- If the password isnull.
-
-
Method Detail
-
getPassphrase
public String getPassphrase()
- Specified by:
getPassphrasein interfaceUserInfo
-
getPassword
public String getPassword()
- Specified by:
getPasswordin interfaceUserInfo
-
promptPassword
public boolean promptPassword(String message)
- Specified by:
promptPasswordin interfaceUserInfo
-
promptPassphrase
public boolean promptPassphrase(String message)
- Specified by:
promptPassphrasein interfaceUserInfo
-
promptYesNo
public boolean promptYesNo(String message)
- Specified by:
promptYesNoin interfaceUserInfo
-
showMessage
public void showMessage(String message)
- Specified by:
showMessagein interfaceUserInfo
-
-