public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CoreV2.NuGet.CredentialType credentialType, bool retrying)
        {
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            // NuGetCore calls the adapter with a "list" endpoint uri.
            // It may be different from a source uri, for instance when v3 source advertises v2 search endpoint.
            // If endpoints mapping is supplied, retrieve the source uri and use it to acquire credentials
            if (_endpoints != null && _endpoints.ContainsKey(uri))
            {
                uri = _endpoints[uri];
            }

            var type = credentialType == CoreV2.NuGet.CredentialType.ProxyCredentials ?
                CredentialRequestType.Proxy : CredentialRequestType.Unauthorized;

            var task = _credentialService.GetCredentialsAsync(
                uri,
                proxy,
                type,
                message: null,
                cancellationToken: CancellationToken.None);

            return task.Result;
        }
 public ICredentials GetCredentials(Uri uri, IWebProxy proxy, CoreV2.NuGet.CredentialType credentialType, bool retrying)
 {
     // If we are retrying, the stored credentials must be invalid.
     if (!retrying && (credentialType == CoreV2.NuGet.CredentialType.RequestCredentials) && TryGetCredentials(uri, out var credentials, out var username))
     {
         _logger.LogMinimal(
             string.Format(
                 CultureInfo.CurrentCulture,
                 LocalizedResourceManager.GetString(nameof(NuGetResources.SettingsCredentials_UsingSavedCredentials)),
                 username));
         return(credentials);
     }
     return(null);
 }