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 more
sourceimpl<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>
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
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &Authorization<S>) -> bool
fn ne(&self, other: &Authorization<S>) -> bool
This method tests for !=
.
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>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
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 more
sourceimpl<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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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 Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
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.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> TryIntoHeaderPair for T where
T: Header,
impl<T> TryIntoHeaderPair for T where
T: Header,
type Error = <T as TryIntoHeaderValue>::Error
fn try_into_pair(
self
) -> Result<(HeaderName, HeaderValue), <T as TryIntoHeaderPair>::Error>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more