Parent

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 = [
    %(Digest username="#{@username}"),
    %(realm="#{@response['realm']}"),
    %(nonce="#{@response['nonce']}"),
    %(uri="#{@path}"),
    %(response="#{request_digest}"),
  ]

  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

[Validate]

Generated with the Darkfish Rdoc Generator 2.