Method: HTTPClient::DigestAuth#get

Defined in:
lib/httpclient/auth.rb

#get(req) ⇒ Object

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



361
362
363
364
365
366
367
368
369
370
371
372
373
374
# File 'lib/httpclient/auth.rb', line 361

def get(req)
  target_uri = req.header.request_uri
  synchronize {
    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
    calc_cred(req, user, passwd, param)
  }
end