pub trait HttpAuth {
// Required method
fn authorize(
&self,
request: &WireRequest<'_>,
attempt: u32,
) -> impl Future<Output = Result<Vec<(String, String)>, TransportError>>;
// Provided method
fn on_unauthorized(
&self,
rejected: Rejected<'_>,
) -> impl Future<Output = Unauthorized> { ... }
}Expand description
What makes a request authorised, for consumers that need it to be.
The whole trait is two methods, one of them defaulted, because everything
else a transport used to do is HttpEngine’s.
Required Methods§
Headers to attach to this attempt.
Returned rather than applied to the request so the engine stays the only thing that builds one: a hook that could edit the path or the query would be a second route to the wire, and this crate has spent its whole existence removing those.
Provided Methods§
What a rejected credential means.
Defaults to Unauthorized::Surface: a client with no credential to
refresh has nothing to gain from sending the same request again, and the
401 is the server’s answer.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".