pub struct BasicAuth { /* private fields */ }
Expand description

HTTP Basic authorization.

Specifications

Examples

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

let username = "nori";
let password = "secret_fish!!";
let authz = BasicAuth::new(username, password);

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

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

assert_eq!(authz.username(), username);
assert_eq!(authz.password(), password);

Implementations

Create a new instance of BasicAuth.

Create a new instance from headers.

Create a new instance from the base64 encoded credentials.

Sets the header.

Get the HeaderName.

Get the HeaderValue.

Get the username.

Get the password.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.