#[non_exhaustive]pub struct AuthHeader<'a> { /* private fields */ }Expand description
Single HTTP (name, value) header pair, returned by
AuthProvider::auth_header (bd:JMAP-6r7c.62, bd:JMAP-6r7c.20).
The wrapper exists for two purposes:
- Compile-time secret-typing.
AuthHeader’sDebugimpl redacts the header value to"[REDACTED]". A futureAuthProviderimpl that writestracing::trace!(?header, "injecting")cannot leak the credential through that path because the wrapper’sDebugoutput never contains the value bytes. The pre-bd:JMAP-6r7c.62 shape (Option<(&str, &str)>) had no such guard — a string tuple formats verbatim via?-syntax. - Bounded API surface. The wrapper packages exactly one
(name, value)pair. The trait’s signature does not admit a list, a sequence, or a per-request-computed value. This is the intentional limitation:AuthProvidercovers “static, per-connection single-header auth schemes” only (Bearer, Basic, mTLS viaTransportConfig). Schemes that need multiple request-dependent headers (AWS SigV4, OAuth request signing) or async credential refresh require a different abstraction — currently, customTransportConfigimpls that wire per-request middleware (bd:JMAP-6r7c.20).
Construct via AuthHeader::new — both name and value are
caller-supplied borrows; the wrapper stashes them as-is. The
constructor does not validate HTTP-header-value syntax; downstream
consumers (e.g. connect_ws) validate at
the call site and surface ClientError::InvalidArgument for
invalid bytes.
Implementations§
Source§impl<'a> AuthHeader<'a>
impl<'a> AuthHeader<'a>
Sourcepub fn new(name: &'a str, value: &'a str) -> Self
pub fn new(name: &'a str, value: &'a str) -> Self
Construct an AuthHeader from a header name and value borrow.
Sourcepub fn expose_value(&self) -> &'a str
pub fn expose_value(&self) -> &'a str
Borrow the header value.
Do not log this return value. The value is credential
material; see the type-level rustdoc. The constructor name is
deliberately explicit (expose_value) so a
call site reveals the intent — a tracing::* line that
references header.expose_value() is visible in code review,
whereas a ?header formatter is not.
Trait Implementations§
Source§impl<'a> Clone for AuthHeader<'a>
impl<'a> Clone for AuthHeader<'a>
Source§fn clone(&self) -> AuthHeader<'a>
fn clone(&self) -> AuthHeader<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more