Class SimpleDirContextAuthenticationStrategy
- java.lang.Object
-
- org.springframework.ldap.core.support.SimpleDirContextAuthenticationStrategy
-
- All Implemented Interfaces:
DirContextAuthenticationStrategy
public class SimpleDirContextAuthenticationStrategy extends java.lang.Object implements DirContextAuthenticationStrategy
The defaultDirContextAuthenticationStrategy
implementation, setting theDirContext
environment up for 'SIMPLE' authentication, and specifying the user DN and password as SECURITY_PRINCIPAL and SECURITY_CREDENTIALS respectively in the authenticated environment before the context is created.
-
-
Constructor Summary
Constructors Constructor Description SimpleDirContextAuthenticationStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.naming.directory.DirContext
processContextAfterCreation(javax.naming.directory.DirContext ctx, java.lang.String userDn, java.lang.String password)
This method is responsible for post-processing theDirContext
instance after it has been created.void
setupEnvironment(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 theDirContext
instance.
-
-
-
Method Detail
-
setupEnvironment
public void setupEnvironment(java.util.Hashtable<java.lang.String,java.lang.Object> env, java.lang.String userDn, java.lang.String password)
Description copied from interface:DirContextAuthenticationStrategy
This method is responsible for preparing the environment to be used when creating theDirContext
instance. The base environment (including URL,ContextFactory
etc. will already be set, and this method is called just before the actual Context is to be created.- Specified by:
setupEnvironment
in interfaceDirContextAuthenticationStrategy
- Parameters:
env
- TheHashtable
to be sent to theDirContext
instance 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 theAuthenticationSource
of theContextSource
.password
- the password to authenticate with, as received from theAuthenticationSource
of theContextSource
.
-
processContextAfterCreation
public javax.naming.directory.DirContext processContextAfterCreation(javax.naming.directory.DirContext ctx, java.lang.String userDn, java.lang.String password)
Description copied from interface:DirContextAuthenticationStrategy
This method is responsible for post-processing theDirContext
instance 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.- Specified by:
processContextAfterCreation
in interfaceDirContextAuthenticationStrategy
- Parameters:
ctx
- the freshly createdDirContext
instance. The actual implementation class (e.g.InitialLdapContext
) depends on theContextSource
implementation.userDn
- the user DN to authenticate, as received from theAuthenticationSource
of theContextSource
.password
- the password to authenticate with, as received from theAuthenticationSource
of theContextSource
.- Returns:
- the DirContext, possibly modified, replaced or wrapped.
-
-