Class: HTTPClient::ProxyDigestAuth

Inherits:
DigestAuth show all
Defined in:
lib/httpclient/auth.rb

Overview

Authentication filter for handling DigestAuth negotiation. Ignores uri argument. Used in ProxyAuth.

Instance Attribute Summary

Attributes inherited from DigestAuth

#scheme

Instance Method Summary collapse

Methods inherited from DigestAuth

#initialize, #set?

Constructor Details

This class inherits a constructor from HTTPClient::DigestAuth

Instance Method Details

#challenge(uri, param_str) ⇒ Object



506
507
508
509
510
511
# File 'lib/httpclient/auth.rb', line 506

def challenge(uri, param_str)
  synchronize {
    @challenge = parse_challenge_param(param_str)
    true
  }
end

#get(req) ⇒ Object

overrides DigestAuth#get. Uses default user name and password regardless of target uri if the proxy has required authentication before



489
490
491
492
493
494
495
496
497
498
# File 'lib/httpclient/auth.rb', line 489

def get(req)
  target_uri = req.header.request_uri
  synchronize {
    param = @challenge
    return nil unless param
    user, passwd = @auth
    return nil unless user
    calc_cred(req, user, passwd, param)
  }
end

#reset_challengeObject



500
501
502
503
504
# File 'lib/httpclient/auth.rb', line 500

def reset_challenge
  synchronize do
    @challenge = nil
  end
end

#set(uri, user, passwd) ⇒ Object

overrides DigestAuth#set. sets default user name and password. uri is not used.



479
480
481
482
483
484
# File 'lib/httpclient/auth.rb', line 479

def set(uri, user, passwd)
  synchronize do
    @set = true
    @auth = [user, passwd]
  end
end