pub struct AuthManager<U: Authenticatable> { /* private fields */ }Expand description
Resolves named guards — guard("api") picks one by name.
One user type per manager. An application with genuinely different user kinds (customers and staff, with different tables) wants one manager each, which is also clearer than a single registry returning different shapes.
Implementations§
Source§impl<U: Authenticatable> AuthManager<U>
impl<U: Authenticatable> AuthManager<U>
Sourcepub fn default_guard(&self) -> Result<&Arc<dyn Guard<U>>>
pub fn default_guard(&self) -> Result<&Arc<dyn Guard<U>>>
The default guard.
Sourcepub fn default_name(&self) -> &str
pub fn default_name(&self) -> &str
The default guard’s name.
Sourcepub fn guard_names(&self) -> Vec<&str>
pub fn guard_names(&self) -> Vec<&str>
Every registered guard’s name.
Sourcepub async fn user(&self, request: &Request) -> Result<Option<U>>
pub async fn user(&self, request: &Request) -> Result<Option<U>>
The user behind request, via the default guard.
Sourcepub async fn user_via(&self, name: &str, request: &Request) -> Result<Option<U>>
pub async fn user_via(&self, name: &str, request: &Request) -> Result<Option<U>>
The user behind request, via a named guard.
Trait Implementations§
Auto Trait Implementations§
impl<U> !RefUnwindSafe for AuthManager<U>
impl<U> !UnwindSafe for AuthManager<U>
impl<U> Freeze for AuthManager<U>
impl<U> Send for AuthManager<U>
impl<U> Sync for AuthManager<U>
impl<U> Unpin for AuthManager<U>
impl<U> UnsafeUnpin for AuthManager<U>
Blanket Implementations§
impl<T> Actor for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
A human-readable name, used by wildcard listeners and log output.
Always the Rust type path; see the trait docs.