protected virtual ICachePublisher CreatePublisher(string sessionName, BuildCacheServiceConfiguration config, string pat, Context context) { var credHelper = new VsoCredentialHelper(); var credFactory = new VssCredentialsFactory(new VssBasicCredential(new NetworkCredential(string.Empty, pat))); var cache = BuildCacheCacheFactory.Create( _fileSystem, context.Logger, credFactory, config, writeThroughContentStoreFunc: null); cache.StartupAsync(context).GetAwaiter().GetResult().ThrowIfFailure(); var sessionResult = cache.CreateSession(context, sessionName, ImplicitPin.None).ThrowIfFailure(); var session = sessionResult.Session; Contract.Check(session is BuildCacheSession)?.Assert($"Session should be an instance of {nameof(BuildCacheSession)}. Actual type: {session.GetType()}"); return((BuildCacheSession)session); }
public VssCredentialsFactory(VsoCredentialHelper helper, byte[] value) : this(helper) { _credentialBytes = value; }
public VssCredentialsFactory(VsoCredentialHelper helper, SecureString pat) : this(helper) { _pat = pat; }
public VssCredentialsFactory(VsoCredentialHelper helper, VssCredentials credentials) : this(helper) { _credentials = credentials; }
/// <summary> /// Initializes a new instance of the <see cref="VssCredentialsFactory"/> class. /// </summary> public VssCredentialsFactory(VsoCredentialHelper helper) { _helper = helper; }
/// <summary> /// Initializes a new instance with a helper and a user name explicitly provided. /// </summary> /// <remarks> /// CoreCLR is not allowed to query the OS for the AAD user name of the current user, /// which is why this constructor allows for that user name to be explicitly provided. /// </remarks> public VssCredentialsFactory(VsoCredentialHelper helper, [CanBeNull] string userName) : this(helper) { _userName = userName; }