Class LDAPOperationManager


  • public class LDAPOperationManager
    extends Object

    This class provides a set of operations to manage LDAP trees.

    Author:
    Anil Saldhana, Pedro Silva
    • 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.

        Parameters:
        dn -
        attribute -
      • 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.

        Parameters:
        dn -
        attributes -
      • removeAttribute

        public void removeAttribute​(String dn,
                                    Attribute attribute)

        Removes the given Attribute instance using the given DN. This method performs a REMOVE_ATTRIBUTE operation.

        Parameters:
        dn -
        attribute -
      • addAttribute

        public void addAttribute​(String dn,
                                 Attribute attribute)

        Adds the given Attribute instance using the given DN. This method performs a ADD_ATTRIBUTE operation.

        Parameters:
        dn -
        attribute -
      • 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:
        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"
        Returns:
        the non-conflicting DN, which was used in the end
      • getFilterById

        public String getFilterById​(String id)
      • 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.

        Parameters:
        dn -
        password -
        Throws:
        AuthenticationException - if authentication is not successful
      • createSubContext

        public void createSubContext​(String name,
                                     Attributes attributes)
      • decodeEntryUUID

        public String decodeEntryUUID​(Object entryUUID)
      • passwordModifyExtended

        public void passwordModifyExtended​(String dn,
                                           String password,
                                           LDAPOperationDecorator decorator)
        Execute the LDAP Password Modify Extended Operation to update the password for the given DN.
        Parameters:
        dn - distinguished name of the entry.
        password - the new password.
        decorator - A decorator to apply to the ldap operation.