public class SimpleUserInfo extends Object implements UserInfo
UserInfo
implementation that always returns the same passphrase and password.
It will not show any messages, and promptYesNo(String)
will always return false
.
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 a HostKeyRepository
that can verify the host automatically.Constructor and Description |
---|
SimpleUserInfo(char[] password)
Creates a new
SimpleUserInfo object with no passphrase. |
SimpleUserInfo(String passphrase,
char[] password)
Creates a new
SimpleUserInfo object. |
Modifier and Type | Method and Description |
---|---|
String |
getPassphrase() |
String |
getPassword() |
boolean |
promptPassphrase(String message) |
boolean |
promptPassword(String message) |
boolean |
promptYesNo(String message) |
void |
showMessage(String message) |
public SimpleUserInfo(char[] password)
SimpleUserInfo
object with no passphrase.password
- The password to use.NullPointerException
- If the password is null
.public SimpleUserInfo(String passphrase, char[] password)
SimpleUserInfo
object.passphrase
- The passphrase to use.password
- The password to use.NullPointerException
- If the password is null
.public String getPassphrase()
getPassphrase
in interface UserInfo
public String getPassword()
getPassword
in interface UserInfo
public boolean promptPassword(String message)
promptPassword
in interface UserInfo
public boolean promptPassphrase(String message)
promptPassphrase
in interface UserInfo
public boolean promptYesNo(String message)
promptYesNo
in interface UserInfo
public void showMessage(String message)
showMessage
in interface UserInfo
Copyright © 2016–2023. All rights reserved.