code: private Optional<String> tryGerritHttpFormAuth(HttpClientBuilder client, HttpContext httpContext) throws IOException, HttpStatusException {
          if (!authData.isLoginAndPasswordAvailable()) {
              return Optional.absent();
          }
          String loginUrl = authData.getHost() + "/login/";
          HttpPost method = new HttpPost(loginUrl);
          List<BasicNameValuePair> parameters = Lists.newArrayList(
              new BasicNameValuePair("username", authData.getLogin()),
              new BasicNameValuePair("password", authData.getPassword())
          );
          method.setEntity(new UrlEncodedFormEntity(parameters, Consts.UTF_8));
          HttpResponse loginResponse = httpRequestExecutor.execute(client, method, httpContext);
          return extractGerritAuth(loginResponse);
      }
docs: Handles LDAP auth (but not LDAP_HTTP) which uses a HTML form.