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]

[src]

Trait Implementations

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

[src]

Returns the name of the header field

[src]

Parse a header

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

The type returned in the event of a conversion error.

[src]

Cast from PyObject to a concrete Python object type.

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

[src]

Formats the value using the given formatter. Read more

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

The resulting type after dereferencing.

[src]

Dereferences the value.

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

[src]

Mutably dereferences the value.

Auto Trait Implementations

impl<S> Send for Authorization<S>

impl<S> Sync for Authorization<S>