Skip to main content

TokenInterface

Trait TokenInterface 

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

Source

fn is_authenticated(&self) -> bool

Whether authentication succeeded.

Source

fn user(&self) -> Option<&dyn UserInterface>

Authenticated user when present.

Source

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

Implementors§