Interface DirContextAuthenticationStrategy
-
- All Known Implementing Classes:
AbstractTlsDirContextAuthenticationStrategy,DefaultTlsDirContextAuthenticationStrategy,DigestMd5DirContextAuthenticationStrategy,ExternalTlsDirContextAuthenticationStrategy,SimpleDirContextAuthenticationStrategy
public interface DirContextAuthenticationStrategyA strategy to use when authenticating LDAP connections on creation. When authenticating LDAP connections different strategies are needed depending on the authentication mechanism used. Furthermore, depending on the mechanism the work to be done needs to be applied at different stages of theDirContextcreation process. A DirContextAuthenticationStrategy contains the logic to perform a particular type of authentication mechanism and will be called by itsContextSourceat appropriate stages of the process.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description javax.naming.directory.DirContextprocessContextAfterCreation(javax.naming.directory.DirContext ctx, java.lang.String userDn, java.lang.String password)This method is responsible for post-processing theDirContextinstance after it has been created.voidsetupEnvironment(java.util.Hashtable<java.lang.String,java.lang.Object> env, java.lang.String userDn, java.lang.String password)This method is responsible for preparing the environment to be used when creating theDirContextinstance.
-
-
-
Method Detail
-
setupEnvironment
void setupEnvironment(java.util.Hashtable<java.lang.String,java.lang.Object> env, java.lang.String userDn, java.lang.String password) throws javax.naming.NamingExceptionThis method is responsible for preparing the environment to be used when creating theDirContextinstance. The base environment (including URL,ContextFactoryetc. will already be set, and this method is called just before the actual Context is to be created.- Parameters:
env- TheHashtableto be sent to theDirContextinstance on initialization. Pre-configured with the basic settings; the implementation of this method is responsible for manipulating the environment as appropriate for the particular authentication mechanism.userDn- the user DN to authenticate, as received from theAuthenticationSourceof theContextSource.password- the password to authenticate with, as received from theAuthenticationSourceof theContextSource.- Throws:
javax.naming.NamingException- if anything goes wrong. This will cause theDirContextcreation to be aborted and the exception to be translated and rethrown.
-
processContextAfterCreation
javax.naming.directory.DirContext processContextAfterCreation(javax.naming.directory.DirContext ctx, java.lang.String userDn, java.lang.String password) throws javax.naming.NamingExceptionThis method is responsible for post-processing theDirContextinstance after it has been created. It will be called immediately after the instance has been created. Some authentication mechanisms, e.g. TLS, require particular stuff to happen before the actual target Context is closed. This method provides the possibility to replace or wrap the actual DirContext with a proxy so that any calls on it may be intercepted.- Parameters:
ctx- the freshly createdDirContextinstance. The actual implementation class (e.g.InitialLdapContext) depends on theContextSourceimplementation.userDn- the user DN to authenticate, as received from theAuthenticationSourceof theContextSource.password- the password to authenticate with, as received from theAuthenticationSourceof theContextSource.- Returns:
- the DirContext, possibly modified, replaced or wrapped.
- Throws:
javax.naming.NamingException- if anything goes wrong. This will cause theDirContextcreation to be aborted and the exception to be translated and rethrown.
-
-