Skip to main content

AuthHeader

Struct AuthHeader 

Source
#[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:

  1. Compile-time secret-typing. AuthHeader’s Debug impl redacts the header value to "[REDACTED]". A future AuthProvider impl that writes tracing::trace!(?header, "injecting") cannot leak the credential through that path because the wrapper’s Debug output 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.
  2. 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: AuthProvider covers “static, per-connection single-header auth schemes” only (Bearer, Basic, mTLS via TransportConfig). Schemes that need multiple request-dependent headers (AWS SigV4, OAuth request signing) or async credential refresh require a different abstraction — currently, custom TransportConfig impls 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>

Source

pub fn new(name: &'a str, value: &'a str) -> Self

Construct an AuthHeader from a header name and value borrow.

Source

pub fn name(&self) -> &'a str

Borrow the header name. Lowercase-ASCII per RFC 9110 §5.1.

Source

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>

Source§

fn clone(&self) -> AuthHeader<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for AuthHeader<'a>

Source§

impl Debug for AuthHeader<'_>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for AuthHeader<'a>

§

impl<'a> RefUnwindSafe for AuthHeader<'a>

§

impl<'a> Send for AuthHeader<'a>

§

impl<'a> Sync for AuthHeader<'a>

§

impl<'a> Unpin for AuthHeader<'a>

§

impl<'a> UnsafeUnpin for AuthHeader<'a>

§

impl<'a> UnwindSafe for AuthHeader<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more