class Net::HTTPHeader::DigestAuthenticator

Public Class Methods

new(username, password, method, path, response_header) click to toggle source
# File lib/httparty/net_digest_auth.rb, line 13
def initialize(username, password, method, path, response_header)
  @username = username
  @password = password
  @method   = method
  @path     = path
  @response = parse(response_header)
end

Public Instance Methods

authorization_header() click to toggle source
# File lib/httparty/net_digest_auth.rb, line 21
def authorization_header
  @cnonce = md5(random)
  header = [%Q(Digest username="#{@username}"),
    %Q(realm="#{@response['realm']}"),
    %Q(nonce="#{@response['nonce']}"),
    %Q(uri="#{@path}"),
    %Q(response="#{request_digest}")]
  [%Q(cnonce="#{@cnonce}"),
    %Q(opaque="#{@response['opaque']}"),
    %Q(qop="#{@response['qop']}"),
    %Q(nc="0")].each { |field| header << field } if qop_present?
  header
end