private bool IsProxyAuthenticationRequired(WebException ex, HttpWebRequest req) { bool isProxyAuthRequired = false; if (ex.Response != null) { var httpResp = ex.Response as HttpWebResponse; if (httpResp != null) { if (httpResp.StatusCode == HttpStatusCode.ProxyAuthenticationRequired) { isProxyAuthRequired = true; lock (proxyAuthReqiredLocker) authTarget = AuthenticationTarget.Proxy; } else { var headers = httpResp.Headers[httpWWWAuthenticateKey]; if (!string.IsNullOrEmpty(headers) && (httpResp.ResponseUri == null || !httpResp.ResponseUri.Host.Equals(req.RequestUri.Host, StringComparison.OrdinalIgnoreCase))) { isProxyAuthRequired = true; lock (proxyAuthReqiredLocker) authTarget = AuthenticationTarget.Request; } } } } return(isProxyAuthRequired); }
public CredentialsCacheItem(AuthenticationScheme authenticationScheme, AuthenticationTarget authenticationTarget, string userName, Guid jobId) { this.userName = userName; this.jobId = jobId; this.authenticationScheme = authenticationScheme; this.authenticationTarget = authenticationTarget; }
public CredentialsCacheItem(BitsCredentials credentials, Guid jobId) { this.userName = credentials.UserName; this.jobId = jobId; this.authenticationScheme = credentials.AuthenticationScheme; this.authenticationTarget = credentials.AuthenticationTarget; }
public void RemoveCredentials(AuthenticationTarget target, AuthenticationScheme scheme) { try { if (job2 != null)// only supported from IBackgroundCopyJob2 and above { job2.RemoveCredentials((BG_AUTH_TARGET)target, (BG_AUTH_SCHEME)scheme); } } catch (COMException exception) { manager.PublishException(this, exception); } }
public SharePointAuthenticationOptions() { Target = AuthenticationTarget.SPHost; }