#[non_exhaustive]pub enum AuthMethod {
Password(String),
PrivateKey {
key_data: String,
key_pass: Option<String>,
},
PrivateKeyFile {
key_file_path: PathBuf,
key_pass: Option<String>,
},
PublicKeyFile {
key_file_path: PathBuf,
},
Agent,
KeyboardInteractive(AuthKeyboardInteractive),
}
Expand description
An authentification token.
Used when creating a Client
for authentification.
Supports password, private key, public key, SSH agent, and keyboard interactive authentication.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Password(String)
PrivateKey
PrivateKeyFile
PublicKeyFile
Agent
KeyboardInteractive(AuthKeyboardInteractive)
Implementations§
Source§impl AuthMethod
impl AuthMethod
Sourcepub fn with_password(password: &str) -> Self
pub fn with_password(password: &str) -> Self
Convenience method to create a AuthMethod
from a string literal.
pub fn with_key(key: &str, passphrase: Option<&str>) -> Self
pub fn with_key_file<T: AsRef<Path>>( key_file_path: T, passphrase: Option<&str>, ) -> Self
pub fn with_public_key_file<T: AsRef<Path>>(key_file_path: T) -> Self
Sourcepub fn with_agent() -> Self
pub fn with_agent() -> Self
Creates a new SSH agent authentication method.
This will attempt to authenticate using all identities available in the SSH agent. The SSH agent must be running and the SSH_AUTH_SOCK environment variable must be set.
§Example
use async_ssh2_tokio::client::AuthMethod;
let auth = AuthMethod::with_agent();
§Platform Support
This method is only available on Unix-like systems (Linux, macOS, etc.). It is not available on Windows.
pub const fn with_keyboard_interactive(auth: AuthKeyboardInteractive) -> Self
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 · 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 From<AuthKeyboardInteractive> for AuthMethod
impl From<AuthKeyboardInteractive> for AuthMethod
Source§fn from(value: AuthKeyboardInteractive) -> Self
fn from(value: AuthKeyboardInteractive) -> Self
Converts to this type from the input type.
Source§impl Hash for AuthMethod
impl Hash for AuthMethod
Source§impl PartialEq for AuthMethod
impl PartialEq for AuthMethod
impl Eq for AuthMethod
impl StructuralPartialEq for AuthMethod
Auto Trait Implementations§
impl Freeze for AuthMethod
impl RefUnwindSafe for AuthMethod
impl Send for AuthMethod
impl Sync for AuthMethod
impl Unpin 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