comparison src/ch/ethz/ssh2/ServerAuthenticationCallback.java @ 273:91a31873c42a ganymed

start conversion from trilead to ganymed
author Carl Byington <carl@five-ten-sg.com>
date Fri, 18 Jul 2014 11:21:46 -0700
parents
children 071eccdff8ea
comparison
equal deleted inserted replaced
272:ce2f4e397703 273:91a31873c42a
1 /*
2 * Copyright (c) 2012-2013 Christian Plattner. All rights reserved.
3 * Please refer to the LICENSE.txt for licensing details.
4 */
5
6 package ch.ethz.ssh2;
7
8 /**
9 * A callback used during the authentication phase (see RFC 4252) when
10 * implementing a SSH server.
11 *
12 * @author Christian Plattner
13 * @version 2.50, 03/15/10
14 */
15 public interface ServerAuthenticationCallback
16 {
17 /**
18 * The method name for host-based authentication.
19 */
20 public final String METHOD_HOSTBASED = "hostbased";
21
22 /**
23 * The method name for public-key authentication.
24 */
25 public final String METHOD_PUBLICKEY = "publickey";
26
27 /**
28 * The method name for password authentication.
29 */
30 public final String METHOD_PASSWORD = "password";
31
32 /**
33 * Called when the client enters authentication.
34 * This gives you the chance to set a custom authentication banner
35 * for this SSH-2 session. This is the first method called in this interface.
36 * It will only called at most once per <code>ServerConnection</code>.
37 *
38 * @param sc The corresponding <code>ServerConnection</code>
39 * @return The authentication banner or <code>NULL</code> in case no banner should be send.
40 */
41 public String initAuthentication(ServerConnection sc);
42
43 /**
44 * Return the authentication methods that are currently available to the client.
45 * Be prepared to return this information at any time during the authentication procedure.
46 * <p/>
47 * The returned name-list of 'method names' (see RFC4252) indicate the authentication methods
48 * that may productively continue the authentication dialog.
49 * </p>
50 * It is RECOMMENDED that servers only include those 'method name'
51 * values in the name-list that are actually useful. However, it is not
52 * illegal to include 'method name' values that cannot be used to
53 * authenticate the user.
54 * <p/>
55 * Already successfully completed authentications SHOULD NOT be included
56 * in the name-list, unless they should be performed again for some reason.
57 *
58 * @see #METHOD_HOSTBASED
59 * @see #METHOD_PASSWORD
60 * @see #METHOD_PUBLICKEY
61 *
62 * @param sc
63 * @return A list of method names.
64 */
65 public String[] getRemainingAuthMethods(ServerConnection sc);
66
67 /**
68 * Typically, this will be called be the client to get the list of
69 * authentication methods that can continue. You should simply return
70 * {@link AuthenticationResult#FAILURE}.
71 *
72 * @param sc
73 * @param username Name of the user that wants to log in with the "none" method.
74 * @return
75 */
76 public AuthenticationResult authenticateWithNone(ServerConnection sc, String username);
77
78 public AuthenticationResult authenticateWithPassword(ServerConnection sc, String username, String password);
79
80 /**
81 * NOTE: Not implemented yet.
82 *
83 * @param sc
84 * @param username
85 * @param algorithm
86 * @param publickey
87 * @param signature
88 * @return
89 */
90 public AuthenticationResult authenticateWithPublicKey(ServerConnection sc, String username, String algorithm,
91 byte[] publickey, byte[] signature);
92 }