public IAuthenticator Next(WebException ex) { // No user name provided, just throw if (string.IsNullOrEmpty(_user)) return null; var response = (HttpWebResponse)ex.Response; var header = response.Headers["WWW-Authenticate"]; if (response.StatusCode != HttpStatusCode.Unauthorized || string.IsNullOrEmpty(header)) return null; if (header.StartsWith("Digest ", StringComparison.InvariantCultureIgnoreCase)) { var digest = new DigestToken(header, _user, _password); return new DigestAuthenticator(digest); } // Probably bad username/password return null; }
public IAuthenticator Next(WebException ex) { // No user name provided, just throw if (string.IsNullOrEmpty(_user)) { return(null); } var response = (HttpWebResponse)ex.Response; var header = response.Headers["WWW-Authenticate"]; if (response.StatusCode != HttpStatusCode.Unauthorized || string.IsNullOrEmpty(header)) { return(null); } if (header.StartsWith("Digest ", StringComparison.InvariantCultureIgnoreCase)) { var digest = new DigestToken(header, _user, _password); return(new DigestAuthenticator(digest)); } // Probably bad username/password return(null); }
public DigestAuthenticator(DigestToken digest) { if (digest == null) { throw new ArgumentNullException("digest"); } _digest = digest; }
public DigestAuthenticator(DigestToken digest) { if (digest == null) throw new ArgumentNullException("digest"); _digest = digest; }