pub enum Credentials {
UsernamePassword {
username: String,
password: String,
},
Token {
username: String,
token: String,
},
Certificate {
cert_pem: String,
key_pem: String,
username: Option<String>,
},
}Expand description
Credentials returned by an identity provider.
Variants§
UsernamePassword
Traditional username and password authentication.
Token
Token-based authentication (Azure AD, AWS IAM, etc.).
Certificate
Client certificate authentication (mTLS).
Used for database connections that authenticate via TLS client certificates instead of passwords or tokens.
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn into_auth_pair(self) -> (String, String)
pub fn into_auth_pair(self) -> (String, String)
Extract username and password/token for connection string building.
§Panics
Panics if called on Certificate credentials. Use into_certificate
for certificate-based authentication.
Sourcepub fn into_certificate(self) -> (String, String, Option<String>)
pub fn into_certificate(self) -> (String, String, Option<String>)
Extract certificate and key for TLS client authentication.
Returns (cert_pem, key_pem, optional_username).
§Panics
Panics if called on non-Certificate credentials.
Sourcepub fn is_certificate(&self) -> bool
pub fn is_certificate(&self) -> bool
Returns true if this is a Certificate variant.
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl PartialEq for Credentials
impl PartialEq for Credentials
impl Eq for Credentials
impl StructuralPartialEq for Credentials
Auto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnsafeUnpin for Credentials
impl UnwindSafe for Credentials
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.