Skip to main content

SecurityService

Trait SecurityService 

Source
pub trait SecurityService: Send + Sync {
    // Required methods
    fn check_rate_limit<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        email: &'life1 str,
        ip_address: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn log_failed_auth_attempt<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 Uuid,
        ip_address: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn log_successful_auth<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 Uuid,
        ip_address: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn analyze_login_attempt<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        user_id: &'life1 Uuid,
        device_info: &'life2 Option<DeviceInfo>,
        ip_address: Option<&'life3 str>,
    ) -> Pin<Box<dyn Future<Output = Result<SecurityFlags>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn generate_password_reset_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        user_id: &'life1 Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn validate_password_reset_token<'life0, 'life1, 'async_trait>(
        &'life0 self,
        token: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Uuid>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn send_security_alert<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        user_id: &'life1 Uuid,
        alert_type: SecurityAlertType,
        details: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Security service trait for authentication security features

Required Methods§

Source

fn check_rate_limit<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, email: &'life1 str, ip_address: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Check rate limiting for authentication attempts

Source

fn log_failed_auth_attempt<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 Uuid, ip_address: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Log failed authentication attempt for security monitoring

Source

fn log_successful_auth<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 Uuid, ip_address: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Log successful authentication for audit trail

Source

fn analyze_login_attempt<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, user_id: &'life1 Uuid, device_info: &'life2 Option<DeviceInfo>, ip_address: Option<&'life3 str>, ) -> Pin<Box<dyn Future<Output = Result<SecurityFlags>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Analyze login attempt for security threats

Source

fn generate_password_reset_token<'life0, 'life1, 'async_trait>( &'life0 self, user_id: &'life1 Uuid, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate password reset token

Source

fn validate_password_reset_token<'life0, 'life1, 'async_trait>( &'life0 self, token: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate password reset token

Source

fn send_security_alert<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, user_id: &'life1 Uuid, alert_type: SecurityAlertType, details: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send security alert (new device, suspicious activity, etc.)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§