Class | HTTPAuth::Digest::Challenge |
In: |
lib/httpauth/digest.rb
|
Parent: | AbstractHeader |
Parses the information from a WWW-Authenticate header and creates a new WWW-Authenticate instance with this data.
See initialize for valid options.
# File lib/httpauth/digest.rb, line 407 407: def self.from_header(challenge, options={}) 408: new Utils.decode_directives(challenge, :challenge), options 409: end
Create a new instance.
# File lib/httpauth/digest.rb, line 425 425: def initialize(h, options={}) 426: @h = h 427: @h.merge! options 428: end
Encodes directives and returns a string that can be used as the WWW-Authenticate header
# File lib/httpauth/digest.rb, line 431 431: def to_header 432: @h[:nonce] ||= Utils.create_nonce @h[:salt] 433: @h[:opaque] ||= Utils.create_opaque 434: @h[:algorithm] ||= HTTPAuth::PREFERRED_ALGORITHM 435: @h[:qop] ||= [HTTPAuth::PREFERRED_QOP] 436: Utils.encode_directives Utils.filter_h_on(@h, 437: [:realm, :domain, :nonce, :opaque, :stale, :algorithm, :qop]), :challenge 438: end