public ArtefactsDeployer(string artifactoryUrl, string username, string password, ProxyConfiguration proxyConfiguration, int timeOut, CodeActivityContext context) { //Removing ending slash if ((!string.IsNullOrEmpty(artifactoryUrl)) && artifactoryUrl.EndsWith("/")) { artifactoryUrl = artifactoryUrl.Remove(artifactoryUrl.LastIndexOf('/')); } _httpClient = new ArtifactoryHttpClient(artifactoryUrl, username, password); _artifactoryUrl = artifactoryUrl; //TODO figure how to log and pass logger throught constructor _log = new BuildInfoLog(context); SetProxy(proxyConfiguration); SetConnectionTimeout(timeOut); }
private void SetProxy(ProxyConfiguration proxyConfiguration) { if (proxyConfiguration.Bypass) return; WebProxy proxy = new WebProxy(proxyConfiguration.Host, proxyConfiguration.Port); proxy.UseDefaultCredentials = false; if (proxyConfiguration.IsCredentialsExists) { proxy.Credentials = new NetworkCredential(proxyConfiguration.Username, proxyConfiguration.Password); } _httpClient.getHttpClient().SetProxy(proxy); }