pub struct LifecycleDeviceResolver<E, S, C>{ /* private fields */ }device only.Expand description
Built-in DeviceResolver composing
DeviceFingerprintExtractor + DeviceLifecycleService with
the four pluggable hooks documented in the module-level docs.
Cheap to clone (every field is Arc or Clone); construct once at
startup, hand to
SessionLayer::with_device_resolver.
Implementations§
Source§impl<E, S, C> LifecycleDeviceResolver<E, S, C>
impl<E, S, C> LifecycleDeviceResolver<E, S, C>
Sourcepub fn new(extractor: E, lifecycle: DeviceLifecycleService<S>, clock: C) -> Self
pub fn new(extractor: E, lifecycle: DeviceLifecycleService<S>, clock: C) -> Self
Construct with the three required collaborators and the
documented defaults for the four pluggable hooks. Override any
of them with with_tenant_fn / with_client_ip_fn /
with_user_fn / with_new_id_fn before passing the resolver
to the session layer.
Sourcepub fn with_tenant_fn<F>(self, f: F) -> Self
pub fn with_tenant_fn<F>(self, f: F) -> Self
Override the tenant-extraction strategy.
Sourcepub fn with_client_ip_fn<F>(self, f: F) -> Self
pub fn with_client_ip_fn<F>(self, f: F) -> Self
Override the client-IP extraction strategy.
Sourcepub fn with_user_fn<F>(self, f: F) -> Self
pub fn with_user_fn<F>(self, f: F) -> Self
Override the user-extraction strategy. Useful when an upstream
auth layer has already injected a UserId into the request
extensions and you want the device’s user_id field populated
at creation time. (Without this, devices are created at
user_id = None and become “owned” only when the application
updates them post-authn.)
Trait Implementations§
Source§impl<E, S, C> Clone for LifecycleDeviceResolver<E, S, C>
impl<E, S, C> Clone for LifecycleDeviceResolver<E, S, C>
Source§impl<E, S, C> DeviceResolver for LifecycleDeviceResolver<E, S, C>
impl<E, S, C> DeviceResolver for LifecycleDeviceResolver<E, S, C>
Source§type Error = <S as DeviceStore>::Error
type Error = <S as DeviceStore>::Error
DeviceStore::Error of the
underlying store.Auto Trait Implementations§
impl<E, S, C> Freeze for LifecycleDeviceResolver<E, S, C>where
S: Freeze,
impl<E, S, C> !RefUnwindSafe for LifecycleDeviceResolver<E, S, C>
impl<E, S, C> Send for LifecycleDeviceResolver<E, S, C>
impl<E, S, C> Sync for LifecycleDeviceResolver<E, S, C>
impl<E, S, C> Unpin for LifecycleDeviceResolver<E, S, C>where
S: Unpin,
impl<E, S, C> UnsafeUnpin for LifecycleDeviceResolver<E, S, C>where
S: UnsafeUnpin,
impl<E, S, C> !UnwindSafe for LifecycleDeviceResolver<E, S, C>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.