class

Chef::Auth

Inherits Reference < Object

Signs HTTP request headers for the Chef Infra API using v1.3 signed-header authentication (the mixlib-authentication wire format).

The canonical request string is RSA-SHA256 signed and the signature is split into 60-character chunks across numbered X-Ops-Authorization-N headers, because Chef limits individual header line length.

Constants

API_VERSION = "1"
SIGN_ALGORITHM = "sha256"
SIGN_VERSION = "1.3"

Constructors

new(client_name : String, key : OpenSSL::PKey::RSA)
Source
new(client_name : String, key : String)

Loads an RSA private key from PEM-encoded content.

Source

Class methods

canonical_path(p)

The server normalizes the path before verifying the signature, so the signed path must match: collapse repeated slashes and strip a trailing slash (unless the path is just "/").

Source

Instance methods

canonical_request(method, path, content_hash, timestamp) : String

The string that is covered by the RSA signature.

Source
sign!(headers : HTTP::Headers, method, path, body) : HTTP::Headers

Signs headers in place for a request of method to the canonical path with body as the request body. Returns the same headers.

Source