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.
25 26 27 28 29 30 31 32 |
# File 'lib/httparty/net_digest_auth.rb', line 25 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
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/httparty/net_digest_auth.rb', line 34 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? fields = [ %(cnonce="#{@cnonce}"), %(qop="#{@response['qop']}"), "nc=00000001" ] fields.each { |field| header << field } end header << %(opaque="#{@response['opaque']}") if opaque_present? header end |
#cookie_header ⇒ Object
59 60 61 |
# File 'lib/httparty/net_digest_auth.rb', line 59 def @cookies end |