Module Mixlib::Authentication::SignedHeaderAuth
In: lib/mixlib/authentication/signedheaderauth.rb

Methods

Constants

NULL_ARG = Object.new
SUPPORTED_ALGORITHMS = ['sha1'].freeze
SUPPORTED_VERSIONS = ['1.0', '1.1'].freeze
DEFAULT_SIGN_ALGORITHM = 'sha1'.freeze
DEFAULT_PROTO_VERSION = '1.0'.freeze

Public Class methods

signing_object

This is the intended interface for signing requests with the Opscode/Chef signed header protocol. This wraps the constructor for a Struct that contains the relevant information about your request.

Signature Parameters:

These parameters are used to generate the canonical representation of the request, which is then hashed and encrypted to generate the request‘s signature. These options are all required, with the exception of `:body` and `:file`, which are alternate ways to specify the request body (you must specify one of these).

  • `:http_method`: HTTP method as a lowercase symbol, e.g., `:get | :put | :post | :delete`
  • `:path`: The path part of the URI, e.g., `URI.parse(uri).path`
  • `:body`: An object representing the body of the request. Use an empty String for bodiless requests.
  • `:timestamp`: A String representing the time in any format understood by `Time.parse`. The server may reject the request if the timestamp is not close to the server‘s current time.
  • `:user_id`: The user or client name. This is used by the server to lookup the public key necessary to verify the signature.
  • `:file`: An IO object (must respond to `:read`) to be used as the request body.

Protocol Versioning Parameters:

  • `:proto_version`: The version of the signing protocol to use. Currently defaults to 1.0, but version 1.1 is also available.

Other Parameters:

These parameters are accepted but not used in the computation of the signature.

  • `:host`: The host part of the URI

Public Instance methods

Takes HTTP request method & headers and creates a canonical form to create the signature

Parameters

Build the canonicalized request based on the method, other headers, etc. compute the signature from the request, using the looked-up user secret

Parameters

private_key<OpenSSL::PKey::RSA>:user‘s RSA private key.

[Validate]