public AuthSettingsImpl()

in git-common/src/main/java/jetbrains/buildServer/buildTriggers/vcs/git/AuthSettingsImpl.java [53:103]


  public AuthSettingsImpl(@NotNull Map<String, String> properties,
                          @Nullable VcsRoot root,
                          @NotNull URIishHelper urIishHelper,
                          @Nullable Function <String, ExpiringAccessToken> tokenRetriever,
                          @NotNull List<ExtraHTTPCredentials> extraHTTPCredentials) {
    myAuthMethod = readAuthMethod(properties);
    myIgnoreKnownHosts = "true".equals(properties.get(Constants.IGNORE_KNOWN_HOSTS));
    if (myAuthMethod == AuthenticationMethod.PRIVATE_KEY_FILE) {
      myPassphrase = properties.get(Constants.PASSPHRASE);
      myPrivateKeyFilePath = properties.get(Constants.PRIVATE_KEY_PATH);
    } else if (myAuthMethod == AuthenticationMethod.TEAMCITY_SSH_KEY) {
      myPassphrase = properties.get(Constants.PASSPHRASE);
      myPrivateKeyFilePath = null;
    } else {
      myPassphrase = null;
      myPrivateKeyFilePath = null;
    }
    myUrIishHelper = urIishHelper;
    myUserName = readUsername(properties);
    myTokenRetriever = tokenRetriever;
    if (myAuthMethod.isPasswordBased()) {
      myTokenId = properties.get(Constants.TOKEN_ID);
      myPassword = properties.get(Constants.PASSWORD);

      String lfsUrl = CredentialsHelperConfig.configureLfsUrl(properties.get(Constants.FETCH_URL));

      ExtraHTTPCredentials lfsCredentials = null;
      if (lfsUrl != null) {
        if (isStoredTokenAuth()) {
          lfsCredentials = new ExtraHTTPCredentialsImpl(lfsUrl, myUserName, myTokenId, myTokenRetriever);
        } else {
          lfsCredentials = new ExtraHTTPCredentialsImpl(lfsUrl, myUserName, myPassword);
        }
      }

      if (lfsCredentials != null) {
        myExtraHTTPCredentials.add(lfsCredentials);
        if (extraHTTPCredentials.isEmpty() || !TeamCityProperties.getBooleanOrTrue(EXTRA_CREDS_ENABLED)) {
          myExtraHTTPCredentials.setStoresOnlyDefaultCredential();
        }
      }
    } else {
      myTokenId = null;
      myPassword = null;
    }
    if (TeamCityProperties.getBooleanOrTrue(EXTRA_CREDS_ENABLED)) {
      myExtraHTTPCredentials.addAll(extraHTTPCredentials);
    }
    myTeamCitySshKeyId = myAuthMethod != AuthenticationMethod.TEAMCITY_SSH_KEY ? null : properties.get(VcsRootSshKeyManager.VCS_ROOT_TEAMCITY_SSH_KEY_NAME);
    myRoot = root;
  }