Class ConsolePasswordFinder
- java.lang.Object
-
- net.schmizz.sshj.userauth.password.ConsolePasswordFinder
-
- All Implemented Interfaces:
PasswordFinder
public class ConsolePasswordFinder extends java.lang.Object implements PasswordFinder
A PasswordFinder that reads a password from a console
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_FORMAT
-
Constructor Summary
Constructors Constructor Description ConsolePasswordFinder()ConsolePasswordFinder(java.io.Console console)ConsolePasswordFinder(java.io.Console console, java.lang.String promptFormat, int maxTries)
-
Method Summary
Modifier and Type Method Description char[]reqPassword(Resource<?> resource)Request password for specified resource.booleanshouldRetry(Resource<?> resource)If password turns out to be incorrect, indicates whether another call toPasswordFinder.reqPassword(Resource)should be made.
-
-
-
Field Detail
-
DEFAULT_FORMAT
public static final java.lang.String DEFAULT_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
reqPassword
public char[] reqPassword(Resource<?> resource)
Description copied from interface:PasswordFinderRequest password for specified resource. This method may returnnullwhen the request cannot be serviced, e.g. when the user cancels a password prompt.- Specified by:
reqPasswordin interfacePasswordFinder- Parameters:
resource- the resource for which password is being requested- Returns:
- the password or
null
-
shouldRetry
public boolean shouldRetry(Resource<?> resource)
Description copied from interface:PasswordFinderIf 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:
shouldRetryin interfacePasswordFinder- Parameters:
resource- the resource for which password is being requested- Returns:
- whether to retry requesting password for a particular resource
-
-