/// <summary> /// VssCredentialsFactory Constructor /// </summary> /// <param name="pat">A personal access token to use for authentication. Can be null.</param> /// <param name="helper">Credential provider helper class to be used if a credential provider is required for authentication. Can be null.</param> /// <param name="logger">Logger</param> /// <param name="credentials">VSS credentials to be used. Can be null.</param> public VssCredentialsFactory(SecureString pat, VssCredentials credentials, CredentialProviderHelper helper, Action <string> logger) { m_credentialHelper = helper; m_logger = logger; m_pat = pat; m_credentials = credentials; var userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); m_tokenCacheDirectory = OperatingSystemHelper.IsWindowsOS ? Path.Combine(userProfile, "AppData", "Local", "BuildXL", "MsalTokenCache") : Path.Combine(userProfile, ".BuildXL", "MsalTokenCache"); if (!Directory.Exists(m_tokenCacheDirectory)) { Directory.CreateDirectory(m_tokenCacheDirectory); } }
/// <summary> /// VssCredentialsFactory Constructor /// </summary> /// <param name="credentials">VSS credentials to be used. Can be null.</param> /// <param name="helper">Credential provider helper class to be used if a credential provider is required for authentication. Can be null.</param> /// <param name="logger">Logger</param> public VssCredentialsFactory(VssCredentials credentials, CredentialProviderHelper helper, Action <string> logger) : this(pat : null, credentials, helper, logger) { }
/// <summary> /// VssCredentialsFactory Constructor /// </summary> /// <param name="pat">A personal access token to use for authentication. Can be null.</param> /// <param name="helper">Credential provider helper class to be used if a credential provider is required for authentication. Can be null.</param> /// <param name="logger">Logger</param> public VssCredentialsFactory(string pat, CredentialProviderHelper helper, Action <string> logger) : this(CredentialProviderHelper.ConvertStringPatToSecureStringPat(pat), credentials : null, helper, logger) { }