[−][src]Struct tide::http::auth::WwwAuthenticate
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
impl WwwAuthenticate
[src]
pub fn new(scheme: AuthenticationScheme, realm: String) -> WwwAuthenticate
[src]
Create a new instance of WwwAuthenticate
.
pub fn from_headers(
headers: impl AsRef<Headers>
) -> Result<Option<WwwAuthenticate>, Error>
[src]
headers: impl AsRef<Headers>
) -> Result<Option<WwwAuthenticate>, Error>
Create a new instance from headers.
pub fn apply(&self, headers: impl AsMut<Headers>)
[src]
Sets the header.
pub fn name(&self) -> HeaderName
[src]
Get the HeaderName
.
pub fn value(&self) -> HeaderValue
[src]
Get the HeaderValue
.
pub fn scheme(&self) -> AuthenticationScheme
[src]
Get the authorization scheme.
pub fn set_scheme(&mut self, scheme: AuthenticationScheme)
[src]
Set the authorization scheme.
pub fn realm(&self) -> &str
[src]
Get the authorization realm.
pub fn set_realm(&mut self, realm: String)
[src]
Set the authorization realm.
Trait Implementations
impl Debug for WwwAuthenticate
[src]
Auto Trait Implementations
impl RefUnwindSafe for WwwAuthenticate
[src]
impl Send for WwwAuthenticate
[src]
impl Sync for WwwAuthenticate
[src]
impl Unpin for WwwAuthenticate
[src]
impl UnwindSafe for WwwAuthenticate
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,