pub trait Authenticatable:
Send
+ Sync
+ 'static {
// Required methods
fn auth_identifier(&self) -> String;
fn auth_password_hash(&self) -> Option<&str>;
// Provided methods
fn auth_username_column() -> &'static str
where Self: Sized { ... }
fn auth_token_column() -> &'static str
where Self: Sized { ... }
}Expand description
A model that can be authenticated.
Implemented on the application’s user model. The framework only ever needs these three facts about it, which is what keeps the guards independent of whatever else a user row holds.
Required Methods§
Sourcefn auth_identifier(&self) -> String
fn auth_identifier(&self) -> String
The value that identifies this user in a session or a token subject.
Sourcefn auth_password_hash(&self) -> Option<&str>
fn auth_password_hash(&self) -> Option<&str>
The stored password hash, or None for a user who cannot log in with a
password (an SSO-only or machine account).
Provided Methods§
Sourcefn auth_username_column() -> &'static strwhere
Self: Sized,
fn auth_username_column() -> &'static strwhere
Self: Sized,
The column credentials are looked up by — usually email.
Sourcefn auth_token_column() -> &'static strwhere
Self: Sized,
fn auth_token_column() -> &'static strwhere
Self: Sized,
The column holding an API token, when the application issues them.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".