summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/certsrv/ldap/ILdapAuthInfo.java
blob: 13cadf2ab2c7e7e0bd2276cc315e7e3a29c6b4c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// --- BEGIN COPYRIGHT BLOCK ---
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// (C) 2007 Red Hat, Inc.
// All rights reserved.
// --- END COPYRIGHT BLOCK ---
package com.netscape.certsrv.ldap;


import java.util.Hashtable;
import netscape.ldap.LDAPConnection;
import netscape.ldap.LDAPException;
import org.mozilla.jss.util.Password;
import org.mozilla.jss.util.PasswordCallback;
import org.mozilla.jss.util.PasswordCallbackInfo;
import org.mozilla.jss.util.ConsolePasswordCallback;
import com.netscape.certsrv.base.*;
import com.netscape.certsrv.ldap.*;


/**
 * Class for obtaining ldap authentication info from the configuration store.
 * Two types of authentication is basic and SSL client authentication.
 * 
 * @version $Revision$, $Date$
 */
public interface ILdapAuthInfo {
    static public final String PROP_LDAPAUTHTYPE = "authtype";
    static public final String PROP_CLIENTCERTNICKNAME = "clientCertNickname";
    static public final String PROP_BINDDN = "bindDN";
    static public final String PROP_BINDPW = "bindPassword";
    static public final String PROP_BINDPW_PROMPT = "bindPWPrompt";
    static public final String PROP_BINDDN_DEFAULT = "cn=Directory Manager";

    static public final String LDAP_BASICAUTH_STR = "BasicAuth";
    static public final String LDAP_SSLCLIENTAUTH_STR = "SslClientAuth";

    static public final int LDAP_AUTHTYPE_NONE = 0;  // illegal
    static public final int LDAP_AUTHTYPE_BASICAUTH = 1;
    static public final int LDAP_AUTHTYPE_SSLCLIENTAUTH = 2;

    /**
     * Initialize this class from the config store.
     * @param config The config store from which to initialize.
     * @exception EBaseException Due to failure of the initialization process.
     *
     */
    public void init(IConfigStore config) throws EBaseException;

    /**
     * Initialize this class from the config store. 
     * Based on host, port, and secure boolean info.
     * which allows an actual attempt on the server to verify credentials.
     * @param config The config store from which to initialize.
     * @exception EBaseException Due to failure of the initialization process.
     *
     */
    public void init(IConfigStore config, String host, int port, boolean secure)
        throws EBaseException;

    /**
     * Reset the connection to the host
     */
    public void reset();

    /**
     * Get authentication type. 
     * @return one of: <br>
     *		LdapAuthInfo.LDAP_AUTHTYPE_BASICAUTH or 
     *		LdapAuthInfo.LDAP_AUTHTYPE_SSLCLIENTAUTH
     */
    public int getAuthType();

    /**
     * Get params for authentication.
     * @return array of parameters for this authentication as an array of Strings.
     */
    public String[] getParms();

    /**
     * Add password to private password data structure.
     * @param prompt Password prompt.
     * @param pw     Password itself.
     */
    public void addPassword(String prompt, String pw);

    /**
     * Remove password from private password data structure.
     * @param prompt Identify password to remove with prompt.
     */
    public void removePassword(String prompt);
}