code: public List<SearchResult> searchForUsername(final DirContext ctx, final String username) throws NamingException {
          LOGGER.debug("Performing a directory search for: " + username);
          final String[] attributeFilter = {};
          final SearchControls sc = new SearchControls();
          sc.setReturningAttributes(attributeFilter);
          sc.setSearchScope(SearchControls.SUBTREE_SCOPE);
          final String searchFor = LdapConnectionWrapper.ATTRIBUTE_NAME + "=" +
                  LdapStringSanitizer.sanitize(formatPrincipal(username));
          LOGGER.debug("Searching for: " + searchFor);
          return Collections.list(ctx.search(LdapConnectionWrapper.BASE_DN, searchFor, sc));
      }
docs: Performs a search for the specified username. Internally, this method queries on
  the attribute defined by {@link Config.AlpineKey#LDAP_ATTRIBUTE_NAME}.
  @param ctx the DirContext to use
  @param username the username to query on
  @return a list of SearchResult objects. If the username is found, the list should typically only contain one result.
  @throws NamingException if an exception is thrown
  @since 1.4.0