| Class | HTTPAuth::Digest::AuthenticationInfo |
| In: |
lib/httpauth/digest.rb
|
| Parent: | AbstractHeader |
The AuthenticationInfo class handles the Authentication-Info header. Sending Authentication-Info headers will allow the client to check the integrity of the response, but it isn’t compulsory and will get in the way of pipelined retrieval of resources.
See the Digest module for examples
Creates a new AuthenticationInfo instance based on the information from Credentials instance.
See initialize for valid options.
# File lib/httpauth/digest.rb, line 461
461: def self.from_credentials(credentials, options={})
462: auth_info = new credentials.h
463: auth_info.update_from_credentials! options
464: auth_info
465: end
Parses the information from a Authentication-Info header and creates a new AuthenticationInfo instance with this data.
See initialize for valid options.
# File lib/httpauth/digest.rb, line 453
453: def self.from_header(auth_info, options={})
454: new Utils.decode_directives(auth_info, :auth), options
455: end
Create a new instance.
# File lib/httpauth/digest.rb, line 474
474: def initialize(h, options={})
475: @h = h
476: @h.merge! options
477: end
Encodes directives and returns a string that can be used as the AuthorizationInfo header
# File lib/httpauth/digest.rb, line 480
480: def to_header
481: Utils.encode_directives Utils.filter_h_on(@h,
482: [:nextnonce, :qop, :rspauth, :cnonce, :nc]), :auth
483: end
Updates @h from options, generally called after an instance was created with from_credentials.
# File lib/httpauth/digest.rb, line 486
486: def update_from_credentials!(options)
487: # TODO: update @h after nonce invalidation
488: @h[:response_body] = options[:response_body]
489: @h[:nextnonce] = @h[:nc] + 1
490: end