1 17 package org.apache.ldap.server.authn; 18 19 20 import org.apache.ldap.server.jndi.ServerContext; 21 import org.apache.ldap.common.name.LdapName; 22 23 import javax.naming.NamingException ; 24 import java.util.Enumeration ; 25 26 27 32 public abstract class AbstractAuthenticator implements Authenticator, AuthenticatorConfig 33 { 34 35 36 public AuthenticatorConfig authenticatorConfig; 37 38 39 public String authenticatorType; 40 41 42 47 public AbstractAuthenticator( String type ) 48 { 49 this.authenticatorType = type; 50 } 51 52 53 56 public AuthenticatorContext getAuthenticatorContext() 57 { 58 return authenticatorConfig.getAuthenticatorContext(); 59 } 60 61 62 65 public String getAuthenticatorType() 66 { 67 return authenticatorType; 68 } 69 70 71 74 public AuthenticatorConfig getAuthenticatorConfig() 75 { 76 return authenticatorConfig; 77 } 78 79 80 84 public void init( AuthenticatorConfig authenticatorConfig ) throws NamingException 85 { 86 this.authenticatorConfig = authenticatorConfig; 87 88 init(); 89 } 90 91 92 96 public void init() throws NamingException 97 { 98 } 99 100 101 104 public abstract LdapPrincipal authenticate( ServerContext ctx ) throws NamingException ; 105 106 107 110 public String getAuthenticatorName() 111 { 112 return authenticatorConfig.getAuthenticatorName(); 113 } 114 115 116 119 public String getInitParameter( String name ) 120 { 121 return authenticatorConfig.getInitParameter( name ); 122 } 123 124 125 128 public Enumeration getInitParameterNames() 129 { 130 return authenticatorConfig.getInitParameterNames(); 131 } 132 133 134 142 protected LdapPrincipal createLdapPrincipal( String dn ) throws NamingException 143 { 144 LdapName principalDn = new LdapName( dn ); 145 146 return new LdapPrincipal( principalDn ); 147 } 148 149 150 } 151 | Popular Tags |