Skip to main content

axum_gate/authn/
logout.rs

1/// Application service for handling user logout
2pub struct LogoutService {
3    // Logout is stateless, no fields needed
4}
5
6impl LogoutService {
7    /// Create a new logout service
8    pub fn new() -> Self {
9        Self {}
10    }
11
12    /// Handle logout operation
13    ///
14    /// In a cookie-based authentication system, logout is handled
15    /// by removing the authentication cookie. This method exists
16    /// for consistency with the application service pattern and
17    /// potential future extensions (e.g., token blacklisting,
18    /// logging, cleanup operations).
19    pub fn logout(&self) {
20        // Currently no additional business logic needed for logout
21        // The actual cookie removal is handled by the infrastructure layer
22    }
23}
24
25impl Default for LogoutService {
26    fn default() -> Self {
27        Self::new()
28    }
29}