Struct www_authenticate::WwwAuthenticate[][src]

pub struct WwwAuthenticate(_);

WWW-Authenticate header, defined in RFC7235

The WWW-Authenticate header field indicates the authentication scheme(s) and parameters applicable to the target resource. This MUST be contained in HTTP responses whose status is 401.

ABNF

WWW-Authenticate = 1#challenge

Example values

  • Basic realm="foo", charset="UTF-8"
  • Digest realm="http-auth@example.org", qop="auth, auth-int", algorithm=MD5, nonce="7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v", opaque="FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS"

Examples

let auth = WwwAuthenticate::new(
    DigestChallenge {
        realm: Some("http-auth@example.org".into()),
        qop: Some(vec![Qop::Auth, Qop::AuthInt]),
        algorithm: Some(Algorithm::Sha256),
        nonce: Some("7ypf/xlj9XXwfDPEoM4URrv/xwf94BcCAzFZH4GiTo0v".into()),
        opaque: Some("FQhe/qaU925kfnzjCev0ciny7QMkPqMAFRtzCUYo5tdS"
                         .into()),
        domain: None,
        stale: None,
        userhash: None,
});
let mut headers = Headers::new();
headers.set(auth);
let auth = WwwAuthenticate::new(BasicChallenge{realm: "foo".into()});
let mut headers = Headers::new();
headers.set(auth);
let auth = headers.get::<WwwAuthenticate>().unwrap();
let basics = auth.get::<BasicChallenge>().unwrap();

Methods

impl WwwAuthenticate
[src]

find challenges and convert them into C if found.

find challenges and return it if found

set a challenge. This replaces existing challenges of the same name.

set a challenge. This replaces existing challenges of the same name.

append a challenge. This appends existing challenges of the same name.

append a challenge. This appends existing challenges of the same name.

test if the challenge exists

Trait Implementations

impl Debug for WwwAuthenticate
[src]

Formats the value using the given formatter. Read more

impl Clone for WwwAuthenticate
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Display for WwwAuthenticate
[src]

Formats the value using the given formatter. Read more

impl Header for WwwAuthenticate
[src]

Returns the name of the header field this belongs to. Read more

Parse a header from a raw stream of bytes. Read more

Format a header to outgoing stream. Read more

Auto Trait Implementations