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.- Author:
- Apache MINA SSHD Project
-
Field Summary
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
-
Method Summary
Modifier and TypeMethodDescriptionboolean
authenticate
(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 String
getInteractionInstruction
(ServerSession session) protected String
getInteractionLanguage
(ServerSession session) protected String
getInteractionName
(ServerSession session) protected String
getInteractionPrompt
(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:KeyboardInteractiveAuthenticator
Generates the interactive "challenge" to send to the client- Specified by:
generateChallenge
in interfaceKeyboardInteractiveAuthenticator
- Parameters:
session
- TheServerSession
through which the request was receivedusername
- The usernamelang
- The language tagsubMethods
- Sub-methods hints sent by the client- Returns:
- The
InteractiveChallenge
- ifnull
then 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:KeyboardInteractiveAuthenticator
Called to authenticate the response to the challenge(s) sent previously- Specified by:
authenticate
in interfaceKeyboardInteractiveAuthenticator
- Parameters:
session
- TheServerSession
through 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:
true
if responses have been validated- Throws:
Exception
- if bad responses and server should terminate the connection
-
getInteractionName
-
getInteractionInstruction
-
getInteractionLanguage
-
getInteractionPrompt
-
isInteractionPromptEchoEnabled
-