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 forKeyboardInteractiveAuthenticatorwhere it prompts for the password.- Author:
- Apache MINA SSHD Project
-
-
Field Summary
Fields Modifier and Type Field Description static DefaultKeyboardInteractiveAuthenticatorINSTANCE-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
Fields inherited from interface org.apache.sshd.server.auth.keyboard.KeyboardInteractiveAuthenticator
NONE
-
-
Constructor Summary
Constructors Constructor Description DefaultKeyboardInteractiveAuthenticator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanauthenticate(ServerSession session, String username, List<String> responses)Called to authenticate the response to the challenge(s) sent previouslyInteractiveChallengegenerateChallenge(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 booleanisInteractionPromptEchoEnabled(ServerSession session)
-
-
-
Field Detail
-
INSTANCE
public static final DefaultKeyboardInteractiveAuthenticator INSTANCE
-
-
Method Detail
-
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
protected String getInteractionName(ServerSession session)
-
getInteractionInstruction
protected String getInteractionInstruction(ServerSession session)
-
getInteractionLanguage
protected String getInteractionLanguage(ServerSession session)
-
getInteractionPrompt
protected String getInteractionPrompt(ServerSession session)
-
isInteractionPromptEchoEnabled
protected boolean isInteractionPromptEchoEnabled(ServerSession session)
-
-