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§
Sourcefn password_hash(&self) -> &str
fn password_hash(&self) -> &str
Password hash for verification
Provided Methods§
Sourcefn two_factor_enabled(&self) -> bool
fn two_factor_enabled(&self) -> bool
Whether 2FA is enabled
Sourcefn two_factor_methods(&self) -> &[String]
fn two_factor_methods(&self) -> &[String]
2FA methods available to user
Sourcefn account_expires_at(&self) -> Option<DateTime<Utc>>
fn account_expires_at(&self) -> Option<DateTime<Utc>>
Account expiration timestamp
Sourcefn requires_password_change(&self) -> bool
fn requires_password_change(&self) -> bool
Whether user must change password
Sourcefn last_login_at(&self) -> Option<DateTime<Utc>>
fn last_login_at(&self) -> Option<DateTime<Utc>>
Last login timestamp
Sourcefn failed_login_attempts(&self) -> u32
fn failed_login_attempts(&self) -> u32
Number of failed login attempts
Sourcefn locked_until(&self) -> Option<DateTime<Utc>>
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".