Skip to main content

UserLookup

Trait UserLookup 

Source
pub trait UserLookup:
    Send
    + Sync
    + 'static {
    // Required method
    fn find_user(
        &self,
        username: &str,
    ) -> Effect<Option<UserCredentials>, AuthError>;

    // Provided method
    fn update_password_hash(
        &self,
        username: &str,
        hash: PasswordHash,
    ) -> Effect<(), AuthError> { ... }
}
Expand description

Capability seam: finds a user’s credentials by login name. Implement it over the user table.

Required Methods§

Source

fn find_user( &self, username: &str, ) -> Effect<Option<UserCredentials>, AuthError>

The credentials of username, or None when there is no such user.

Provided Methods§

Source

fn update_password_hash( &self, username: &str, hash: PasswordHash, ) -> Effect<(), AuthError>

Store hash, the user’s password re-hashed under the current parameters. Called after a successful login whose stored hash was outdated; the default keeps the old one.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§