1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.ldap.server.authn;
18
19
20 import javax.naming.Context;
21 import javax.naming.NamingException;
22
23 import org.apache.ldap.server.configuration.AuthenticatorConfiguration;
24 import org.apache.ldap.server.jndi.ContextFactoryConfiguration;
25 import org.apache.ldap.server.jndi.ServerContext;
26 import org.apache.ldap.server.partition.ContextPartitionNexus;
27
28
29 /***
30 * Authenticates users who access {@link ContextPartitionNexus}.
31 * <p>
32 * {@link Authenticator}s are registered to and configured by
33 * {@link AuthenticationService} interceptor.
34 * <p>
35 * {@link AuthenticationService} authenticates users by calling
36 * {@link #authenticate(ServerContext)}, and then {@link Authenticator}
37 * checks JNDI {@link Context} environment properties
38 * ({@link Context#SECURITY_PRINCIPAL} and {@link Context#SECURITY_CREDENTIALS})
39 * of current {@link Context}.
40 *
41 * @see AbstractAuthenticator
42 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
43 * @version $Rev: 264732 $
44 */
45 public interface Authenticator
46 {
47 /***
48 * Returns the type of this authenticator (e.g. <tt>'simple'</tt>,
49 * <tt>'none'</tt>,...).
50 */
51 public String getAuthenticatorType();
52
53 /***
54 * Called by {@link AuthenticationService} to indicate that this
55 * authenticator is being placed into service.
56 */
57 public void init( ContextFactoryConfiguration factoryCfg, AuthenticatorConfiguration cfg ) throws NamingException;
58
59 /***
60 * Called by {@link AuthenticationService} to indicate that this
61 * authenticator is being removed from service.
62 */
63 public void destroy();
64
65 /***
66 * Performs authentication and returns the principal if succeeded.
67 */
68 public LdapPrincipal authenticate( ServerContext ctx ) throws NamingException;
69 }