Class DefaultDirContextValidator
- java.lang.Object
-
- org.springframework.ldap.pool2.validation.DefaultDirContextValidator
-
- All Implemented Interfaces:
DirContextValidator
public class DefaultDirContextValidator extends java.lang.Object implements DirContextValidator
DefaultDirContext
validator that executesDirContext.search(String, String, SearchControls)
. The name, filter andSearchControls
are all configurable. There is no special handling for read only versus read writeDirContext
s.
Configuration:Property Description Required Default base The name parameter to the search method. No "" filter The filter parameter to the search method. No "objectclass=*" searchControls The SearchControls
parameter to the search method.No SearchControls.setCountLimit(long)
= 1
SearchControls.setReturningAttributes(String[])
= new String[] { "objectclass" }
SearchControls.setTimeLimit(int)
= 500
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_FILTER
protected org.slf4j.Logger
logger
Logger for this class and sub-classes
-
Constructor Summary
Constructors Constructor Description DefaultDirContextValidator()
Create the default validator, createsSearchControls
with search scopeOBJECT_SCOPE
, a countLimit of 1, returningAttributes of objectclass and timeLimit of 500.DefaultDirContextValidator(int searchScope)
Create a validator with all the defaults of the default constructor, but with the search scope set to the referred value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getBase()
java.lang.String
getFilter()
javax.naming.directory.SearchControls
getSearchControls()
void
setBase(java.lang.String base)
void
setFilter(java.lang.String filter)
void
setSearchControls(javax.naming.directory.SearchControls searchControls)
boolean
validateDirContext(DirContextType contextType, javax.naming.directory.DirContext dirContext)
Validates theDirContext
.
-
-
-
Field Detail
-
DEFAULT_FILTER
public static final java.lang.String DEFAULT_FILTER
- See Also:
- Constant Field Values
-
logger
protected final org.slf4j.Logger logger
Logger for this class and sub-classes
-
-
Constructor Detail
-
DefaultDirContextValidator
public DefaultDirContextValidator()
Create the default validator, createsSearchControls
with search scopeOBJECT_SCOPE
, a countLimit of 1, returningAttributes of objectclass and timeLimit of 500. The default base is an empty string and the default filter is objectclass=*
-
DefaultDirContextValidator
public DefaultDirContextValidator(int searchScope)
Create a validator with all the defaults of the default constructor, but with the search scope set to the referred value.- Parameters:
searchScope
- The searchScope to be set in the defaultSearchControls
-
-
Method Detail
-
getBase
public java.lang.String getBase()
- Returns:
- the baseName
-
setBase
public void setBase(java.lang.String base)
- Parameters:
base
- the baseName to set
-
getFilter
public java.lang.String getFilter()
- Returns:
- the filter
-
setFilter
public void setFilter(java.lang.String filter)
- Parameters:
filter
- the filter to set
-
getSearchControls
public javax.naming.directory.SearchControls getSearchControls()
- Returns:
- the searchControls
-
setSearchControls
public void setSearchControls(javax.naming.directory.SearchControls searchControls)
- Parameters:
searchControls
- the searchControls to set
-
validateDirContext
public boolean validateDirContext(DirContextType contextType, javax.naming.directory.DirContext dirContext)
Description copied from interface:DirContextValidator
Validates theDirContext
. A validDirContext
should be able to answer queries and if applicable write to the directory.- Specified by:
validateDirContext
in interfaceDirContextValidator
- Parameters:
contextType
- The type of theDirContext
, refers to ifContextSource.getReadOnlyContext()
orContextSource.getReadWriteContext()
was called to create theDirContext
dirContext
- TheDirContext
to validate.- Returns:
true
if theDirContext
operated correctly during validation.- See Also:
DirContextValidator.validateDirContext(DirContextType, DirContext)
-
-