Example #1
0
        public virtual Task <bool> WaitForHttpProxyCredentials(IHttpProxyInfo proxyInfo)
        {
            var proxyTask = new TaskCompletionSource <bool>();

            Task.Run(async() =>
            {
                Console.WriteLine("\nProxy Authentication\n");
                Console.Write("Proxy Username: "******"Proxy Password: ");
                var password = await InputManager.ReadLine(new ReadLineParameters
                {
                    IsSecured = true
                });
                if (string.IsNullOrEmpty(username))
                {
                    proxyTask.TrySetResult(false);
                }
                await proxyInfo.InvokeHttpProxyCredentialsDelegate.Invoke(username, password);
                return(proxyTask.TrySetResult(true));
            });

            return(proxyTask.Task);
        }
Example #2
0
        public override Task <bool> WaitForHttpProxyCredentials(IHttpProxyInfo proxyInfo)
        {
            if (!_testedSystemProxy)
            {
                _testedSystemProxy = true;
                if (CredentialManager.GetCredentials(proxyInfo.ProxyUri.DnsSafeHost, out var username, out var password))
                {
                    proxyInfo.InvokeHttpProxyCredentialsDelegate.Invoke(username, password);
                    return(Task.FromResult(true));
                }
            }

            return(base.WaitForHttpProxyCredentials(proxyInfo));
        }