pub trait TokenInterface: Send + Sync {
// Required methods
fn is_authenticated(&self) -> bool;
fn user(&self) -> Option<&dyn UserInterface>;
fn credentials(&self) -> Option<&str>;
}Expand description
Security token carrying credentials and optional user.
Required Methods§
Sourcefn is_authenticated(&self) -> bool
fn is_authenticated(&self) -> bool
Whether authentication succeeded.
Sourcefn user(&self) -> Option<&dyn UserInterface>
fn user(&self) -> Option<&dyn UserInterface>
Authenticated user when present.
Sourcefn credentials(&self) -> Option<&str>
fn credentials(&self) -> Option<&str>
Raw credentials string when present (bearer, API key, …).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".