Object
Authentication filter for handling DigestAuth negotiation. Used in WWWAuth.
Creates new DigestAuth filter.
# File lib/httpclient/auth.rb, line 268 def initialize @auth = {} @challenge = {} @nonce_count = 0 @scheme = "Digest" end
Challenge handler: remember URL and challenge token for response.
# File lib/httpclient/auth.rb, line 309 def challenge(uri, param_str) @challenge[uri] = parse_challenge_param(param_str) true end
Response handler: returns credential. It sends cred only when a given uri is;
child page of challengeable(got *Authenticate before) uri and,
child page of defined credential
# File lib/httpclient/auth.rb, line 294 def get(req) target_uri = req.header.request_uri param = Util.hash_find_value(@challenge) { |uri, v| Util.uri_part_of(target_uri, uri) } return nil unless param user, passwd = Util.hash_find_value(@auth) { |uri, auth_data| Util.uri_part_of(target_uri, uri) } return nil unless user uri = req.header.request_uri calc_cred(req.header.request_method, uri, user, passwd, param) end
Generated with the Darkfish Rdoc Generator 2.