pub trait Authenticatable {
// Required method
fn auth_identifier(&self) -> String;
}Expand description
Anything that can be logged in.
Only an identifier is required, because that is genuinely all the session needs to hold: everything else about the user is loaded from wherever users live. Keeping a whole serialized user in a session cookie is how stale — and eventually wrong — permissions get carried around for hours.
Required Methods§
Sourcefn auth_identifier(&self) -> String
fn auth_identifier(&self) -> String
The value stored in the session, usually a primary key.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".