pub struct EmbeddedAuthClient { /* private fields */ }Expand description
AuthClient implementation backed by an embedded AllowThem handle.
Wraps an AllowThem and a login URL. Consuming projects that also need
direct AllowThem access (login flow, registration, cookie generation) can
keep a separate clone in their state — cloning AllowThem is cheap (Arc).
Implementations§
Trait Implementations§
Source§impl AuthClient for EmbeddedAuthClient
impl AuthClient for EmbeddedAuthClient
Source§fn validate_session<'a>(
&'a self,
token: &'a SessionToken,
) -> AuthFuture<'a, Option<User>>
fn validate_session<'a>( &'a self, token: &'a SessionToken, ) -> AuthFuture<'a, Option<User>>
Validate a session token and return the active user. Read more
Source§fn check_role<'a>(
&'a self,
user_id: &'a UserId,
role: &'a RoleName,
) -> AuthFuture<'a, bool>
fn check_role<'a>( &'a self, user_id: &'a UserId, role: &'a RoleName, ) -> AuthFuture<'a, bool>
Check whether a user has the given role.
Source§fn check_permission<'a>(
&'a self,
user_id: &'a UserId,
permission: &'a PermissionName,
) -> AuthFuture<'a, bool>
fn check_permission<'a>( &'a self, user_id: &'a UserId, permission: &'a PermissionName, ) -> AuthFuture<'a, bool>
Check whether a user has the given permission (direct or via role).
Source§fn resolve_highest_role<'a>(
&'a self,
user_id: &'a UserId,
hierarchy: &'a [&str],
) -> AuthFuture<'a, Option<String>>
fn resolve_highest_role<'a>( &'a self, user_id: &'a UserId, hierarchy: &'a [&str], ) -> AuthFuture<'a, Option<String>>
Return the name of the first role in
hierarchy that the user holds. Read moreSource§fn logout<'a>(&'a self, token: &'a SessionToken) -> AuthFuture<'a, ()>
fn logout<'a>(&'a self, token: &'a SessionToken) -> AuthFuture<'a, ()>
Invalidate a session. Fire-and-forget — non-existent sessions are not errors.
The cookie name used for session tokens.
Auto Trait Implementations§
impl Freeze for EmbeddedAuthClient
impl !RefUnwindSafe for EmbeddedAuthClient
impl Send for EmbeddedAuthClient
impl Sync for EmbeddedAuthClient
impl Unpin for EmbeddedAuthClient
impl UnsafeUnpin for EmbeddedAuthClient
impl !UnwindSafe for EmbeddedAuthClient
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more