PlugSignature.ConnTest.with_signature

You're seeing just the function with_signature, go back to PlugSignature.ConnTest module for more information.
Link to this function

with_signature(conn, key, key_id, opts \\ [])

View Source

Adds an Authorization header with a signature. Requires a secret (RSA private key, EC private key or HMAC shared secret) and key ID.

Options

  • :algorithms - the HTTP signature algorithms to be used; list with one or more of:

    • "hs2019" (default)
    • "rsa-sha256"
    • "rsa-sha1"
    • "ecdsa-sha256"
    • "hmac-sha256" The first algorithm in the list will be used to generate the signature (it is a list to allow the core set of configuration options to be shared with PlugSignature in tests).
  • :headers - set the list of HTTP (pseudo) headers to sign; defaults to "(created)" (which is only valid when the algorithm is "hs2019")

  • :request_target - explicitly set the request target; by default it is built from the Plug.Conn struct (method, request_path and query)

  • :age - shift the HTTP Date header and the signature's 'created' parameter by the given number of seconds into the past; defaults to 0

  • :created - set the signature's 'created' parameter (overrides :age); set to a empty string to omit the 'created' parameter

  • :date - set the HTTP Date header (overrides :age)

  • :expires_in - if set, adds an 'expires' parameter with a timestamp the given number of seconds in the future

  • :expires - set the signature's 'expires' parameter (overrides :expires_in)

  • :key_id_override - override the value for keyId in the Authorization header

  • :algorithm_override - override the value for the signature's 'algorithm' parameter in the Authorization header

  • :signature_override - override the signature value sent in the Authorization header

  • :headers_override - override the value for the signature's 'headers' parameter in the Authorization header

  • :created_override - override the value for the signature's 'created' parameter in the Authorization header

  • :expires_override - override the value for the signature's 'expires' parameter in the Authorization header