http_auth

Struct PasswordParams

source
pub struct PasswordParams<'a> {
    pub username: &'a str,
    pub password: &'a str,
    pub uri: &'a str,
    pub method: &'a str,
    pub body: Option<&'a [u8]>,
}
Expand description

Parameters for responding to a password challenge.

This is cheap to construct; callers generally use a fresh PasswordParams for each request.

The caller is responsible for supplying parameters in the correct format. Servers may expect character data to be in Unicode Normalization Form C as noted in RFC 7617 section 2.1 for the Basic scheme and RFC 7616 section 4 for the Digest scheme.

Note that most of these fields are only needed for [DigestClient]. Callers that only care about the Basic challenge scheme can use [BasicClient::respond] directly with only username and password.

Fields§

§username: &'a str§password: &'a str§uri: &'a str

The URI from the Request-URI of the Request-Line, as described in RFC 2617 section 3.2.2.

RFC 2617 section 3.2.2.5, which says the following:

This may be *, an absoluteURL or an abs_path as specified in section 5.1.2 of RFC 2616, but it MUST agree with the Request-URI. In particular, it MUST be an absoluteURL if the Request-URI is an absoluteURL.

RFC 7616 section 3.4 describes this as the “Effective Request URI”, which is always an absolute form. This may be a mistake. Section 3.4.6 matches RFC 2617 section 3.2.2.5, and Appendix A doesn’t mention a change from RFC 2617.

§method: &'a str

The HTTP method, such as GET.

When using the http crate, use the return value of [http::Method::as_str].

§body: Option<&'a [u8]>

The entity body, if available. Use Some(&[]) for HTTP methods with no body.

When None, Digest challenges will only be able to use [crate::digest::Qop::Auth], not [crate::digest::Qop::AuthInt].

Trait Implementations§

source§

impl<'a> Clone for PasswordParams<'a>

source§

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

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for PasswordParams<'a>

source§

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

Formats the value using the given formatter. Read more
source§

impl<'a> PartialEq for PasswordParams<'a>

source§

fn eq(&self, other: &PasswordParams<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> Copy for PasswordParams<'a>

source§

impl<'a> Eq for PasswordParams<'a>

source§

impl<'a> StructuralPartialEq for PasswordParams<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for PasswordParams<'a>

§

impl<'a> RefUnwindSafe for PasswordParams<'a>

§

impl<'a> Send for PasswordParams<'a>

§

impl<'a> Sync for PasswordParams<'a>

§

impl<'a> Unpin for PasswordParams<'a>

§

impl<'a> UnwindSafe for PasswordParams<'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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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.