pub struct AuditLogger<S: AuditStorage> { /* private fields */ }
Expand description
Main audit logger
Implementations§
Source§impl<S: AuditStorage> AuditLogger<S>
impl<S: AuditStorage> AuditLogger<S>
Sourcepub async fn log_event(&self, event: AuditEvent) -> Result<()>
pub async fn log_event(&self, event: AuditEvent) -> Result<()>
Log an audit event
Sourcepub async fn log_login_success(
&self,
user_id: &str,
session_id: &str,
metadata: RequestMetadata,
) -> Result<()>
pub async fn log_login_success( &self, user_id: &str, session_id: &str, metadata: RequestMetadata, ) -> Result<()>
Log authentication success
Sourcepub async fn log_login_failure(
&self,
attempted_user: &str,
reason: &str,
metadata: RequestMetadata,
) -> Result<()>
pub async fn log_login_failure( &self, attempted_user: &str, reason: &str, metadata: RequestMetadata, ) -> Result<()>
Log authentication failure
Sourcepub async fn log_permission_denied(
&self,
user_id: &str,
resource: ResourceInfo,
permission: &str,
metadata: RequestMetadata,
) -> Result<()>
pub async fn log_permission_denied( &self, user_id: &str, resource: ResourceInfo, permission: &str, metadata: RequestMetadata, ) -> Result<()>
Log permission denied event
Sourcepub async fn log_suspicious_activity(
&self,
user_id: Option<&str>,
activity_type: &str,
description: &str,
metadata: RequestMetadata,
) -> Result<()>
pub async fn log_suspicious_activity( &self, user_id: Option<&str>, activity_type: &str, description: &str, metadata: RequestMetadata, ) -> Result<()>
Log suspicious activity
Sourcepub async fn query_events(&self, query: &AuditQuery) -> Result<Vec<AuditEvent>>
pub async fn query_events(&self, query: &AuditQuery) -> Result<Vec<AuditEvent>>
Query audit events
Sourcepub async fn get_statistics(
&self,
query: &StatsQuery,
) -> Result<AuditStatistics>
pub async fn get_statistics( &self, query: &StatsQuery, ) -> Result<AuditStatistics>
Get audit statistics
Sourcepub async fn get_failed_login_count_24h(&self) -> Result<u64>
pub async fn get_failed_login_count_24h(&self) -> Result<u64>
Get failed login count in the last 24 hours
Sourcepub async fn get_successful_login_count_24h(&self) -> Result<u64>
pub async fn get_successful_login_count_24h(&self) -> Result<u64>
Get successful login count in the last 24 hours
Sourcepub async fn get_token_issued_count_24h(&self) -> Result<u64>
pub async fn get_token_issued_count_24h(&self) -> Result<u64>
Get token issued count in the last 24 hours
Sourcepub async fn get_unique_users_24h(&self) -> Result<u64>
pub async fn get_unique_users_24h(&self) -> Result<u64>
Get unique users count in the last 24 hours
Sourcepub async fn get_password_reset_count_24h(&self) -> Result<u64>
pub async fn get_password_reset_count_24h(&self) -> Result<u64>
Get password reset count in the last 24 hours
Sourcepub async fn get_admin_action_count_24h(&self) -> Result<u64>
pub async fn get_admin_action_count_24h(&self) -> Result<u64>
Get admin action count in the last 24 hours
Sourcepub async fn get_security_alert_count_24h(&self) -> Result<u64>
pub async fn get_security_alert_count_24h(&self) -> Result<u64>
Get security alert count in the last 24 hours
Sourcepub async fn cleanup_old_events(&self, retention_days: u32) -> Result<u64>
pub async fn cleanup_old_events(&self, retention_days: u32) -> Result<u64>
Clean up old audit events
Auto Trait Implementations§
impl<S> !Freeze for AuditLogger<S>
impl<S> RefUnwindSafe for AuditLogger<S>where
S: RefUnwindSafe,
impl<S> Send for AuditLogger<S>
impl<S> Sync for AuditLogger<S>
impl<S> Unpin for AuditLogger<S>where
S: Unpin,
impl<S> UnwindSafe for AuditLogger<S>where
S: UnwindSafe,
Blanket Implementations§
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<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