Struct actix_web_httpauth::headers::authorization::Authorization
source · [−]pub struct Authorization<S: Scheme>(_);
Expand description
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
is generic over an authentication scheme.
Examples
fn handler(req: HttpRequest) -> Result<String> {
let auth = Authorization::<Basic>::parse(&req)?;
Ok(format!("Hello, {}!", auth.as_ref().user_id()))
}
Implementations
sourceimpl<S: Scheme> Authorization<S>
impl<S: Scheme> Authorization<S>
sourcepub fn into_scheme(self) -> S
pub fn into_scheme(self) -> S
Consumes Authorization
header and returns inner Scheme
implementation.
Trait Implementations
sourceimpl<S: Scheme> AsMut<S> for Authorization<S>
impl<S: Scheme> AsMut<S> for Authorization<S>
sourceimpl<S: Scheme> AsRef<S> for Authorization<S>
impl<S: Scheme> AsRef<S> for Authorization<S>
sourceimpl<S: Clone + Scheme> Clone for Authorization<S>
impl<S: Clone + Scheme> Clone for Authorization<S>
sourcefn clone(&self) -> Authorization<S>
fn clone(&self) -> Authorization<S>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<S: Debug + Scheme> Debug for Authorization<S>
impl<S: Debug + Scheme> Debug for Authorization<S>
sourceimpl<S: Default + Scheme> Default for Authorization<S>
impl<S: Default + Scheme> Default for Authorization<S>
sourcefn default() -> Authorization<S>
fn default() -> Authorization<S>
Returns the “default value” for a type. Read more
sourceimpl<S: Scheme> Display for Authorization<S>
impl<S: Scheme> Display for Authorization<S>
sourceimpl<S: Scheme> From<S> for Authorization<S>
impl<S: Scheme> From<S> for Authorization<S>
sourcefn from(scheme: S) -> Authorization<S>
fn from(scheme: S) -> Authorization<S>
Converts to this type from the input type.
sourceimpl<S: Hash + Scheme> Hash for Authorization<S>
impl<S: Hash + Scheme> Hash for Authorization<S>
sourceimpl<S: Scheme> Header for Authorization<S>
impl<S: Scheme> Header for Authorization<S>
sourceimpl<S: Ord + Scheme> Ord for Authorization<S>
impl<S: Ord + Scheme> Ord for Authorization<S>
sourcefn cmp(&self, other: &Authorization<S>) -> Ordering
fn cmp(&self, other: &Authorization<S>) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<S: PartialEq + Scheme> PartialEq<Authorization<S>> for Authorization<S>
impl<S: PartialEq + Scheme> PartialEq<Authorization<S>> for Authorization<S>
sourcefn eq(&self, other: &Authorization<S>) -> bool
fn eq(&self, other: &Authorization<S>) -> bool
sourceimpl<S: PartialOrd + Scheme> PartialOrd<Authorization<S>> for Authorization<S>
impl<S: PartialOrd + Scheme> PartialOrd<Authorization<S>> for Authorization<S>
sourcefn partial_cmp(&self, other: &Authorization<S>) -> Option<Ordering>
fn partial_cmp(&self, other: &Authorization<S>) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresourceimpl<S: Scheme> TryIntoHeaderValue for Authorization<S>
impl<S: Scheme> TryIntoHeaderValue for Authorization<S>
type Error = <S as TryIntoHeaderValue>::Error
type Error = <S as TryIntoHeaderValue>::Error
The type returned in the event of a conversion error.
sourcefn try_into_value(self) -> Result<HeaderValue, Self::Error>
fn try_into_value(self) -> Result<HeaderValue, Self::Error>
Try to convert value to a HeaderValue.
impl<S: Eq + Scheme> Eq for Authorization<S>
impl<S: Scheme> StructuralEq for Authorization<S>
impl<S: Scheme> StructuralPartialEq for Authorization<S>
Auto Trait Implementations
impl<S> RefUnwindSafe for Authorization<S>where
S: RefUnwindSafe,
impl<S> Send for Authorization<S>
impl<S> Sync for Authorization<S>
impl<S> Unpin for Authorization<S>where
S: Unpin,
impl<S> UnwindSafe for Authorization<S>where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.