pub enum Credential {
Show 13 variants
Password {
username: String,
password: String,
},
OAuth {
authorization_code: String,
redirect_uri: Option<String>,
code_verifier: Option<String>,
state: Option<String>,
},
OAuthRefresh {
refresh_token: String,
},
ApiKey {
key: String,
},
Jwt {
token: String,
},
Bearer {
token: String,
},
Basic {
credentials: String,
},
Custom {
method: String,
data: HashMap<String, String>,
},
Mfa {
primary_credential: Box<Credential>,
mfa_code: String,
challenge_id: String,
},
Certificate {
certificate: Vec<u8>,
private_key: Vec<u8>,
passphrase: Option<String>,
},
OpenIdConnect {
id_token: String,
access_token: Option<String>,
refresh_token: Option<String>,
},
DeviceCode {
device_code: String,
client_id: String,
user_code: Option<String>,
verification_uri: Option<String>,
verification_uri_complete: Option<String>,
expires_in: Option<u64>,
interval: Option<u64>,
},
EnhancedDeviceFlow {
device_code: String,
user_code: String,
verification_uri: String,
verification_uri_complete: Option<String>,
expires_in: u64,
interval: u64,
client_id: String,
client_secret: Option<String>,
scopes: Vec<String>,
},
}
Expand description
Represents different types of credentials that can be used for authentication.
Variants§
Password
Username and password credentials
OAuth
OAuth authorization code flow
OAuthRefresh
OAuth refresh token
ApiKey
API key authentication
Jwt
JSON Web Token
Bearer
Bearer token (generic)
Basic
Basic authentication (username:password base64 encoded)
Custom
Custom authentication with flexible key-value pairs
Mfa
Multi-factor authentication token
Certificate
Certificate-based authentication
OpenIdConnect
OpenID Connect ID token
DeviceCode
Device flow credentials (device code polling)
Fields
EnhancedDeviceFlow
Enhanced device flow credentials with full OAuth device flow support
Implementations§
Source§impl Credential
impl Credential
Sourcepub fn password(
username: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn password( username: impl Into<String>, password: impl Into<String>, ) -> Self
Create password credentials
Sourcepub fn oauth_code(authorization_code: impl Into<String>) -> Self
pub fn oauth_code(authorization_code: impl Into<String>) -> Self
Create OAuth authorization code credentials
Sourcepub fn oauth_code_with_pkce(
authorization_code: impl Into<String>,
code_verifier: impl Into<String>,
) -> Self
pub fn oauth_code_with_pkce( authorization_code: impl Into<String>, code_verifier: impl Into<String>, ) -> Self
Create OAuth authorization code credentials with PKCE
Sourcepub fn oauth_refresh(refresh_token: impl Into<String>) -> Self
pub fn oauth_refresh(refresh_token: impl Into<String>) -> Self
Create OAuth refresh token credentials
Sourcepub fn device_code(
device_code: impl Into<String>,
client_id: impl Into<String>,
) -> Self
pub fn device_code( device_code: impl Into<String>, client_id: impl Into<String>, ) -> Self
Create device code credentials for device flow
Sourcepub fn basic(username: impl Into<String>, password: impl Into<String>) -> Self
pub fn basic(username: impl Into<String>, password: impl Into<String>) -> Self
Create basic authentication credentials
Sourcepub fn custom(method: impl Into<String>, data: HashMap<String, String>) -> Self
pub fn custom(method: impl Into<String>, data: HashMap<String, String>) -> Self
Create custom credentials
Sourcepub fn mfa(
primary_credential: Credential,
mfa_code: impl Into<String>,
challenge_id: impl Into<String>,
) -> Self
pub fn mfa( primary_credential: Credential, mfa_code: impl Into<String>, challenge_id: impl Into<String>, ) -> Self
Create MFA credentials
Sourcepub fn certificate(
certificate: Vec<u8>,
private_key: Vec<u8>,
passphrase: Option<String>,
) -> Self
pub fn certificate( certificate: Vec<u8>, private_key: Vec<u8>, passphrase: Option<String>, ) -> Self
Create certificate credentials
Sourcepub fn openid_connect(id_token: impl Into<String>) -> Self
pub fn openid_connect(id_token: impl Into<String>) -> Self
Create SAML assertion credentials - REMOVED for security
Create OpenID Connect credentials
Sourcepub fn credential_type(&self) -> &str
pub fn credential_type(&self) -> &str
Get the credential type as a string
Sourcepub fn supports_refresh(&self) -> bool
pub fn supports_refresh(&self) -> bool
Check if this credential supports refresh
Sourcepub fn refresh_token(&self) -> Option<&str>
pub fn refresh_token(&self) -> Option<&str>
Extract refresh token if available
Sourcepub fn is_sensitive(&self) -> bool
pub fn is_sensitive(&self) -> bool
Check if this credential is sensitive and should be masked in logs
Sourcepub fn safe_display(&self) -> String
pub fn safe_display(&self) -> String
Get a safe representation for logging (masks sensitive data)
Trait Implementations§
Source§impl Clone for Credential
impl Clone for Credential
Source§fn clone(&self) -> Credential
fn clone(&self) -> Credential
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Credential
impl Debug for Credential
Source§impl<'de> Deserialize<'de> for Credential
impl<'de> Deserialize<'de> for Credential
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Credential
impl RefUnwindSafe for Credential
impl Send for Credential
impl Sync for Credential
impl Unpin for Credential
impl UnwindSafe for Credential
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more