Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 public VssCredentialsFactory(VsoCredentialHelper helper, byte[] value)
     : this(helper)
 {
     _credentialBytes = value;
 }
Ejemplo n.º 3
0
 public VssCredentialsFactory(VsoCredentialHelper helper, SecureString pat)
     : this(helper)
 {
     _pat = pat;
 }
Ejemplo n.º 4
0
 public VssCredentialsFactory(VsoCredentialHelper helper, VssCredentials credentials)
     : this(helper)
 {
     _credentials = credentials;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VssCredentialsFactory"/> class.
 /// </summary>
 public VssCredentialsFactory(VsoCredentialHelper helper)
 {
     _helper = helper;
 }
Ejemplo n.º 6
0
 /// <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;
 }