Class ConsolePasswordFinder
java.lang.Object
net.schmizz.sshj.userauth.password.ConsolePasswordFinder
- All Implemented Interfaces:
PasswordFinder
A PasswordFinder that reads a password from a console
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConsolePasswordFinder
(Console console) ConsolePasswordFinder
(Console console, String promptFormat, int maxTries) -
Method Summary
Modifier and TypeMethodDescriptionprivate static void
checkFormatString
(String promptFormat) char[]
reqPassword
(Resource<?> resource) Request password for specified resource.boolean
shouldRetry
(Resource<?> resource) If password turns out to be incorrect, indicates whether another call toPasswordFinder.reqPassword(Resource)
should be made.
-
Field Details
-
DEFAULT_FORMAT
- See Also:
-
console
-
promptFormat
-
maxTries
private final int maxTries -
numTries
private int numTries
-
-
Constructor Details
-
ConsolePasswordFinder
public ConsolePasswordFinder() -
ConsolePasswordFinder
-
ConsolePasswordFinder
-
-
Method Details
-
reqPassword
Description copied from interface:PasswordFinder
Request password for specified resource. This method may returnnull
when the request cannot be serviced, e.g. when the user cancels a password prompt.- Specified by:
reqPassword
in interfacePasswordFinder
- Parameters:
resource
- the resource for which password is being requested- Returns:
- the password or
null
-
shouldRetry
Description copied from interface:PasswordFinder
If password turns out to be incorrect, indicates whether another call toPasswordFinder.reqPassword(Resource)
should be made. This method is geared at interactive implementations, and stub implementations may simply returnfalse
.- Specified by:
shouldRetry
in interfacePasswordFinder
- Parameters:
resource
- the resource for which password is being requested- Returns:
- whether to retry requesting password for a particular resource
-
checkFormatString
-