Struct trillium_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); res.insert_header(&authz, &authz); 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 authorization scheme.
Set the authorization scheme.
Trait Implementations
Access the header’s name.
Access the header’s value.
Auto Trait Implementations
impl RefUnwindSafe for WwwAuthenticateimpl Send for WwwAuthenticateimpl Sync for WwwAuthenticateimpl Unpin for WwwAuthenticateimpl UnwindSafe for WwwAuthenticate