def METHOD_NAME(self, user, password):
    """Connect to the server according to configuration."""
    if self.conn is not None:
        return
    mode = self.global_params["ldap_auth_method"]
    if mode == "searchbind":
        bind_dn = self._setting("AUTH_LDAP_BIND_DN", "")
        bind_pwd = self._setting("AUTH_LDAP_BIND_PASSWORD", "")
        self.conn = self._get_conn(bind_dn, bind_pwd)
    else:
        tpl = self._setting("AUTH_LDAP_USER_DN_TEMPLATE", "")
        self.user_dn = tpl % {"user": user}
        self.conn = self._get_conn(self.user_dn, password)