Method: Net::HTTPHeader#create_digest_auth

Defined in:
lib/marklogic/connection.rb

#create_digest_auth(user, password, response) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/marklogic/connection.rb', line 12

def create_digest_auth(user, password, response)
  # based on http://segment7.net/projects/ruby/snippets/digest_auth.rb
  @@nonce_count += 1

  response['www-authenticate'] =~ /^(\w+) (.*)/

  params = {}
  $2.gsub(/(\w+)="(.*?)"/) { params[$1] = $2 }

  digest_auth(user, password, params)
end