Class LdapMapOperationManager
- java.lang.Object
-
- org.keycloak.models.map.storage.ldap.store.LdapMapOperationManager
-
- All Implemented Interfaces:
AutoCloseable
public class LdapMapOperationManager extends Object implements AutoCloseable
This class provides a set of operations to manage LDAP trees.
- Author:
- Anil Saldhana, Pedro Silva
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
LdapMapOperationManager.LdapOperation<R>
-
Constructor Summary
Constructors Constructor Description LdapMapOperationManager(KeycloakSession session, LdapMapConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(String dn, Attribute attribute)
Adds the givenAttribute
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
close()
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 givenAttribute
instance using the given DN.void
modifyAttributes(String dn, ModificationItem[] mods, LdapMapOperationDecorator decorator)
void
modifyAttributes(String dn, NamingEnumeration<Attribute> attributes)
Modifies the givenAttribute
instances using the given DN.void
modifyAttributesNaming(String dn, ModificationItem[] mods, LdapMapOperationDecorator decorator)
void
removeAttribute(String dn, Attribute attribute)
Removes the givenAttribute
instance using the given DN.void
removeEntry(String entryDn)
Removes the object from the LDAP treeString
renameEntry(String oldDn, String newDn, boolean fallback)
Rename LDAPObject name (DN)List<SearchResult>
search(String baseDN, String filter, Collection<String> returningAttributes, int searchScope)
-
-
-
Constructor Detail
-
LdapMapOperationManager
public LdapMapOperationManager(KeycloakSession session, LdapMapConfig config)
-
-
Method Detail
-
modifyAttribute
public void modifyAttribute(String dn, Attribute attribute)
Modifies the given
Attribute
instance using the given DN. This method performs a REPLACE_ATTRIBUTE operation.
-
modifyAttributes
public void modifyAttributes(String dn, NamingEnumeration<Attribute> attributes)
Modifies the given
Attribute
instances using the given DN. This method performs a REPLACE_ATTRIBUTE operation.
-
removeAttribute
public void removeAttribute(String dn, Attribute attribute)
Removes the given
Attribute
instance using the given DN. This method performs a REMOVE_ATTRIBUTE operation.
-
addAttribute
public void addAttribute(String dn, Attribute attribute)
Adds the given
Attribute
instance using the given DN. This method performs a ADD_ATTRIBUTE operation.
-
removeEntry
public void removeEntry(String entryDn)
Removes the object from the LDAP tree
-
renameEntry
public String renameEntry(String oldDn, String newDn, boolean fallback)
Rename LDAPObject name (DN)- Parameters:
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"- Returns:
- the non-conflicting DN, which was used in the end
-
search
public List<SearchResult> search(String baseDN, String filter, Collection<String> returningAttributes, int searchScope) throws NamingException
- Throws:
NamingException
-
lookupById
public SearchResult lookupById(String baseDN, String id, Collection<String> returningAttributes)
-
authenticate
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.
- Throws:
AuthenticationException
- if authentication is not successful
-
modifyAttributesNaming
public void modifyAttributesNaming(String dn, ModificationItem[] mods, LdapMapOperationDecorator decorator) throws NamingException
- Throws:
NamingException
-
modifyAttributes
public void modifyAttributes(String dn, ModificationItem[] mods, LdapMapOperationDecorator decorator)
-
createSubContext
public void createSubContext(String name, Attributes attributes)
-
getAttributes
public Attributes getAttributes(String entryUUID, String baseDN, Set<String> returningAttributes)
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
-