Top Description Fields Constructors Methods
org.apache.sshd.client.auth.keyboard

public Class UserAuthKeyboardInteractive

extends AbstractUserAuth
Class Inheritance
Imports
java.util.Iterator, java.util.concurrent.atomic.AtomicBoolean, org.apache.sshd.client.auth.AbstractUserAuth, org.apache.sshd.client.session.ClientSession, org.apache.sshd.common.PropertyResolverUtils, .RuntimeSshException, .SshConstants, org.apache.sshd.common.util.GenericUtils, org.apache.sshd.common.util.buffer.Buffer, org.apache.sshd.core.CoreModuleProperties

Manages a "keyboard-interactive" exchange according to RFC4256
Author
Apache MINA SSHD Project

Field Summary

Modifier and TypeField and Description
private int
public static final String
private int
private Iterator<String>
private final AtomicBoolean
private boolean
private boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String
protected String
protected String
protected String
protected String[]

Returns:

The response for each prompt - if null then the assumption is that some internal error occurred and no response is sent

Note

according to RFC4256 the number of responses should be exactly the same as the number of prompts. However, since it is the server's responsibility to enforce this we do not validate the response (other than logging it as a warning...)

getUserResponses
(String
The interaction name - may be empty
name
,
String
The instruction - may be empty
instruction
,
String
The language tag - may be empty
lang
,
String[]
The prompts - may be empty
prompt
,
boolean[]
Whether to echo the response for the prompt or not - same length as the prompts
echo
)

public void
protected boolean
protected boolean
protected boolean

Returns:

Whether to use the password candidate as reply to the prompts
useCurrentPassword
(ClientSession
The ClientSession through which the request is received
session
,
String
The current password candidate to use
password
,
String
The service name
name
,
String
The request instruction
instruction
,
String
The reported language tag
lang
,
String[]
The requested prompts
prompt
,
boolean[]
The matching prompts echo flags
echo
)

Checks if we have a candidate password and exactly one prompt is requested with no echo, and the prompt matches a configurable pattern.

protected boolean
verifyTrialsCount(ClientSession session, String service, int cmd, int nbTrials, int maxAllowed)

Inherited from org.apache.sshd.client.auth.AbstractUserAuth:
destroygetClientSessiongetNamegetServicegetSessionisCancellableprocesssetCancellabletoString

Field Detail

maxAttemptsback to summary
private int maxAttempts
NAMEback to summary
public static final String NAME
nOfAttemptsback to summary
private int nOfAttempts
passwordsback to summary
private Iterator<String> passwords
requestPendingback to summary
private final AtomicBoolean requestPending
wasChallengedback to summary
private boolean wasChallenged
withUserInteractionback to summary
private boolean withUserInteraction

Constructor Detail

UserAuthKeyboardInteractiveback to summary
public UserAuthKeyboardInteractive()

Method Detail

getAuthCommandNameback to summary
public static String getAuthCommandName(int cmd)
getCurrentPasswordCandidateback to summary
protected String getCurrentPasswordCandidate()
getExchangeLanguageTagback to summary
protected String getExchangeLanguageTag(ClientSession session)
getExchangeSubMethodsback to summary
protected String getExchangeSubMethods(ClientSession session)
getUserResponsesback to summary
protected String[] getUserResponses(String name, String instruction, String lang, String[] prompt, boolean[] echo)
Parameters
name:String

The interaction name - may be empty

instruction:String

The instruction - may be empty

lang:String

The language tag - may be empty

prompt:String[]

The prompts - may be empty

echo:boolean[]

Whether to echo the response for the prompt or not - same length as the prompts

Returns:String[]

The response for each prompt - if null then the assumption is that some internal error occurred and no response is sent

Note

according to RFC4256 the number of responses should be exactly the same as the number of prompts. However, since it is the server's responsibility to enforce this we do not validate the response (other than logging it as a warning...)

initback to summary
public void init(ClientSession session, String service) throws Exception

Overrides org.apache.sshd.client.auth.AbstractUserAuth.init.

Implements org.apache.sshd.client.auth.UserAuth.init.

Parameters
session:ClientSession

Doc from org.apache.sshd.client.auth.UserAuth.init.

The ClientSession

service:String

Doc from org.apache.sshd.client.auth.UserAuth.init.

The requesting service name

Annotations
@Override
Exceptions
Exception:

Doc from org.apache.sshd.client.auth.UserAuth.init.

If failed to initialize the mechanism

processAuthDataRequestback to summary
protected boolean processAuthDataRequest(ClientSession session, String service, Buffer buffer) throws Exception

Implements abstract org.apache.sshd.client.auth.AbstractUserAuth.processAuthDataRequest.

Annotations
@Override
sendAuthDataRequestback to summary
protected boolean sendAuthDataRequest(ClientSession session, String service) throws Exception

Implements abstract org.apache.sshd.client.auth.AbstractUserAuth.sendAuthDataRequest.

Annotations
@Override
useCurrentPasswordback to summary
protected boolean useCurrentPassword(ClientSession session, String password, String name, String instruction, String lang, String[] prompt, boolean[] echo)

Checks if we have a candidate password and exactly one prompt is requested with no echo, and the prompt matches a configurable pattern.

Parameters
session:ClientSession

The ClientSession through which the request is received

password:String

The current password candidate to use

name:String

The service name

instruction:String

The request instruction

lang:String

The reported language tag

prompt:String[]

The requested prompts

echo:boolean[]

The matching prompts echo flags

Returns:boolean

Whether to use the password candidate as reply to the prompts

See Also
INTERACTIVE_PASSWORD_PROMPT, CHECK_INTERACTIVE_PASSWORD_DELIM
verifyTrialsCountback to summary
protected boolean verifyTrialsCount(ClientSession session, String service, int cmd, int nbTrials, int maxAllowed)