public class LDAPOperationManager extends Object
This class provides a set of operations to manage LDAP trees.
| Modifier and Type | Class and Description |
|---|---|
static interface |
LDAPOperationManager.LdapOperation<R> |
| Constructor and Description |
|---|
LDAPOperationManager(KeycloakSession session,
LDAPConfig config) |
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String dn,
Attribute attribute)
Adds the given
Attribute instance using the given DN. |
void |
authenticate(String dn,
String password)
Performs a simple authentication using the given DN and password to bind to the authentication context.
|
void |
createSubContext(String name,
Attributes attributes) |
String |
decodeEntryUUID(Object entryUUID) |
Attributes |
getAttributes(String entryUUID,
String baseDN,
Set<String> returningAttributes) |
String |
getFilterById(String id) |
SearchResult |
lookupById(String baseDN,
String id,
Collection<String> returningAttributes) |
void |
modifyAttribute(String dn,
Attribute attribute)
Modifies the given
Attribute instance using the given DN. |
void |
modifyAttributes(String dn,
ModificationItem[] mods,
LDAPOperationDecorator decorator) |
void |
modifyAttributes(String dn,
NamingEnumeration<Attribute> attributes)
Modifies the given
Attribute instances using the given DN. |
void |
modifyAttributesNaming(String dn,
ModificationItem[] mods,
LDAPOperationDecorator decorator) |
void |
passwordModifyExtended(String dn,
String password,
LDAPOperationDecorator decorator)
Execute the LDAP Password Modify Extended Operation to update the password for the given DN.
|
void |
removeAttribute(String dn,
Attribute attribute)
Removes the given
Attribute instance using the given DN. |
void |
removeEntry(String entryDn)
Removes the object from the LDAP tree
|
String |
renameEntry(String oldDn,
String newDn,
boolean fallback)
Rename LDAPObject name (DN)
|
List<SearchResult> |
search(String baseDN,
String filter,
Collection<String> returningAttributes,
int searchScope) |
List<SearchResult> |
searchPaginated(String baseDN,
String filter,
LDAPQuery identityQuery) |
public LDAPOperationManager(KeycloakSession session, LDAPConfig config)
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 modifyAttributes(String dn, NamingEnumeration<Attribute> attributes)
Modifies the given Attribute instances using the given DN. This method performs a REPLACE_ATTRIBUTE
operation.
dn - attributes - 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 removeEntry(String entryDn)
Removes the object from the LDAP tree
public String renameEntry(String oldDn, String newDn, boolean fallback)
oldDn - newDn - fallback - With fallback=true, we will try to find the another DN in case of conflict. For example if there is an
attempt to rename to "CN=John Doe", but there is already existing "CN=John Doe", we will try "CN=John Doe0"public List<SearchResult> search(String baseDN, String filter, Collection<String> returningAttributes, int searchScope) throws NamingException
NamingExceptionpublic List<SearchResult> searchPaginated(String baseDN, String filter, LDAPQuery identityQuery) throws NamingException
NamingExceptionpublic SearchResult lookupById(String baseDN, String id, Collection<String> returningAttributes)
public void authenticate(String dn, String password) throws AuthenticationException
Performs a simple authentication using the given DN and password to bind to the authentication context.
dn - password - AuthenticationException - if authentication is not successfulpublic void modifyAttributesNaming(String dn, ModificationItem[] mods, LDAPOperationDecorator decorator) throws NamingException
NamingExceptionpublic void modifyAttributes(String dn, ModificationItem[] mods, LDAPOperationDecorator decorator)
public void createSubContext(String name, Attributes attributes)
public Attributes getAttributes(String entryUUID, String baseDN, Set<String> returningAttributes)
public void passwordModifyExtended(String dn, String password, LDAPOperationDecorator decorator)
dn - distinguished name of the entry.password - the new password.decorator - A decorator to apply to the ldap operation.Copyright © 2021 JBoss by Red Hat. All rights reserved.