Struct actix_web_httpauth::headers::authorization::Authorization
source · pub struct Authorization<S: Scheme>(/* private fields */);
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§
source§impl<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§
source§impl<S: Scheme> AsMut<S> for Authorization<S>
impl<S: Scheme> AsMut<S> for Authorization<S>
source§impl<S: Scheme> AsRef<S> for Authorization<S>
impl<S: Scheme> AsRef<S> for Authorization<S>
source§impl<S: Clone + Scheme> Clone for Authorization<S>
impl<S: Clone + Scheme> Clone for Authorization<S>
source§fn clone(&self) -> Authorization<S>
fn clone(&self) -> Authorization<S>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<S: Default + Scheme> Default for Authorization<S>
impl<S: Default + Scheme> Default for Authorization<S>
source§fn default() -> Authorization<S>
fn default() -> Authorization<S>
Returns the “default value” for a type. Read more
source§impl<S: Scheme> Display for Authorization<S>
impl<S: Scheme> Display for Authorization<S>
source§impl<S: Scheme> From<S> for Authorization<S>
impl<S: Scheme> From<S> for Authorization<S>
source§fn from(scheme: S) -> Authorization<S>
fn from(scheme: S) -> Authorization<S>
Converts to this type from the input type.
source§impl<S: Scheme> Header for Authorization<S>
impl<S: Scheme> Header for Authorization<S>
source§impl<S: Ord + Scheme> Ord for Authorization<S>
impl<S: Ord + Scheme> Ord for Authorization<S>
source§fn cmp(&self, other: &Authorization<S>) -> Ordering
fn cmp(&self, other: &Authorization<S>) -> Ordering
1.21.0 · source§fn 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
source§impl<S: PartialEq + Scheme> PartialEq for Authorization<S>
impl<S: PartialEq + Scheme> PartialEq for Authorization<S>
source§fn 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 ==
.source§impl<S: PartialOrd + Scheme> PartialOrd for Authorization<S>
impl<S: PartialOrd + Scheme> PartialOrd for Authorization<S>
source§fn partial_cmp(&self, other: &Authorization<S>) -> Option<Ordering>
fn partial_cmp(&self, other: &Authorization<S>) -> Option<Ordering>
1.0.0 · source§fn 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 moresource§impl<S: Scheme> TryIntoHeaderValue for Authorization<S>
impl<S: Scheme> TryIntoHeaderValue for Authorization<S>
source§fn 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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more