Struct trillium_http_types::auth::BasicAuth[][src]

pub struct BasicAuth { /* fields omitted */ }
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);
res.insert_header(&authz, &authz);

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.

Get the username.

Get the password.

Trait Implementations

Formats the value using the given formatter. Read more

Access the header’s name.

Access the header’s value.

Insert the header name and header value into something that looks like a Headers map. 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

Performs the conversion.

Performs the conversion.

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.