pub struct SecurityMonitor { /* private fields */ }
Expand description
Security monitoring and dashboard system
Implementations§
Source§impl SecurityMonitor
impl SecurityMonitor
Sourcepub fn new(config: SecurityMonitorConfig) -> Self
pub fn new(config: SecurityMonitorConfig) -> Self
Create a new security monitor
Sourcepub fn with_default_config() -> Self
pub fn with_default_config() -> Self
Create with default configuration
Sourcepub async fn record_event(&self, event: SecurityEvent)
pub async fn record_event(&self, event: SecurityEvent)
Record a security event
Sourcepub async fn record_violation(&self, violation: &SecurityViolation)
pub async fn record_violation(&self, violation: &SecurityViolation)
Record a security violation
Sourcepub async fn record_auth_event(
&self,
event_type: SecurityEventType,
auth_context: Option<&AuthContext>,
client_ip: Option<String>,
user_agent: Option<String>,
description: String,
)
pub async fn record_auth_event( &self, event_type: SecurityEventType, auth_context: Option<&AuthContext>, client_ip: Option<String>, user_agent: Option<String>, description: String, )
Record authentication event
Sourcepub async fn record_session_event(
&self,
event_type: SecurityEventType,
session: &Session,
description: String,
)
pub async fn record_session_event( &self, event_type: SecurityEventType, session: &Session, description: String, )
Record session event
Sourcepub async fn get_recent_events(
&self,
limit: Option<usize>,
) -> Vec<SecurityEvent>
pub async fn get_recent_events( &self, limit: Option<usize>, ) -> Vec<SecurityEvent>
Get recent security events
Sourcepub async fn get_events_by_type(
&self,
event_type: SecurityEventType,
since: Option<DateTime<Utc>>,
limit: Option<usize>,
) -> Vec<SecurityEvent>
pub async fn get_events_by_type( &self, event_type: SecurityEventType, since: Option<DateTime<Utc>>, limit: Option<usize>, ) -> Vec<SecurityEvent>
Get events by type
Sourcepub async fn get_events_by_user(
&self,
user_id: &str,
since: Option<DateTime<Utc>>,
limit: Option<usize>,
) -> Vec<SecurityEvent>
pub async fn get_events_by_user( &self, user_id: &str, since: Option<DateTime<Utc>>, limit: Option<usize>, ) -> Vec<SecurityEvent>
Get events by user
Sourcepub async fn generate_metrics(
&self,
start: DateTime<Utc>,
end: DateTime<Utc>,
) -> SecurityMetrics
pub async fn generate_metrics( &self, start: DateTime<Utc>, end: DateTime<Utc>, ) -> SecurityMetrics
Generate security metrics for a time period
Sourcepub async fn get_dashboard_data(&self) -> SecurityDashboard
pub async fn get_dashboard_data(&self) -> SecurityDashboard
Get current security dashboard data
Sourcepub async fn add_alert_rule(&self, rule: AlertRule)
pub async fn add_alert_rule(&self, rule: AlertRule)
Add alert rule
Sourcepub async fn get_active_alerts(&self) -> Vec<SecurityAlert>
pub async fn get_active_alerts(&self) -> Vec<SecurityAlert>
Get active alerts
Sourcepub async fn resolve_alert(&self, alert_id: &str) -> Result<(), MonitoringError>
pub async fn resolve_alert(&self, alert_id: &str) -> Result<(), MonitoringError>
Resolve alert
Sourcepub async fn start_background_tasks(&self) -> JoinHandle<()>
pub async fn start_background_tasks(&self) -> JoinHandle<()>
Start background monitoring tasks
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SecurityMonitor
impl !RefUnwindSafe for SecurityMonitor
impl Send for SecurityMonitor
impl Sync for SecurityMonitor
impl Unpin for SecurityMonitor
impl !UnwindSafe for SecurityMonitor
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
Mutably borrows from an owned value. Read more