public interface UserInteraction
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
AUTO_DETECT_PASSWORD_PROMPT
Whether to auto-detect password challenge prompt
|
static java.lang.String |
CHECK_INTERACTIVE_PASSWORD_DELIM
If password prompt detected then check it ends with any of the comma separated list of these values.
|
static boolean |
DEFAULT_AUTO_DETECT_PASSWORD_PROMPT
Default value for "user-interaction-auto-detect-password-prompt"
|
static java.lang.String |
DEFAULT_CHECK_INTERACTIVE_PASSWORD_DELIM
Default value of "user-interaction-check-password-delimiter"
|
static java.lang.String |
DEFAULT_INTERACTIVE_PASSWORD_PROMPT
Default value for "user-interaction-password-prompt"
|
static java.lang.String |
INTERACTIVE_PASSWORD_PROMPT
Comma separated list of values used to detect request for a password in interactive mode.
|
static UserInteraction |
NONE
A useful "placeholder" that indicates that no interaction is expected.
|
Modifier and Type | Method and Description |
---|---|
static int |
findPromptComponentLastPosition(java.lang.String prompt,
java.lang.String tokensList) |
java.lang.String |
getUpdatedPassword(ClientSession session,
java.lang.String prompt,
java.lang.String lang)
Invoked when the server returns an
SSH_MSG_USERAUTH_PASSWD_CHANGEREQ response indicating that the
password should be changed - e.g., expired or not strong enough (as per the server's policy). |
java.lang.String[] |
interactive(ClientSession session,
java.lang.String name,
java.lang.String instruction,
java.lang.String lang,
java.lang.String[] prompt,
boolean[] echo)
Invoked when "keyboard-interactive" authentication mechanism is used in order to provide responses for
the server's challenges (a.k.a.
|
default boolean |
isInteractionAllowed(ClientSession session) |
default java.lang.String |
resolveAuthPasswordAttempt(ClientSession session)
Invoked during password authentication when no more pre-registered passwords are available
|
default java.security.KeyPair |
resolveAuthPublicKeyIdentityAttempt(ClientSession session)
Invoked during public key authentication when no more pre-registered keys are available
|
default void |
serverVersionInfo(ClientSession session,
java.util.List<java.lang.String> lines)
Called if the server sent any extra information beyond the standard version line
|
default void |
welcome(ClientSession session,
java.lang.String banner,
java.lang.String lang)
Displays the welcome banner to the user.
|
static final java.lang.String AUTO_DETECT_PASSWORD_PROMPT
static final boolean DEFAULT_AUTO_DETECT_PASSWORD_PROMPT
static final java.lang.String INTERACTIVE_PASSWORD_PROMPT
static final java.lang.String DEFAULT_INTERACTIVE_PASSWORD_PROMPT
static final java.lang.String CHECK_INTERACTIVE_PASSWORD_DELIM
static final java.lang.String DEFAULT_CHECK_INTERACTIVE_PASSWORD_DELIM
static final UserInteraction NONE
IllegalStateException
is any of the interaction methods is calleddefault boolean isInteractionAllowed(ClientSession session)
session
- The ClientSession
true
if user interaction allowed for this session (default)default void serverVersionInfo(ClientSession session, java.util.List<java.lang.String> lines)
session
- The ClientSession
through which this information was receivedlines
- The sent extra lines - without the server versiondefault void welcome(ClientSession session, java.lang.String banner, java.lang.String lang)
session
- The ClientSession
through which the banner was receivedbanner
- The welcome bannerlang
- The banner language code - may be emptyjava.lang.String[] interactive(ClientSession session, java.lang.String name, java.lang.String instruction, java.lang.String lang, java.lang.String[] prompt, boolean[] echo)
session
- The ClientSession
through which the request was receivedname
- The interaction name (may be empty)instruction
- The instruction (may be empty)lang
- The language for the data (may be empty)prompt
- The prompts to be displayed (may be empty)echo
- For each prompt whether to echo the user's responsejava.lang.String getUpdatedPassword(ClientSession session, java.lang.String prompt, java.lang.String lang)
SSH_MSG_USERAUTH_PASSWD_CHANGEREQ
response indicating that the
password should be changed - e.g., expired or not strong enough (as per the server's policy).session
- The ClientSession
through which the request was receivedprompt
- The server's prompt (may be empty)lang
- The prompt's language (may be empty)null
/empty then no updated password was provided - thus failing
the authentication via passwords (Note: authentication might still succeed via some other
means - be it other passwords, public keys, etc...)default java.lang.String resolveAuthPasswordAttempt(ClientSession session) throws java.lang.Exception
session
- The ClientSession
through which the request was receivednull
signals no more passwords availablejava.lang.Exception
- if failed to handle the request - Note: may cause session terminationdefault java.security.KeyPair resolveAuthPublicKeyIdentityAttempt(ClientSession session) throws java.lang.Exception
session
- The ClientSession
through which the request was receivedKeyPair
to use - null
signals no more keys availablejava.lang.Exception
- if failed to handle the request - Note: may cause session terminationstatic int findPromptComponentLastPosition(java.lang.String prompt, java.lang.String tokensList)
prompt
- The user interaction prompttokensList
- A comma-separated list of tokens whose last index is prompt is sought.