Module aws_sigv4::http_request
source · Expand description
Utilities to sign HTTP requests.
Example: Signing an HTTP request
use aws_sigv4::http_request::{sign, SigningSettings, SigningParams, SignableRequest};
use http;
use std::time::SystemTime;
// Create the request to sign
let mut request = http::Request::builder()
.uri("https://some-endpoint.some-region.amazonaws.com")
.body("")
.unwrap();
// Set up information and settings for the signing
let signing_settings = SigningSettings::default();
let signing_params = SigningParams::builder()
.access_key("example access key")
.secret_key("example secret key")
.region("us-east-1")
.service_name("exampleservice")
.time(SystemTime::now())
.settings(signing_settings)
.build()
.unwrap();
// Convert the HTTP request into a signable request
let signable_request = SignableRequest::from(&request);
// Sign and then apply the signature to the request
let (signing_instructions, _signature) = sign(signable_request, &signing_params)?.into_parts();
signing_instructions.apply_to_request(&mut request);
Structs
- Represents all of the information necessary to sign an HTTP request.
- Error signing request
- HTTP-specific signing settings
Enums
- HTTP payload checksum type
- Config value to specify how to encode the request URL when signing.
- A signable HTTP request body
- Where to place signing values in the HTTP request
- Config value to specify whether the canonical request’s URI path should be normalized. https://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.html
Functions
- Produces a signature for the given
request
and returns instructions that can be used to apply that signature to an HTTP request.
Type Definitions
- HTTP signing parameters