use anyhow::Result; use std::collections::HashMap; /// Service trait for client authentication pub trait ClientAuthenticator: Send + Sync { fn authenticate( &self, params: &HashMap, auth_header: Option<&str>, ) -> Result<(String, String), String>; // Returns (client_id, client_secret) } /// Service trait for rate limiting pub trait RateLimiter: Send + Sync { fn check_rate_limit(&self, identifier: &str, endpoint: &str) -> Result<()>; } /// Service trait for audit logging pub trait AuditLogger: Send + Sync { fn log_event( &self, event_type: &str, client_id: Option<&str>, user_id: Option<&str>, ip_address: Option<&str>, success: bool, details: Option<&str>, ) -> Result<()>; } /// Service trait for token generation pub trait TokenGenerator: Send + Sync { fn generate_access_token( &self, user_id: &str, client_id: &str, scope: &Option, token_id: &str, ) -> Result; fn generate_refresh_token( &self, client_id: &str, user_id: &str, scope: &Option, ) -> Result; } pub mod implementations;