Struct actix_web_httpauth::headers::authorization::Authorization [−][src]
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
use actix_web::{HttpRequest, Result}; use actix_web::http::header::Header; use actix_web_httpauth::headers::authorization::{Authorization, Basic}; fn handler(req: HttpRequest) -> Result<String> { let auth = Authorization::<Basic>::parse(&req)?; Ok(format!("Hello, {}!", auth.username)) }
Methods
impl<S: Scheme> Authorization<S>[src]
impl<S: Scheme> Authorization<S>pub fn into_inner(self) -> S[src]
pub fn into_inner(self) -> STrait Implementations
impl<S: Scheme> Header for Authorization<S>[src]
impl<S: Scheme> Header for Authorization<S>fn name() -> HeaderName[src]
fn name() -> HeaderNameReturns the name of the header field
fn parse<T: HttpMessage>(msg: &T) -> Result<Self, ParseError>[src]
fn parse<T: HttpMessage>(msg: &T) -> Result<Self, ParseError>Parse a header
impl<S: Scheme> IntoHeaderValue for Authorization<S>[src]
impl<S: Scheme> IntoHeaderValue for Authorization<S>type Error = <S as IntoHeaderValue>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<HeaderValue, Self::Error>[src]
fn try_into(self) -> Result<HeaderValue, Self::Error>Try to convert value to a Header value.
impl<S: Scheme> Display for Authorization<S>[src]
impl<S: Scheme> Display for Authorization<S>fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl<S: Scheme> Deref for Authorization<S>[src]
impl<S: Scheme> Deref for Authorization<S>type Target = S
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target[src]
fn deref(&self) -> &Self::TargetDereferences the value.
impl<S: Scheme> DerefMut for Authorization<S>[src]
impl<S: Scheme> DerefMut for Authorization<S>Auto Trait Implementations
impl<S> Send for Authorization<S>
impl<S> Send for Authorization<S>impl<S> Sync for Authorization<S>
impl<S> Sync for Authorization<S>