code: public List<String> getUserDNs(LDAPConnection ldapConnection,
              String username) throws GuacamoleException {
  
          // Retrieve user objects having a matching username
          List<LDAPEntry> results = queryService.search(ldapConnection,
                  confService.getUserBaseDN(),
                  confService.getUserSearchFilter(),
                  confService.getUsernameAttributes(),
                  username);
  
          // Build list of all DNs for retrieved users
          List<String> userDNs = new ArrayList<>(results.size());
          results.forEach(entry -> userDNs.add(entry.getDN()));
  
          return userDNs;
  
      }
docs: Returns a list of all DNs corresponding to the users having the given
  username. If multiple username attributes are defined, or if uniqueness
  is not enforced across the username attribute, it is possible that this
  will return multiple DNs.
  
  @param ldapConnection
  The connection to the LDAP server to use when querying user DNs.
  
  @param username
  The username of the user whose corresponding user account DNs are
  to be retrieved.
  
  @return
  A list of all DNs corresponding to the users having the given
  username. If no such DNs exist, this list will be empty.
  
  @throws GuacamoleException
  If an error occurs while querying the user DNs, or if the username
  attribute property cannot be parsed within guacamole.properties.