Struct http_types::auth::WwwAuthenticate [−][src]
pub struct WwwAuthenticate { /* fields omitted */ }
Expand description
Define the authentication method that should be used to gain access to a resource.
Specifications
Implementation Notes
This implementation only encodes and parses a single authentication method, further authorization methods are ignored. It also always passes the utf-8 encoding flag.
Examples
use http_types::Response; use http_types::auth::{AuthenticationScheme, WwwAuthenticate}; let scheme = AuthenticationScheme::Basic; let realm = "Access to the staging site"; let authz = WwwAuthenticate::new(scheme, realm.into()); let mut res = Response::new(200); authz.apply(&mut res); let authz = WwwAuthenticate::from_headers(res)?.unwrap(); assert_eq!(authz.scheme(), AuthenticationScheme::Basic); assert_eq!(authz.realm(), realm);
Implementations
Create a new instance of WwwAuthenticate
.
Create a new instance from headers.
Get the HeaderName
.
Get the HeaderValue
.
Get the authorization scheme.
Set the authorization scheme.