273
|
1 /*
|
|
2 * Copyright (c) 2006-2011 Christian Plattner. All rights reserved.
|
|
3 * Please refer to the LICENSE.txt for licensing details.
|
|
4 */
|
|
5 package ch.ethz.ssh2;
|
|
6
|
|
7 /**
|
|
8 * An <code>InteractiveCallback</code> is used to respond to challenges sent
|
|
9 * by the server if authentication mode "keyboard-interactive" is selected.
|
307
|
10 *
|
273
|
11 * @see Connection#authenticateWithKeyboardInteractive(String,
|
|
12 * String[], InteractiveCallback)
|
307
|
13 *
|
273
|
14 * @author Christian Plattner
|
|
15 * @version 2.50, 03/15/10
|
|
16 */
|
|
17
|
307
|
18 public interface InteractiveCallback {
|
|
19 /**
|
|
20 * This callback interface is used during a "keyboard-interactive"
|
|
21 * authentication. Every time the server sends a set of challenges (however,
|
|
22 * most often just one challenge at a time), this callback function will be
|
|
23 * called to give your application a chance to talk to the user and to
|
|
24 * determine the response(s).
|
|
25 * <p>
|
|
26 * Some copy-paste information from the standard: a command line interface
|
|
27 * (CLI) client SHOULD print the name and instruction (if non-empty), adding
|
|
28 * newlines. Then for each prompt in turn, the client SHOULD display the
|
|
29 * prompt and read the user input. The name and instruction fields MAY be
|
|
30 * empty strings, the client MUST be prepared to handle this correctly. The
|
|
31 * prompt field(s) MUST NOT be empty strings.
|
|
32 * <p>
|
|
33 * Please refer to draft-ietf-secsh-auth-kbdinteract-XX.txt for the details.
|
|
34 * <p>
|
|
35 * Note: clients SHOULD use control character filtering as discussed in
|
|
36 * RFC4251 to avoid attacks by including
|
|
37 * terminal control characters in the fields to be displayed.
|
|
38 *
|
|
39 * @param name
|
|
40 * the name String sent by the server.
|
|
41 * @param instruction
|
|
42 * the instruction String sent by the server.
|
|
43 * @param numPrompts
|
|
44 * number of prompts - may be zero (in this case, you should just
|
|
45 * return a String array of length zero).
|
|
46 * @param prompt
|
|
47 * an array (length <code>numPrompts</code>) of Strings
|
|
48 * @param echo
|
|
49 * an array (length <code>numPrompts</code>) of booleans. For
|
|
50 * each prompt, the corresponding echo field indicates whether or
|
|
51 * not the user input should be echoed as characters are typed.
|
|
52 * @return an array of reponses - the array size must match the parameter
|
|
53 * <code>numPrompts</code>.
|
|
54 */
|
|
55 public String[] replyToChallenge(String name, String instruction, int numPrompts, String[] prompt, boolean[] echo)
|
|
56 throws Exception;
|
273
|
57 }
|