[][src]Struct tide::http::auth::Authorization

pub struct Authorization { /* fields omitted */ }

Credentials to authenticate a user agent with a server.

Specifications

Examples

use http_types::Response;
use http_types::auth::{AuthenticationScheme, Authorization};

let scheme = AuthenticationScheme::Basic;
let credentials = "0xdeadbeef202020";
let authz = Authorization::new(scheme, credentials.into());

let mut res = Response::new(200);
authz.apply(&mut res);

let authz = Authorization::from_headers(res)?.unwrap();

assert_eq!(authz.scheme(), AuthenticationScheme::Basic);
assert_eq!(authz.credentials(), credentials);

Implementations

impl Authorization[src]

pub fn new(scheme: AuthenticationScheme, credentials: String) -> Authorization[src]

Create a new instance of Authorization.

pub fn from_headers(
    headers: impl AsRef<Headers>
) -> Result<Option<Authorization>, Error>
[src]

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 credentials(&self) -> &str[src]

Get the authorization credentials.

pub fn set_credentials(&mut self, credentials: String)[src]

Set the authorization credentials.

Trait Implementations

impl Debug for Authorization[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,