pub trait AuthBackend: Send + Sync {
// Required methods
fn authenticate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 Username,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn verify_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 Username,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_users<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Username>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 Username,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn delete_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 Username,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn change_password<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 Username,
new_password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
// Provided methods
fn get_scram_params<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, u32)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_scram_stored_key<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_scram_server_key<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn store_scram_credentials<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 Username,
_salt: Vec<u8>,
_iterations: u32,
_stored_key: Vec<u8>,
_server_key: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn get_apop_secret<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 Username,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Required Methods§
Sourcefn authenticate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 Username,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn authenticate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 Username,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Authenticate a user with username and password
Sourcefn verify_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 Username,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn verify_identity<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 Username,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Verify if a username maps to a valid identity
Sourcefn list_users<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Username>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_users<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Username>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all users (for admin CLI)
Sourcefn create_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 Username,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn create_user<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 Username,
password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Create a new user with the given password
Sourcefn delete_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 Username,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_user<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 Username,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a user
Sourcefn change_password<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 Username,
new_password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn change_password<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 Username,
new_password: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Change a user’s password
Provided Methods§
Sourcefn get_scram_params<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, u32)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_scram_params<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(Vec<u8>, u32)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get SCRAM-SHA-256 parameters (salt, iteration count) for a user
Returns (salt, iterations) if SCRAM credentials are stored. Default implementation returns an error indicating SCRAM is not supported.
Sourcefn get_scram_stored_key<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_scram_stored_key<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get SCRAM-SHA-256 StoredKey for a user
StoredKey = SHA256(ClientKey) where ClientKey = HMAC(SaltedPassword, “Client Key”) Default implementation returns an error indicating SCRAM is not supported.
Sourcefn get_scram_server_key<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_scram_server_key<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get SCRAM-SHA-256 ServerKey for a user
ServerKey = HMAC(SaltedPassword, “Server Key”) Default implementation returns an error indicating SCRAM is not supported.
Sourcefn store_scram_credentials<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 Username,
_salt: Vec<u8>,
_iterations: u32,
_stored_key: Vec<u8>,
_server_key: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn store_scram_credentials<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 Username,
_salt: Vec<u8>,
_iterations: u32,
_stored_key: Vec<u8>,
_server_key: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Store SCRAM-SHA-256 credentials for a user
This should store: salt, iterations, StoredKey, and ServerKey Default implementation returns an error indicating SCRAM is not supported.
Sourcefn get_apop_secret<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 Username,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_apop_secret<'life0, 'life1, 'async_trait>(
&'life0 self,
_username: &'life1 Username,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get plaintext password for APOP authentication
Returns the plaintext password if available. Default implementation returns an error indicating APOP is not supported.
WARNING: This method exposes plaintext passwords and should only be used for APOP authentication. Consider disabling APOP in production environments.