Struct digest_auth::AuthContext

source ·
pub struct AuthContext<'a> {
    pub username: Cow<'a, str>,
    pub password: Cow<'a, str>,
    pub uri: Cow<'a, str>,
    pub body: Option<Cow<'a, [u8]>>,
    pub method: HttpMethod<'a>,
    pub cnonce: Option<Cow<'a, str>>,
}
Expand description

Login attempt context

All fields are borrowed to reduce runtime overhead; this struct should not be stored anywhere, it is normally meaningful only for the one request.

Fields§

§username: Cow<'a, str>

Login username

§password: Cow<'a, str>

Login password (plain)

§uri: Cow<'a, str>

Requested URI (not a domain! should start with a slash)

§body: Option<Cow<'a, [u8]>>

Request payload body - used for auth-int (auth with integrity check) May be left out if not using auth-int

§method: HttpMethod<'a>

HTTP method used (defaults to GET)

§cnonce: Option<Cow<'a, str>>

Spoofed client nonce (use only for tests; a random nonce is generated automatically)

Implementations§

source§

impl<'a> AuthContext<'a>

source

pub fn new<UN, PW, UR>(username: UN, password: PW, uri: UR) -> Self
where UN: Into<Cow<'a, str>>, PW: Into<Cow<'a, str>>, UR: Into<Cow<'a, str>>,

Construct a new context with the GET verb and no payload body. See the other constructors if this does not fit your situation.

source

pub fn new_post<UN, PW, UR, BD>( username: UN, password: PW, uri: UR, body: Option<BD>, ) -> Self
where UN: Into<Cow<'a, str>>, PW: Into<Cow<'a, str>>, UR: Into<Cow<'a, str>>, BD: Into<Cow<'a, [u8]>>,

Construct a new context with the POST verb and a payload body (may be None). See the other constructors if this does not fit your situation.

source

pub fn new_with_method<UN, PW, UR, BD>( username: UN, password: PW, uri: UR, body: Option<BD>, method: HttpMethod<'a>, ) -> Self
where UN: Into<Cow<'a, str>>, PW: Into<Cow<'a, str>>, UR: Into<Cow<'a, str>>, BD: Into<Cow<'a, [u8]>>,

Construct a new context with arbitrary verb and, optionally, a payload body

source

pub fn set_custom_cnonce<CN>(&mut self, cnonce: CN)
where CN: Into<Cow<'a, str>>,

Set cnonce to the given value

Trait Implementations§

source§

impl<'a> Debug for AuthContext<'a>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for AuthContext<'a>

§

impl<'a> RefUnwindSafe for AuthContext<'a>

§

impl<'a> Send for AuthContext<'a>

§

impl<'a> Sync for AuthContext<'a>

§

impl<'a> Unpin for AuthContext<'a>

§

impl<'a> UnwindSafe for AuthContext<'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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

source§

type Output = T

Should always be Self
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

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 144 bytes