Skip to content

Commit 8b03f14

Browse files
nipierreMarcAntoine-Arnaud
authored andcommitted
feat: add new authentication types
1 parent a1933a6 commit 8b03f14

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/authentication.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ use std::path::PathBuf;
55
#[derive(Clone, Debug, Eq, PartialEq)]
66
pub enum AuthenticationType {
77
Interactive,
8+
Agent,
89
KeyFile(PathBuf),
10+
KeyMemory(String),
911
Password(String),
1012
}
1113

@@ -19,8 +21,14 @@ impl AuthenticationType {
1921
AuthenticationType::Interactive => {
2022
unimplemented!()
2123
}
22-
AuthenticationType::KeyFile(_key_file_path) => {
23-
unimplemented!()
24+
AuthenticationType::Agent => {
25+
session.userauth_agent(username)?;
26+
}
27+
AuthenticationType::KeyFile(private_key_file_path) => {
28+
session.userauth_pubkey_file(username, None, private_key_file_path, None)?;
29+
}
30+
AuthenticationType::KeyMemory(private_key) => {
31+
session.userauth_pubkey_memory(username, None, private_key, None)?;
2432
}
2533
AuthenticationType::Password(password) => {
2634
if session

0 commit comments

Comments
 (0)