Class HTTPAuth::Digest::Utils
In: lib/httpauth/digest.rb
Parent: Object

Utils contains all sort of conveniance methods for the header container classes. Implementations shouldn‘t have to call any methods on Utils.

Methods

Public Class methods

Calculate the digest value for the directives as explained in the RFC.

  • variant: Either :request or :response, as seen from the server.

Create a nonce value of the time and a salt. The nonce is created in such a way that the issuer can check the age of the nonce.

  • salt: A reasonably long passphrase known only to the issuer.

Create a 32 character long opaque string with a ‘random’ value

Decodes digest directives from a header. Returns a hash with directives.

  • directives: The directives
  • variant: Specifies whether the directives are for an Authorize header (:credentials), for a WWW-Authenticate header (:challenge) or for a Authentication-Info header (:auth_info).

Calculate the H(A1) as explain in the RFC. If h[:digest] is set, it‘s used instead of calculating H(username ":" realm ":" password).

Concat arguments the way it‘s done frequently in the Digest spec.

  digest_concat('a', 'b') #=> "a:b"
  digest_concat('a', 'b', c') #=> "a:b:c"

Calculate the MD5 hexdigest for the string data

Calculate the KD value of a secret and data as explained in the RFC.

Encodes a hash with digest directives to send in a header.

  • h: The directives specified in a hash
  • variant: Specifies whether the directives are for an Authorize header (:credentials), for a WWW-Authenticate header (:challenge) or for a Authentication-Info header (:auth_info).

Return a hash with the keys in keys found in h.

Example

  filter_h_on({1=>1,2=>2}, [1]) #=> {1=>1}
  filter_h_on({1=>1,2=>2}, [1, 2]) #=> {1=>1,2=>2}

Calculate the Digest for the credentials

Calculate the H(A2) for the Authorize header as explained in the RFC.

Calculate the H(A2) for the Authentication-Info header as explained in the RFC.

[Validate]