pub trait SignRequest:
Debug
+ Send
+ Sync
+ Unpin
+ 'static {
type Credential: Send + Sync + Unpin + 'static;
// Required method
fn sign_request<'a>(
&'a self,
ctx: &'a Context,
req: &'a mut Parts,
credential: Option<&'a Self::Credential>,
expires_in: Option<Duration>,
) -> impl Future<Output = Result<()>> + MaybeSend + 'a;
// Provided method
fn required_valid_until(
&self,
_credential: &Self::Credential,
expires_in: Option<Duration>,
) -> Timestamp { ... }
}Expand description
Service-specific request signing.
Implementations receive a request URI that is already percent-encoded and ready for transport. They must derive canonical paths, queries, and headers as local views without normalizing or rebuilding the existing wire URI.
Header authentication must preserve the URI. Query authentication must preserve
the existing URI representation and append only protocol-encoded authentication
fields. In particular, existing percent escapes, parameter order, duplicate keys,
empty values, and literal + characters are caller-owned wire data.
Required Associated Types§
Sourcetype Credential: Send + Sync + Unpin + 'static
type Credential: Send + Sync + Unpin + 'static
Credential used by this builder.
Typically, it will be a credential.
Required Methods§
Sourcefn sign_request<'a>(
&'a self,
ctx: &'a Context,
req: &'a mut Parts,
credential: Option<&'a Self::Credential>,
expires_in: Option<Duration>,
) -> impl Future<Output = Result<()>> + MaybeSend + 'a
fn sign_request<'a>( &'a self, ctx: &'a Context, req: &'a mut Parts, credential: Option<&'a Self::Credential>, expires_in: Option<Duration>, ) -> impl Future<Output = Result<()>> + MaybeSend + 'a
Sign a request head.
On Err, an implementation must leave the entire request head unchanged. On
Ok, it may change only req.uri and req.headers; the method, version, and
extensions remain caller-owned. crate::Signer enforces this commit boundary
when it invokes the implementation, but implementations must also uphold it for
callers that invoke this method directly.
§Credential
The credential parameter is the credential required by the signer to sign the request.
Implementations with expiring credentials must validate it against
SignRequest::required_valid_until before mutating the request or performing
external signing calls. crate::Signer performs the same validation before
invoking this method, while direct callers rely on the implementation.
§Expires In
The expires_in parameter requests a validity duration when the service supports
one. It is not a universal header-versus-query mode selector. Each service and
credential type defines whether the value selects presigning, configures an
expiration, is ignored, or is rejected.
Provided Methods§
Sourcefn required_valid_until(
&self,
_credential: &Self::Credential,
expires_in: Option<Duration>,
) -> Timestamp
fn required_valid_until( &self, _credential: &Self::Credential, expires_in: Option<Duration>, ) -> Timestamp
Return the timestamp through which the credential must remain usable for the requested signing operation.
Implementations own the signing clock, the service-specific meaning of
expires_in, and any transport, RPC, or artifact-lifetime headroom. This
method must not perform I/O or mutate state. When a deadline depends on an
artifact’s signing time, SignRequest::sign_request must derive both the
deadline check and the artifact from the same captured timestamp.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".