Expand description
HTTP Basic authentication scheme: credentials are sent as a
base64-encoded username:password pair in the Authorization
request header (RFC 7617 §2).
§Example
use io_http::rfc7617::basic::BasicCredentials;
use secrecy::ExposeSecret;
let creds = BasicCredentials::new("Aladdin", "open sesame");
assert_eq!(creds.to_authorization(), "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==");
let parsed = BasicCredentials::from_authorization("Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==").unwrap();
assert_eq!(parsed.username, "Aladdin");
assert_eq!(parsed.password.expose_secret(), "open sesame");Structs§
- Basic
Credentials - HTTP
Basiccredential pair;passwordis redacted infmt::Debugand zeroed on drop.
Enums§
- Basic
Error - Failure causes when parsing a
Basicauthorization value.