pub struct ProxyAuth { /* private fields */ }Expand description
Credentials for a proxy endpoint (HTTP Basic only).
Negotiate/NTLM/SSPI out of scope. When password() is None,
password_state says why. Manual Debug masks secrets.
let auth = ProxyAuth::new("alice", Some("hunter2"));
assert!(!format!("{auth:?}").contains("hunter2"));
assert_eq!(auth.password(), Some("hunter2"));Colon in username is masked from the first colon:
let auth = ProxyAuth::from_username("alice:hunter2");
assert!(!format!("{auth:?}").contains("hunter2"));Implementations§
Source§impl ProxyAuth
impl ProxyAuth
Sourcepub fn new(
username: impl Into<String>,
password: Option<impl Into<String>>,
) -> Self
pub fn new( username: impl Into<String>, password: Option<impl Into<String>>, ) -> Self
Create credentials from a user name and an optional password.
Sourcepub fn from_username(username: impl Into<String>) -> Self
pub fn from_username(username: impl Into<String>) -> Self
User name only; password_state is
Absent.
Sourcepub fn has_password(&self) -> bool
pub fn has_password(&self) -> bool
Whether a password is present (without exposing it).
Sourcepub fn password_state(&self) -> PasswordState
pub fn password_state(&self) -> PasswordState
Trait Implementations§
impl Eq for ProxyAuth
impl StructuralPartialEq for ProxyAuth
Auto Trait Implementations§
impl Freeze for ProxyAuth
impl RefUnwindSafe for ProxyAuth
impl Send for ProxyAuth
impl Sync for ProxyAuth
impl Unpin for ProxyAuth
impl UnsafeUnpin for ProxyAuth
impl UnwindSafe for ProxyAuth
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