pub struct BcryptUserValidator { /* private fields */ }
Expand description
BCrypt password validator (requires bcrypt feature)
Implementations§
Source§impl BcryptUserValidator
impl BcryptUserValidator
Sourcepub fn add_user(&mut self, username: String, bcrypt_hash: String) -> &mut Self
pub fn add_user(&mut self, username: String, bcrypt_hash: String) -> &mut Self
Add a user with precomputed BCrypt hash
Sourcepub fn add_user_with_password(
&mut self,
username: String,
password: &str,
) -> AuthResult<&mut Self>
pub fn add_user_with_password( &mut self, username: String, password: &str, ) -> AuthResult<&mut Self>
Add a user with password, automatically hashing it with BCrypt
Sourcepub fn from_hashes(users: HashMap<String, String>) -> Self
pub fn from_hashes(users: HashMap<String, String>) -> Self
Create validator from HashMap of usernames and BCrypt hashes
Trait Implementations§
Source§impl Debug for BcryptUserValidator
impl Debug for BcryptUserValidator
Source§impl Default for BcryptUserValidator
impl Default for BcryptUserValidator
Source§impl UserValidator for BcryptUserValidator
impl UserValidator for BcryptUserValidator
Source§fn validate<'a>(
&'a self,
credentials: &'a Credentials,
) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'a>>
fn validate<'a>( &'a self, credentials: &'a Credentials, ) -> Pin<Box<dyn Future<Output = AuthResult<bool>> + Send + 'a>>
Validate user credentials
Source§fn user_count(&self) -> usize
fn user_count(&self) -> usize
Get user count
Source§fn pre_validate(&self, credentials: &Credentials) -> AuthResult<()>
fn pre_validate(&self, credentials: &Credentials) -> AuthResult<()>
Pre-validation check (optional)
Auto Trait Implementations§
impl Freeze for BcryptUserValidator
impl RefUnwindSafe for BcryptUserValidator
impl Send for BcryptUserValidator
impl Sync for BcryptUserValidator
impl Unpin for BcryptUserValidator
impl UnwindSafe for BcryptUserValidator
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