Skip to main content

AuthenticatableUser

Trait AuthenticatableUser 

Source
pub trait AuthenticatableUser:
    Clone
    + Send
    + Sync {
Show 13 methods // Required methods fn id(&self) -> &Uuid; fn email(&self) -> &str; fn password_hash(&self) -> &str; fn is_active(&self) -> bool; fn is_locked(&self) -> bool; fn roles(&self) -> &[String]; // Provided methods fn two_factor_enabled(&self) -> bool { ... } fn two_factor_methods(&self) -> &[String] { ... } fn account_expires_at(&self) -> Option<DateTime<Utc>> { ... } fn requires_password_change(&self) -> bool { ... } fn last_login_at(&self) -> Option<DateTime<Utc>> { ... } fn failed_login_attempts(&self) -> u32 { ... } fn locked_until(&self) -> Option<DateTime<Utc>> { ... }
}
Expand description

Trait for user entities that can be authenticated

Implement this trait for your domain User entity to use with authentication.

Required Methods§

Source

fn id(&self) -> &Uuid

User ID

Source

fn email(&self) -> &str

User email address

Source

fn password_hash(&self) -> &str

Password hash for verification

Source

fn is_active(&self) -> bool

Whether the user account is active

Source

fn is_locked(&self) -> bool

Whether the user account is locked

Source

fn roles(&self) -> &[String]

User roles (e.g., [“admin”, “user”])

Provided Methods§

Source

fn two_factor_enabled(&self) -> bool

Whether 2FA is enabled

Source

fn two_factor_methods(&self) -> &[String]

2FA methods available to user

Source

fn account_expires_at(&self) -> Option<DateTime<Utc>>

Account expiration timestamp

Source

fn requires_password_change(&self) -> bool

Whether user must change password

Source

fn last_login_at(&self) -> Option<DateTime<Utc>>

Last login timestamp

Source

fn failed_login_attempts(&self) -> u32

Number of failed login attempts

Source

fn locked_until(&self) -> Option<DateTime<Utc>>

When account lockout expires

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§