edu.harvard.mgh.purcell.gCLINE.data
Class OpenSSHConnection.InteractiveLogic
java.lang.Object
edu.harvard.mgh.purcell.gCLINE.data.OpenSSHConnection.InteractiveLogic
- All Implemented Interfaces:
- ch.ethz.ssh2.InteractiveCallback
- Enclosing class:
- OpenSSHConnection
class OpenSSHConnection.InteractiveLogic
- extends java.lang.Object
- implements ch.ethz.ssh2.InteractiveCallback
The logic that one has to implement if "keyboard-interactive" autentication shall be
supported.
Method Summary |
int |
getPromptCount()
|
java.lang.String[] |
replyToChallenge(java.lang.String name,
java.lang.String instruction,
int numPrompts,
java.lang.String[] prompt,
boolean[] echo)
This callback interface is used during a "keyboard-interactive"
authentication. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
promptCount
int promptCount
lastError
java.lang.String lastError
OpenSSHConnection.InteractiveLogic
public OpenSSHConnection.InteractiveLogic(java.lang.String lastError)
replyToChallenge
public java.lang.String[] replyToChallenge(java.lang.String name,
java.lang.String instruction,
int numPrompts,
java.lang.String[] prompt,
boolean[] echo)
throws java.io.IOException
- Description copied from interface:
ch.ethz.ssh2.InteractiveCallback
- This callback interface is used during a "keyboard-interactive"
authentication. Every time the server sends a set of challenges (however,
most often just one challenge at a time), this callback function will be
called to give your application a chance to talk to the user and to
determine the response(s).
Some copy-paste information from the standard: a command line interface
(CLI) client SHOULD print the name and instruction (if non-empty), adding
newlines. Then for each prompt in turn, the client SHOULD display the
prompt and read the user input. The name and instruction fields MAY be
empty strings, the client MUST be prepared to handle this correctly. The
prompt field(s) MUST NOT be empty strings.
Please refer to draft-ietf-secsh-auth-kbdinteract-XX.txt for the details.
Note: clients SHOULD use control character filtering as discussed in
[draft-ietf-secsh-architecture-XX.txt] to avoid attacks by including
terminal control characters in the fields to be displayed.
- Specified by:
replyToChallenge
in interface ch.ethz.ssh2.InteractiveCallback
- Parameters:
name
- the name String sent by the server.instruction
- the instruction String sent by the server.numPrompts
- number of prompts - may be zero (in this case, you should just
return a String array of length zero).prompt
- an array (length numPrompts
) of Stringsecho
- an array (length numPrompts
) of booleans. For
each prompt, the corresponding echo field indicates whether or
not the user input should be echoed as characters are typed.
- Returns:
- an array of reponses - the array size must match the parameter
numPrompts
.
- Throws:
java.io.IOException
getPromptCount
public int getPromptCount()