Class FilterBasedLdapUserSearch

  • All Implemented Interfaces:
    LdapUserSearch

    public class FilterBasedLdapUserSearch
    extends java.lang.Object
    implements LdapUserSearch
    LdapUserSearch implementation which uses an Ldap filter to locate the user.
    See Also:
    SearchControls
    • Constructor Summary

      Constructors 
      Constructor Description
      FilterBasedLdapUserSearch​(java.lang.String searchBase, java.lang.String searchFilter, org.springframework.ldap.core.support.BaseLdapPathContextSource contextSource)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.ldap.core.DirContextOperations searchForUser​(java.lang.String username)
      Return the LdapUserDetails containing the user's information
      void setDerefLinkFlag​(boolean deref)
      Sets the corresponding property on the SearchControls instance used in the search.
      void setReturningAttributes​(java.lang.String[] attrs)
      Specifies the attributes that will be returned as part of the search.
      void setSearchSubtree​(boolean searchSubtree)
      If true then searches the entire subtree as identified by context, if false (the default) then only searches the level identified by the context.
      void setSearchTimeLimit​(int searchTimeLimit)
      The time to wait before the search fails; the default is zero, meaning forever.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FilterBasedLdapUserSearch

        public FilterBasedLdapUserSearch​(java.lang.String searchBase,
                                         java.lang.String searchFilter,
                                         org.springframework.ldap.core.support.BaseLdapPathContextSource contextSource)
    • Method Detail

      • searchForUser

        public org.springframework.ldap.core.DirContextOperations searchForUser​(java.lang.String username)
        Return the LdapUserDetails containing the user's information
        Specified by:
        searchForUser in interface LdapUserSearch
        Parameters:
        username - the username to search for.
        Returns:
        An LdapUserDetails object containing the details of the located user's directory entry
        Throws:
        UsernameNotFoundException - if no matching entry is found.
      • setDerefLinkFlag

        public void setDerefLinkFlag​(boolean deref)
        Sets the corresponding property on the SearchControls instance used in the search.
        Parameters:
        deref - the derefLinkFlag value as defined in SearchControls..
      • setSearchSubtree

        public void setSearchSubtree​(boolean searchSubtree)
        If true then searches the entire subtree as identified by context, if false (the default) then only searches the level identified by the context.
        Parameters:
        searchSubtree - true the underlying search controls should be set to SearchControls.SUBTREE_SCOPE rather than SearchControls.ONELEVEL_SCOPE.
      • setSearchTimeLimit

        public void setSearchTimeLimit​(int searchTimeLimit)
        The time to wait before the search fails; the default is zero, meaning forever.
        Parameters:
        searchTimeLimit - the time limit for the search (in milliseconds).
      • setReturningAttributes

        public void setReturningAttributes​(java.lang.String[] attrs)
        Specifies the attributes that will be returned as part of the search.

        null indicates that all attributes will be returned. An empty array indicates no attributes are returned.

        Parameters:
        attrs - An array of attribute names identifying the attributes that will be returned. Can be null.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object