Struct actix_web_httpauth::headers::www_authenticate::WWWAuthenticate[][src]

pub struct WWWAuthenticate<C: Challenge>(pub C);

WWW-Authenticate header, described in RFC 7235

WWW-Authenticate header is generic over Challenge

Example


use actix_web::{HttpRequest, HttpResponse};
use actix_web::http::StatusCode;
use actix_web_httpauth::headers::www_authenticate::{WWWAuthenticate};
use actix_web_httpauth::headers::www_authenticate::basic::Basic;

fn handler(req: HttpRequest) -> HttpResponse {
    let challenge = Basic {
        realm: Some("Restricted area".to_string()),
    };
    req.build_response(StatusCode::UNAUTHORIZED)
        .set(WWWAuthenticate(challenge))
        .finish()
}

Trait Implementations

impl<C: Challenge> Header for WWWAuthenticate<C>
[src]

Returns the name of the header field

Parse a header

impl<C: Challenge> IntoHeaderValue for WWWAuthenticate<C>
[src]

The type returned in the event of a conversion error.

Try to convert value to a Header value.

Auto Trait Implementations

impl<C> Send for WWWAuthenticate<C>

impl<C> Sync for WWWAuthenticate<C>