pub struct SecureCredentials { /* private fields */ }Expand description
Secure credentials with automatic zeroization on drop.
This type is only available when the zeroize feature is enabled.
All sensitive fields are securely zeroed from memory when the
credentials are dropped.
§Example
ⓘ
use mssql_auth::SecureCredentials;
let creds = SecureCredentials::sql_server("user", "password");
// When `creds` goes out of scope, the password is securely zeroedImplementations§
Source§impl SecureCredentials
impl SecureCredentials
Sourcepub fn sql_server(
username: impl Into<String>,
password: impl Into<String>,
) -> SecureCredentials
pub fn sql_server( username: impl Into<String>, password: impl Into<String>, ) -> SecureCredentials
Create SQL Server credentials with secure password handling.
Sourcepub fn azure_token(token: impl Into<String>) -> SecureCredentials
pub fn azure_token(token: impl Into<String>) -> SecureCredentials
Create Azure access token credentials with secure token handling.
Sourcepub fn is_sql_auth(&self) -> bool
pub fn is_sql_auth(&self) -> bool
Check if these credentials use SQL authentication.
Sourcepub fn is_azure_ad(&self) -> bool
pub fn is_azure_ad(&self) -> bool
Check if these credentials use Azure AD.
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Get the authentication method name.
Sourcepub fn username(&self) -> Option<&str>
pub fn username(&self) -> Option<&str>
Get the username for SQL Server authentication.
Returns None for non-SQL authentication methods.
Trait Implementations§
Source§impl Clone for SecureCredentials
impl Clone for SecureCredentials
Source§fn clone(&self) -> SecureCredentials
fn clone(&self) -> SecureCredentials
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecureCredentials
Available on crate feature zeroize only.
impl Debug for SecureCredentials
Available on crate feature
zeroize only.Source§impl Drop for SecureCredentials
impl Drop for SecureCredentials
Source§impl From<Credentials> for SecureCredentials
Available on crate feature zeroize only.Convert from non-secure credentials to secure credentials.
impl From<Credentials> for SecureCredentials
Available on crate feature
zeroize only.Convert from non-secure credentials to secure credentials.
Source§fn from(creds: Credentials) -> SecureCredentials
fn from(creds: Credentials) -> SecureCredentials
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SecureCredentials
impl RefUnwindSafe for SecureCredentials
impl Send for SecureCredentials
impl Sync for SecureCredentials
impl Unpin for SecureCredentials
impl UnsafeUnpin for SecureCredentials
impl UnwindSafe for SecureCredentials
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