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