pub trait AuthMetricsCollector: Send + Sync {
// Provided methods
fn metrics(&self) -> Option<&AuthMetrics> { ... }
fn record_auth_attempt(
&self,
success: bool,
error_code: Option<&AuthErrorCode>,
) { ... }
fn time_jwks_fetch<F, R>(&self, f: F) -> R
where F: FnOnce() -> R { ... }
fn time_verification<F, R>(&self, f: F) -> R
where F: FnOnce() -> R { ... }
}Expand description
Trait for collecting auth metrics
Provided Methods§
Sourcefn metrics(&self) -> Option<&AuthMetrics>
fn metrics(&self) -> Option<&AuthMetrics>
Get auth metrics
Sourcefn record_auth_attempt(&self, success: bool, error_code: Option<&AuthErrorCode>)
fn record_auth_attempt(&self, success: bool, error_code: Option<&AuthErrorCode>)
Record an authentication attempt with metrics
Sourcefn time_jwks_fetch<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
fn time_jwks_fetch<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
Time a JWKS fetch operation
Sourcefn time_verification<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
fn time_verification<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
Time a token verification operation
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.