Class DefaultKeyboardInteractiveAuthenticator
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.server.auth.keyboard.DefaultKeyboardInteractiveAuthenticator
- All Implemented Interfaces:
KeyboardInteractiveAuthenticator
public class DefaultKeyboardInteractiveAuthenticator
extends AbstractLoggingBean
implements KeyboardInteractiveAuthenticator
Provides a default implementation for
KeyboardInteractiveAuthenticator where it prompts for the password.-
Field Summary
FieldsFields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
logFields inherited from interface org.apache.sshd.server.auth.keyboard.KeyboardInteractiveAuthenticator
NONE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanauthenticate(ServerSession session, String username, List<String> responses) Called to authenticate the response to the challenge(s) sent previouslygenerateChallenge(ServerSession session, String username, String lang, String subMethods) Generates the interactive "challenge" to send to the clientprotected StringgetInteractionInstruction(ServerSession session) protected StringgetInteractionLanguage(ServerSession session) protected StringgetInteractionName(ServerSession session) protected StringgetInteractionPrompt(ServerSession session) protected boolean
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
DefaultKeyboardInteractiveAuthenticator
public DefaultKeyboardInteractiveAuthenticator()
-
-
Method Details
-
generateChallenge
public InteractiveChallenge generateChallenge(ServerSession session, String username, String lang, String subMethods) throws Exception Description copied from interface:KeyboardInteractiveAuthenticatorGenerates the interactive "challenge" to send to the client- Specified by:
generateChallengein interfaceKeyboardInteractiveAuthenticator- Parameters:
session- TheServerSessionthrough which the request was receivedusername- The usernamelang- The language tagsubMethods- Sub-methods hints sent by the client- Returns:
- The
InteractiveChallenge- ifnullthen authentication attempt via "keyboard-interactive" method is rejected - Throws:
Exception- If unable to generate the challenge
-
authenticate
public boolean authenticate(ServerSession session, String username, List<String> responses) throws Exception Description copied from interface:KeyboardInteractiveAuthenticatorCalled to authenticate the response to the challenge(s) sent previously- Specified by:
authenticatein interfaceKeyboardInteractiveAuthenticator- Parameters:
session- TheServerSessionthrough which the response was receivedusername- The usernameresponses- The received responses - Note: it is up to the authenticator to make sure that the number of responses matches the number of prompts sent in the initial challenge. The order of the responses matches the order of the prompts sent to the client- Returns:
trueif responses have been validated- Throws:
Exception- if bad responses and server should terminate the connection
-
getInteractionName
-
getInteractionInstruction
-
getInteractionLanguage
-
getInteractionPrompt
-
isInteractionPromptEchoEnabled
-