pub struct GuardBuilder<St, S = Uuid> { /* private fields */ }Expand description
Builds a Guard. Start with Guard::builder.
Implementations§
Source§impl<St: SessionStore, S: Subject> GuardBuilder<St, S>
impl<St: SessionStore, S: Subject> GuardBuilder<St, S>
Sourcepub fn subject<T: Subject>(self) -> GuardBuilder<St, T>
pub fn subject<T: Subject>(self) -> GuardBuilder<St, T>
Uses T as the subject type.
Sourcepub fn ip_intel(self, intel: impl IpIntel) -> Self
pub fn ip_intel(self, intel: impl IpIntel) -> Self
Country / ASN source. Without one, IP changes are judged by network prefix only.
Sourcepub fn on_event(
self,
hook: impl Fn(&SessionEvent) + Send + Sync + 'static,
) -> Self
pub fn on_event( self, hook: impl Fn(&SessionEvent) + Send + Sync + 'static, ) -> Self
Called synchronously once per state change, in the process that made the change, after
the event is stored. When concurrent requests race, only the one whose change took
effect reports it; the exception is step_up_required, which two requests that both
trip it may each report. Keep it fast; a panic in the hook is caught and logged.
Delivery is at most once. There is no outbox, so a crash between the change and the hook loses the event.
With alert_dedup_window set, enforced
security-relevant events reach the hook at most once per subject and kind per window;
the rest are still logged and stored. If the store cannot claim the alert, the hook is
called anyway.
Sourcepub fn clock(self, clock: impl Clock) -> Self
pub fn clock(self, clock: impl Clock) -> Self
Time source (default SystemClock).
Auto Trait Implementations§
impl<St, S = Uuid> !RefUnwindSafe for GuardBuilder<St, S>
impl<St, S = Uuid> !UnwindSafe for GuardBuilder<St, S>
impl<St, S> Freeze for GuardBuilder<St, S>
impl<St, S> Send for GuardBuilder<St, S>
impl<St, S> Sync for GuardBuilder<St, S>
impl<St, S> Unpin for GuardBuilder<St, S>
impl<St, S> UnsafeUnpin for GuardBuilder<St, S>
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
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 more