sigv4_validate_request

Function sigv4_validate_request 

Source
pub async fn sigv4_validate_request<B, G, F, S>(
    request: Request<B>,
    region: &str,
    service: &str,
    get_signing_key: &mut G,
    server_timestamp: DateTime<Utc>,
    required_headers: &S,
    options: SignatureOptions,
) -> Result<(Parts, Bytes, SigV4AuthenticatorResponse), BoxError>
Expand description

Validate an AWS SigV4 request.

This takes in an HTTP Request along with other service-specific paramters. If the validation is successful (i.e. the request is properly signed with a known access key), this returns:

  • The request headers (as HTTP Parts).
  • The request body (as a Bytes object, which is empty if no body was provided).
  • The response from the authenticator, which contains the principal and other session data.

§Parameters

  • request - The HTTP Request to validate.
  • region - The AWS region in which the request is being made.
  • service - The AWS service to which the request is being made.
  • get_signing_key - A service that can provide the signing key for the request.
  • server_timestamp - The timestamp of the server when the request was received. Usually this is the current time, Utc::now().
  • required_headers - The headers that are required to be signed in the request in addition to the default SigV4 headers. If none, use NO_ADDITIONAL_SIGNED_HEADERS.
  • options - SignatureOptionsthat affect the behavior of the signature validation. For most services, useSignatureOptions::default()`.

§Errors

This function returns a SignatureError if the HTTP request is malformed or the request was not properly signed. The validation follows the AWS Auth Error Ordering document.