pub struct AuthorizedKeysAuth { /* private fields */ }Expand description
Authorized keys file-based authentication.
Loads and caches keys from an OpenSSH authorized_keys file.
Supports hot-reloading when the file changes.
§Example
ⓘ
use wish::auth::AuthorizedKeysAuth;
let auth = AuthorizedKeysAuth::new("/home/user/.ssh/authorized_keys")
.expect("Failed to load authorized_keys");
// Reload keys after file change
auth.reload().await.expect("Failed to reload");Implementations§
Source§impl AuthorizedKeysAuth
impl AuthorizedKeysAuth
Sourcepub fn per_user(keys_path: impl AsRef<Path>) -> Self
pub fn per_user(keys_path: impl AsRef<Path>) -> Self
Creates an auth handler that uses per-user authorized_keys files.
The path should contain %u which will be replaced with the username.
For example: /home/%u/.ssh/authorized_keys
Sourcepub fn cached_key_count(&self) -> usize
pub fn cached_key_count(&self) -> usize
Returns the number of cached keys.
Trait Implementations§
Source§impl AuthHandler for AuthorizedKeysAuth
impl AuthHandler for AuthorizedKeysAuth
Source§fn auth_publickey<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 AuthContext,
key: &'life2 PublicKey,
) -> Pin<Box<dyn Future<Output = AuthResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn auth_publickey<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 AuthContext,
key: &'life2 PublicKey,
) -> Pin<Box<dyn Future<Output = AuthResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Authenticate with public key. Read more
Source§fn supported_methods(&self) -> Vec<AuthMethod>
fn supported_methods(&self) -> Vec<AuthMethod>
Returns the authentication methods supported by this handler.
Source§fn auth_password<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 AuthContext,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn auth_password<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 AuthContext,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Authenticate with password. Read more
Source§fn auth_keyboard_interactive<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 AuthContext,
response: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn auth_keyboard_interactive<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ctx: &'life1 AuthContext,
response: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Authenticate with keyboard-interactive. Read more
Source§fn auth_none<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = AuthResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn auth_none<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 AuthContext,
) -> Pin<Box<dyn Future<Output = AuthResult> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if “none” authentication is allowed. Read more
Auto Trait Implementations§
impl Freeze for AuthorizedKeysAuth
impl !RefUnwindSafe for AuthorizedKeysAuth
impl Send for AuthorizedKeysAuth
impl Sync for AuthorizedKeysAuth
impl Unpin for AuthorizedKeysAuth
impl !UnwindSafe for AuthorizedKeysAuth
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