public class LDAPOperationManager extends Object
This class provides a set of operations to manage LDAP trees.
A different DirContext is used to perform authentication. The reason is that while managing the ldap tree information
bindings are not allowed. Also, instead of creating a new DirContext each time we reuse it.
| Constructor and Description |
|---|
LDAPOperationManager(org.picketlink.idm.config.LDAPIdentityStoreConfiguration config) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String dn,
Attribute attribute)
Adds the given
Attribute instance using the given DN. |
boolean |
authenticate(String dn,
String password)
Performs a simple authentication using the ginve DN and password to bind to the authentication context.
|
void |
bind(String dn,
Object object)
Binds a
Object to the LDAP tree. |
boolean |
checkAttributePresence(String attributeName)
Ask the ldap server for the schema for the attribute.
|
void |
createSubContext(String name,
Attributes attributes) |
void |
destroyRecursively(String dn) |
void |
destroySubcontext(String dn)
Destroys a subcontext with the given DN from the LDAP tree.
|
boolean |
isManagedAttribute(String attributeName)
Checks if the attribute with the given name is a managed attributes.
|
<T> T |
lookup(String dn)
Looks up a entry on the LDAP tree with the given DN.
|
NamingEnumeration<SearchResult> |
lookupById(String baseDN,
String id) |
void |
modifyAttribute(String dn,
Attribute attribute)
Modifies the given
Attribute instance using the given DN. |
void |
rebind(String dn,
Object object)
Re-binds a
Object to the LDAP tree. |
void |
removeAttribute(String dn,
Attribute attribute)
Removes the given
Attribute instance using the given DN. |
<T> List<T> |
removeEntryById(String baseDN,
String id)
Searches the LDAP tree.
|
NamingEnumeration<SearchResult> |
search(String baseDN,
String filter) |
NamingEnumeration<SearchResult> |
search(String baseDN,
String filter,
String[] attributesToReturn,
SearchControls searchControls)
Searches the LDAP tree.
|
public LDAPOperationManager(org.picketlink.idm.config.LDAPIdentityStoreConfiguration config)
throws NamingException
NamingExceptionpublic void bind(String dn, Object object)
Binds a Object to the LDAP tree.
ldapUser - public void modifyAttribute(String dn, Attribute attribute)
Modifies the given Attribute instance using the given DN. This method performs a REPLACE_ATTRIBUTE operation.
dn - attribute - public void removeAttribute(String dn, Attribute attribute)
Removes the given Attribute instance using the given DN. This method performs a REMOVE_ATTRIBUTE operation.
dn - attribute - public void addAttribute(String dn, Attribute attribute)
Adds the given Attribute instance using the given DN. This method performs a ADD_ATTRIBUTE operation.
dn - attribute - public void rebind(String dn, Object object)
Re-binds a Object to the LDAP tree.
dn - object - public <T> T lookup(String dn)
Looks up a entry on the LDAP tree with the given DN.
dn - NamingExceptionpublic <T> List<T> removeEntryById(String baseDN, String id)
Searches the LDAP tree.
baseDN - attributesToSearch - public NamingEnumeration<SearchResult> search(String baseDN, String filter, String[] attributesToReturn, SearchControls searchControls)
Searches the LDAP tree.
baseDN - filter - attributesToReturn - searchControls - public NamingEnumeration<SearchResult> search(String baseDN, String filter) throws NamingException
NamingExceptionpublic NamingEnumeration<SearchResult> lookupById(String baseDN, String id)
public void destroySubcontext(String dn)
Destroys a subcontext with the given DN from the LDAP tree.
dn - public void destroyRecursively(String dn)
public boolean isManagedAttribute(String attributeName)
Checks if the attribute with the given name is a managed attributes. Managed attributes are the ones defined in the underlying schema or those defined in the managed attribute list.
attributeName - public boolean checkAttributePresence(String attributeName)
Ask the ldap server for the schema for the attribute.
attributeName - public boolean authenticate(String dn, String password)
Performs a simple authentication using the ginve DN and password to bind to the authentication context.
dn - password - public void createSubContext(String name, Attributes attributes)
Copyright © 2013. All Rights Reserved.