Trait mas_storage::user::UserPasswordRepository
source · pub trait UserPasswordRepository: Send + Sync {
type Error;
// Required methods
fn active<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user: &'life1 User,
) -> Pin<Box<dyn Future<Output = Result<Option<Password>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn add<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
user: &'life3 User,
version: u16,
hashed_password: String,
upgraded_from: Option<&'life4 Password>,
) -> Pin<Box<dyn Future<Output = Result<Password, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
}
Expand description
A UserPasswordRepository
helps interacting with Password
saved in
the storage backend
Required Associated Types§
Required Methods§
sourcefn active<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user: &'life1 User,
) -> Pin<Box<dyn Future<Output = Result<Option<Password>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn active<'life0, 'life1, 'async_trait>(
&'life0 mut self,
user: &'life1 User,
) -> Pin<Box<dyn Future<Output = Result<Option<Password>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get the active password for a user
Returns None
if the user has no password set
§Parameters
user
: The user to get the password for
§Errors
Returns Self::Error
if underlying repository fails
sourcefn add<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
user: &'life3 User,
version: u16,
hashed_password: String,
upgraded_from: Option<&'life4 Password>,
) -> Pin<Box<dyn Future<Output = Result<Password, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn add<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
user: &'life3 User,
version: u16,
hashed_password: String,
upgraded_from: Option<&'life4 Password>,
) -> Pin<Box<dyn Future<Output = Result<Password, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Set a new password for a user
Returns the newly created Password
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampsuser
: The user to set the password forversion
: The version of the hashing scheme usedhashed_password
: The hashed passwordupgraded_from
: The password this password was upgraded from, if any
§Errors
Returns Self::Error
if underlying repository fails