Ejemplo n.º 1
0
        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;

            var digest = new DigestToken(header,
                _user, _password);

            return new DigestAuthenticator(digest);
        }
Ejemplo n.º 2
0
 public DigestAuthenticator(DigestToken digest)
 {
     if (digest == null)
         throw new ArgumentNullException("digest");
     _digest = digest;
 }