/**
   * Turn the SSO on in Jenkins.
   *
   * @param allowBasic Allow basic authentication.
   */
  private void configureSso(KerberosContainer kdc, boolean allowBasic) {
    // Turn Jenkins side debugging on
    jenkins.runScript(
        "System.setProperty('sun.security.krb5.debug', 'true'); System.setProperty('sun.security.spnego.debug', 'true'); return 42");

    JenkinsConfig config = jenkins.getConfigPage();
    config.configure();
    KerberosGlobalConfig kgc = new KerberosGlobalConfig(config);
    kgc.enable();
    kgc.krb5Conf(kdc.getKrb5ConfPath());
    kgc.loginConf(kdc.getLoginConfPath());
    kgc.allowLocalhost(false);
    kgc.allowBasic(allowBasic);

    config.save();
  }