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]
fn new<C: Challenge>(c: C) -> Self
fn new_from_raw(scheme: String, raw: RawChallenge) -> Self
fn get<C: Challenge>(&self) -> Option<Vec<C>>
find challenges and convert them into C if found.
fn get_raw(&self, name: &str) -> Option<&[RawChallenge]>
find challenges and return it if found
fn set<C: Challenge>(&mut self, c: C) -> bool
set a challenge. This replaces existing challenges of the same name.
fn set_raw(&mut self, scheme: String, raw: RawChallenge) -> bool
set a challenge. This replaces existing challenges of the same name.
fn append<C: Challenge>(&mut self, c: C)
append a challenge. This appends existing challenges of the same name.
fn append_raw(&mut self, scheme: String, raw: RawChallenge)
append a challenge. This appends existing challenges of the same name.
fn has<C: Challenge>(&self) -> bool
test if the challenge exists
Trait Implementations
impl Debug for WwwAuthenticate[src]
impl Clone for WwwAuthenticate[src]
fn clone(&self) -> WwwAuthenticate
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more
impl Header for WwwAuthenticate[src]
fn header_name() -> &'static str
Returns the name of the header field this belongs to. Read more
fn parse_header(raw: &[Vec<u8>]) -> Result<Self>
Parse a header from a raw stream of bytes. Read more
impl HeaderFormat for WwwAuthenticate[src]
fn fmt_header(&self, f: &mut Formatter) -> Result
Format a header to be output into a TcpStream. Read more