Skip to main content

Authenticatable

Trait Authenticatable 

Source
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§

Source

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".

Implementations on Foreign Types§

Source§

impl Authenticatable for String

Source§

impl Authenticatable for i64

Source§

impl Authenticatable for str

Implementors§