pub struct BasicAuth { /* private fields */ }Expand description
HTTP Basic authentication (Authorization: Basic <base64(username:password)>).
Credentials are encoded per RFC 7617: base64(username ":" password).
§Drop-path zeroization
The cached header string is wrapped in zeroize::Zeroizing so its
buffer is overwritten with zeros before being returned to the allocator
on drop. The intermediate username:password plaintext built during
base64 encoding is ALSO zeroized — that buffer is the most
attack-relevant artifact because it carries the raw password rather
than the base64-encoded form. See BearerAuth for the threat model.
(bd:JMAP-6r7c.59)
Implementations§
Source§impl BasicAuth
impl BasicAuth
Sourcepub fn new(username: &str, password: &str) -> Result<Self, ClientError>
pub fn new(username: &str, password: &str) -> Result<Self, ClientError>
Construct a BasicAuth from a username and password.
§Errors
ClientError::InvalidArgumentifusernamecontains a colon (:), which is forbidden by RFC 7617 §2.ClientError::InvalidHeaderValueif the resulting header value contains characters that are not valid in an HTTP header value.
Trait Implementations§
Source§impl AuthProvider for BasicAuth
impl AuthProvider for BasicAuth
Source§fn auth_header(&self) -> Option<AuthHeader<'_>>
fn auth_header(&self) -> Option<AuthHeader<'_>>
Return an optional
AuthHeader to attach to every request. Read moreAuto Trait Implementations§
impl Freeze for BasicAuth
impl RefUnwindSafe for BasicAuth
impl Send for BasicAuth
impl Sync for BasicAuth
impl Unpin for BasicAuth
impl UnsafeUnpin for BasicAuth
impl UnwindSafe for BasicAuth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more