pub enum AuthMethod {
None,
Basic {
username: String,
password: String,
},
Bearer {
token: String,
},
ApiKey {
key: String,
header_name: Option<String>,
query_param: Option<String>,
},
OAuth2 {
client_id: String,
client_secret: Option<String>,
access_token: Option<String>,
refresh_token: Option<String>,
token_url: String,
scopes: Vec<String>,
expires_at: Option<DateTime<Utc>>,
grant_type: OAuth2GrantType,
},
SshKey {
username: String,
private_key_path: String,
passphrase: Option<String>,
},
SshPassword {
username: String,
password: String,
},
MutualTls {
cert_path: String,
key_path: String,
ca_path: Option<String>,
},
}Expand description
Supported authentication methods.
Variants§
None
No authentication required.
Basic
HTTP Basic authentication.
Bearer
Bearer token (API key, JWT, etc).
ApiKey
API key in header or query parameter.
OAuth2
OAuth 2.0 with token refresh.
Fields
§
grant_type: OAuth2GrantTypeSshKey
SSH key authentication.
SshPassword
SSH password authentication.
MutualTls
Mutual TLS (client certificate).
Implementations§
Source§impl AuthMethod
impl AuthMethod
Sourcepub fn has_expiry(&self) -> bool
pub fn has_expiry(&self) -> bool
Whether this auth method has an expirable token.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Whether the token is expired (if applicable).
Sourcepub fn needs_refresh(&self) -> bool
pub fn needs_refresh(&self) -> bool
Whether this auth method needs a refresh.
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Display name for the auth method type.
Trait Implementations§
Source§impl Clone for AuthMethod
impl Clone for AuthMethod
Source§fn clone(&self) -> AuthMethod
fn clone(&self) -> AuthMethod
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 AuthMethod
impl Debug for AuthMethod
Source§impl<'de> Deserialize<'de> for AuthMethod
impl<'de> Deserialize<'de> for AuthMethod
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AuthMethod
impl RefUnwindSafe for AuthMethod
impl Send for AuthMethod
impl Sync for AuthMethod
impl Unpin for AuthMethod
impl UnsafeUnpin for AuthMethod
impl UnwindSafe for AuthMethod
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