Class HTTPAuth::Digest::Credentials
In: lib/httpauth/digest.rb
Parent: AbstractHeader

The Credentials class handlers the Authorize header. The Authorize header is sent by a client who wants to let the server know he has the credentials needed to access a resource.

See the Digest module for examples

Methods

Attributes

reason  [R]  Holds an explanation why validate returned false.

Public Class methods

Creates a new Credential instance based on a Challenge instance.

See initialize for valid options.

Parses the information from an Authorize header and creates a new Credentials instance with the information. The options hash allows you to specify additional information.

  • authorization: The contents of the Authorize header

See initialize for valid options.

Create a new instance.

  • h: A Hash with directives, normally this is filled with the directives coming from a Challenge instance.
  • options: Used to set or override data from the Authorize header and add additional parameters.
    • :username: Mostly set by a client to send the username
    • :password: Mostly set by a client to send the password, set either this or the digest
    • :digest: Mostly set by a client to send a digest, set either this or the digest. For more information about digests see Digest.
    • :uri: Mostly set by the client to send the uri
    • :method: The HTTP Method used by the client to send the request, this should be an uppercase string with the name of the verb.

Public Instance methods

Encodeds directives and returns a string that can be used in the Authorize header

Updates @h from options, generally called after an instance was created with from_challenge.

Validates the credential information stored in the Credentials instance. Returns true or false. You can read the ue

  • options: The extra options needed to validate the credentials. A server implementation should provide the :method and a :password or :digest.
    • :method: The HTTP Verb in uppercase, ie. GET or POST.
    • :password: The password for the sent username and realm, either a password or digest should be provided.
    • :digest: The digest for the specified username and realm, either a digest or password should be provided.

Convenience method, basically an alias for validate(options.merge(:digest => digest))

Convenience method, basically an alias for validate(options.merge(:password => password))

[Validate]