pub struct Auth { /* private fields */ }Expand description
leash.auth() — non-throwing identity reads off the request that the
client was constructed from.
The methods are async so the surface aligns with the rest of the SDK and
stays flexible for a future remote-verify flow (today decode is purely
in-memory).
Implementations§
Source§impl Auth
impl Auth
Sourcepub async fn user(&self) -> Result<Option<LeashUser>>
pub async fn user(&self) -> Result<Option<LeashUser>>
Return the authenticated user, or None when not authenticated.
Never errors on a missing/invalid cookie — handlers can branch
cleanly with if user.is_none().
Sourcepub async fn is_authenticated(&self) -> Result<bool>
pub async fn is_authenticated(&self) -> Result<bool>
true when Self::user would return Some(_).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Auth
impl RefUnwindSafe for Auth
impl Send for Auth
impl Sync for Auth
impl Unpin for Auth
impl UnsafeUnpin for Auth
impl UnwindSafe for Auth
Blanket Implementations§
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