[][src]Struct actix_web_httpauth::headers::authorization::Authorization

pub struct Authorization<S: Scheme>(_);

Authorization header, defined in RFC 7235

The "Authorization" header field allows a user agent to authenticate itself with an origin server -- usually, but not necessarily, after receiving a 401 (Unauthorized) response. Its value consists of credentials containing the authentication information of the user agent for the realm of the resource being requested.

Authorization header is generic over authentication scheme.

Example

fn handler(req: HttpRequest) -> Result<String> {
    let auth = Authorization::<Basic>::parse(&req)?;

    Ok(format!("Hello, {}!", auth.as_ref().user_id()))
}

Methods

impl<S> Authorization<S> where
    S: Scheme
[src]

pub fn into_scheme(self) -> S[src]

Consumes Authorization header and returns inner Scheme implementation.

Trait Implementations

impl<S: Eq + Scheme> Eq for Authorization<S>[src]

impl<S: Ord + Scheme> Ord for Authorization<S>[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl<S> AsMut<S> for Authorization<S> where
    S: Scheme
[src]

impl<S: PartialEq + Scheme> PartialEq<Authorization<S>> for Authorization<S>[src]

impl<S: Clone + Scheme> Clone for Authorization<S>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<S: PartialOrd + Scheme> PartialOrd<Authorization<S>> for Authorization<S>[src]

impl<S> AsRef<S> for Authorization<S> where
    S: Scheme
[src]

impl<S> From<S> for Authorization<S> where
    S: Scheme
[src]

impl<S: Default + Scheme> Default for Authorization<S>[src]

impl<S: Debug + Scheme> Debug for Authorization<S>[src]

impl<S: Scheme> Display for Authorization<S>[src]

impl<S: Hash + Scheme> Hash for Authorization<S>[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<S: Scheme> IntoHeaderValue for Authorization<S>[src]

type Error = <S as IntoHeaderValue>::Error

The type returned in the event of a conversion error.

impl<S: Scheme> Header for Authorization<S>[src]

Auto Trait Implementations

impl<S> Send for Authorization<S>

impl<S> Sync for Authorization<S>

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Erased for T