Building an LDAP query
Before you begin
- Search DN - An LDAP directory is organized as a tree structure, with a root node and a number of branches off this root. The Search DN specifies at which node the search originates. Entries greater than this level in the tree are searched. You must specify the correct base DN to obtain the results you want.
- Filter - A query string that filters the entries in the LDAP directory and generates the
matching records. You can create complex filters by using a combination of the following symbols:
& (AND)
| (OR)
! (NOT)
* wildcard character
( ) parentheses for nesting
For instructions on building LDAP filter strings, refer to LDAP books and online resources, including the LDAP standard, RFC 2254, The String Representation of LDAP Search Filters.
- Scope - While the Search DN specifies the starting point of the search, the Scope
attribute indicate the level of depth to which the search occurs. There are two Scope
levels:
One Level - Specifies that LDAP search all entries one level less than the base DN, but does not include the base DN itself.
Sub-Tree Level - Indicates that LDAP search all records at all levels including the base DN.
The following diagram illustrates the effect that the Scope setting has on a search.
- Attributes - Describe every LDAP entry and their values.
Includes a comma-separated list of values to return for the records
that match the filter string. There are two LDAP attributes:
User attribute - You add this attribute to the LDAP directory. For example, cn or mail.
Operational attribute - The LDAP server creates and maintains this attribute. For example, numSubordinates.
The attributes for an entry could include:
Present with no value
Present with one or more values
Not present. If an attribute is optional, the attribute may not exist for an entry.
Note: Be sure to request only the attributes you need. If you request all attributes, a large result set can significantly increase processing time on the LDAP server and memory requirements on both the server and the client.