comparison app/src/main/java/ch/ethz/ssh2/ServerAuthenticationCallback.java @ 438:d29cce60f393

migrate from Eclipse to Android Studio
author Carl Byington <carl@five-ten-sg.com>
date Thu, 03 Dec 2015 11:23:55 -0800
parents src/ch/ethz/ssh2/ServerAuthenticationCallback.java@071eccdff8ea
children
comparison
equal deleted inserted replaced
437:208b31032318 438:d29cce60f393
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 * The method name for host-based authentication.
18 */
19 public final String METHOD_HOSTBASED = "hostbased";
20
21 /**
22 * The method name for public-key authentication.
23 */
24 public final String METHOD_PUBLICKEY = "publickey";
25
26 /**
27 * The method name for password authentication.
28 */
29 public final String METHOD_PASSWORD = "password";
30
31 /**
32 * Called when the client enters authentication.
33 * This gives you the chance to set a custom authentication banner
34 * for this SSH-2 session. This is the first method called in this interface.
35 * It will only called at most once per <code>ServerConnection</code>.
36 *
37 * @param sc The corresponding <code>ServerConnection</code>
38 * @return The authentication banner or <code>NULL</code> in case no banner should be send.
39 */
40 public String initAuthentication(ServerConnection sc);
41
42 /**
43 * Return the authentication methods that are currently available to the client.
44 * Be prepared to return this information at any time during the authentication procedure.
45 * <p/>
46 * The returned name-list of 'method names' (see RFC4252) indicate the authentication methods
47 * that may productively continue the authentication dialog.
48 * </p>
49 * It is RECOMMENDED that servers only include those 'method name'
50 * values in the name-list that are actually useful. However, it is not
51 * illegal to include 'method name' values that cannot be used to
52 * authenticate the user.
53 * <p/>
54 * Already successfully completed authentications SHOULD NOT be included
55 * in the name-list, unless they should be performed again for some reason.
56 *
57 * @see #METHOD_HOSTBASED
58 * @see #METHOD_PASSWORD
59 * @see #METHOD_PUBLICKEY
60 *
61 * @param sc
62 * @return A list of method names.
63 */
64 public String[] getRemainingAuthMethods(ServerConnection sc);
65
66 /**
67 * Typically, this will be called be the client to get the list of
68 * authentication methods that can continue. You should simply return
69 * {@link AuthenticationResult#FAILURE}.
70 *
71 * @param sc
72 * @param username Name of the user that wants to log in with the "none" method.
73 * @return
74 */
75 public AuthenticationResult authenticateWithNone(ServerConnection sc, String username);
76
77 public AuthenticationResult authenticateWithPassword(ServerConnection sc, String username, String password);
78
79 /**
80 * NOTE: Not implemented yet.
81 *
82 * @param sc
83 * @param username
84 * @param algorithm
85 * @param publickey
86 * @param signature
87 * @return
88 */
89 public AuthenticationResult authenticateWithPublicKey(ServerConnection sc, String username, String algorithm,
90 byte[] publickey, byte[] signature);
91 }