code: private LDAPConnection bindAs(Credentials credentials)
          throws GuacamoleException {
  
          // Get username and password from credentials
          String username = credentials.getUsername();
          String password = credentials.getPassword();
  
          // Require username
          if (username == null || username.isEmpty()) {
              logger.debug("Anonymous bind is not currently allowed by the LDAP authentication provider.");
              return null;
          }
  
          // Require password, and do not allow anonymous binding
          if (password == null || password.isEmpty()) {
              logger.debug("Anonymous bind is not currently allowed by the LDAP authentication provider.");
              return null;
          }
  
          // Determine user DN
          String userDN = getUserBindDN(username);
          if (userDN == null) {
              logger.debug("Unable to determine DN for user \"{}\".", username);
              return null;
          }
  
          // Bind using user's DN
          return ldapService.bindAs(userDN, password);
  
      }
docs: Binds to the LDAP server using the provided Guacamole credentials. The
  DN of the user is derived using the LDAP configuration properties
  provided in guacamole.properties, as is the server hostname and port
  information.
  
  @param credentials
  The credentials to use to bind to the LDAP server.
  
  @return
  A bound LDAP connection, or null if the connection could not be
  bound.
  
  @throws GuacamoleException
  If an error occurs while binding to the LDAP server.