pub struct SecurityAuditStats {
pub active_sessions: u64,
pub failed_logins_24h: u64,
pub successful_logins_24h: u64,
pub unique_users_24h: u64,
pub token_issued_24h: u64,
pub password_resets_24h: u64,
pub admin_actions_24h: u64,
pub security_alerts_24h: u64,
pub collection_timestamp: DateTime<Utc>,
}Expand description
Security audit statistics aggregated from audit logs.
Provides comprehensive security metrics for monitoring and incident response.
Fields§
§active_sessions: u64§failed_logins_24h: u64§successful_logins_24h: u64§unique_users_24h: u64§token_issued_24h: u64§password_resets_24h: u64§admin_actions_24h: u64§security_alerts_24h: u64§collection_timestamp: DateTime<Utc>Implementations§
Source§impl SecurityAuditStats
impl SecurityAuditStats
Sourcepub fn security_score(&self) -> f64
pub fn security_score(&self) -> f64
Calculate security score based on current metrics. Returns a value between 0.0 (critical) and 1.0 (excellent).
Sourcepub fn requires_immediate_attention(&self) -> bool
pub fn requires_immediate_attention(&self) -> bool
Returns true if security metrics require immediate administrative attention.
Criteria: > 100 failed logins, > 5 security alerts, or security score < 0.3.
use auth_framework::audit::SecurityAuditStats;
if security_stats.requires_immediate_attention() {
alert_security_team(&security_stats);
}Sourcepub fn security_alert_message(&self) -> Option<String>
pub fn security_alert_message(&self) -> Option<String>
Generates a human-readable alert message when immediate attention is required.
Returns None if no immediate security concerns are detected.
use auth_framework::audit::SecurityAuditStats;
if let Some(alert) = security_stats.security_alert_message() {
log::error!("Security Alert: {}", alert);
notify_administrators(&alert);
}Trait Implementations§
Source§impl Clone for SecurityAuditStats
impl Clone for SecurityAuditStats
Source§fn clone(&self) -> SecurityAuditStats
fn clone(&self) -> SecurityAuditStats
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecurityAuditStats
impl Debug for SecurityAuditStats
Source§impl<'de> Deserialize<'de> for SecurityAuditStats
impl<'de> Deserialize<'de> for SecurityAuditStats
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SecurityAuditStats
impl RefUnwindSafe for SecurityAuditStats
impl Send for SecurityAuditStats
impl Sync for SecurityAuditStats
impl Unpin for SecurityAuditStats
impl UnsafeUnpin for SecurityAuditStats
impl UnwindSafe for SecurityAuditStats
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> 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>
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