Class: RaptorIO::Protocol::HTTP::Request::Manipulators::Authenticators::Digest

Inherits:
RaptorIO::Protocol::HTTP::Request::Manipulator show all
Defined in:
lib/raptor-io/protocol/http/request/manipulators/authenticators/digest.rb

Overview

Implements HTTP Digest authentication as per RFC2069.

Instance Attribute Summary

Attributes inherited from RaptorIO::Protocol::HTTP::Request::Manipulator

#client, #options, #request

Instance Method Summary collapse

Methods inherited from RaptorIO::Protocol::HTTP::Request::Manipulator

#datastore, #delegate, inherited, #initialize, #shortname, shortname, #validate_options, validate_options, validate_options!

Constructor Details

This class inherits a constructor from RaptorIO::Protocol::HTTP::Request::Manipulator

Instance Method Details

#runObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/raptor-io/protocol/http/request/manipulators/authenticators/digest.rb', line 20

def run
  request.headers['Authorization'] = {
      'Digest username' => username,
      realm:               challenge[:realm],
      nonce:               challenge[:nonce],
      uri:                 request.resource,
      qop:                 challenge[:qop],
      nc:                  nc,
      cnonce:              cnonce,
      response:            response,
      algorithm:           algorithm_name,
      opaque:              challenge[:opaque]
  }.map { |k, v| "#{k}=\"#{v}\"" }.join( ', ' )
end