1 /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 package org.acegisecurity.ldap;
17
18 import javax.naming.directory.DirContext;
19
20
21 /**
22 * Access point for obtaining LDAP contexts.
23 *
24 * @see org.acegisecurity.ldap.DefaultInitialDirContextFactory
25 *
26 * @author Luke Taylor
27 * @version $Id: InitialDirContextFactory.java 1498 2006-05-26 22:48:21Z luke_t $
28 */
29 public interface InitialDirContextFactory {
30 //~ Methods ========================================================================================================
31
32 /**
33 * Returns the root DN of the contexts supplied by this factory.
34 * The names for searches etc. which are performed against contexts
35 * returned by this factory should be relative to the root DN.
36 *
37 * @return The DN of the contexts returned by this factory.
38 */
39 String getRootDn();
40
41 /**
42 * Provides an initial context without specific user information.
43 *
44 * @return An initial context for the LDAP directory
45 */
46 DirContext newInitialDirContext();
47
48 /**
49 * Provides an initial context by binding as a specific user.
50 *
51 * @param userDn the user to authenticate as when obtaining the context.
52 * @param password the user's password.
53 *
54 * @return An initial context for the LDAP directory
55 */
56 DirContext newInitialDirContext(String userDn, String password);
57 }