Class: Net::HTTPHeader::DigestAuthenticator
- Inherits:
-
Object
- Object
- Net::HTTPHeader::DigestAuthenticator
- Defined in:
- lib/httparty/net_digest_auth.rb
Instance Method Summary collapse
- #authorization_header ⇒ Object
- #cookie_header ⇒ Object
-
#initialize(username, password, method, path, response_header) ⇒ DigestAuthenticator
constructor
A new instance of DigestAuthenticator.
Constructor Details
#initialize(username, password, method, path, response_header) ⇒ DigestAuthenticator
Returns a new instance of DigestAuthenticator.
27 28 29 30 31 32 33 34 |
# File 'lib/httparty/net_digest_auth.rb', line 27 def initialize(username, password, method, path, response_header) @username = username @password = password @method = method @path = path @response = parse(response_header) @cookies = (response_header) end |
Instance Method Details
#authorization_header ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/httparty/net_digest_auth.rb', line 36 def @cnonce = md5(random) header = [ %(Digest username="#{@username}"), %(realm="#{@response['realm']}"), %(nonce="#{@response['nonce']}"), %(uri="#{@path}"), %(response="#{request_digest}") ] header << %(algorithm="#{@response['algorithm']}") if algorithm_present? if qop_present? header << %(cnonce="#{@cnonce}") header << %(qop="#{@response['qop']}") header << 'nc=00000001' end header << %(opaque="#{@response['opaque']}") if opaque_present? header end |
#cookie_header ⇒ Object
58 59 60 |
# File 'lib/httparty/net_digest_auth.rb', line 58 def @cookies end |