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§

source

type Error

The error type returned by the repository

Required Methods§

source

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

source

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 use
  • clock: The clock used to generate timestamps
  • user: The user to set the password for
  • version: The version of the hashing scheme used
  • hashed_password: The hashed password
  • upgraded_from: The password this password was upgraded from, if any
§Errors

Returns Self::Error if underlying repository fails

Implementations on Foreign Types§

source§

impl<R> UserPasswordRepository for Box<R>

§

type Error = <R as UserPasswordRepository>::Error

source§

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,

source§

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,

Implementors§

source§

impl<R, F, E> UserPasswordRepository for MapErr<R, F>

§

type Error = E