1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//! Authentication module for Ferro framework
//!
//! Provides Laravel-like authentication with guards and middleware.
//!
//! # Overview
//!
//! Ferro provides a simple, session-based authentication system:
//!
//! - `Auth` facade for login/logout operations
//! - `AuthMiddleware` for protecting routes
//! - `GuestMiddleware` for guest-only routes
//! - `Authenticatable` trait for user models
//! - `UserProvider` trait for user retrieval
//!
//! # Example
//!
//! ```rust,ignore
//! use ferro_rs::{Auth, AuthMiddleware, GuestMiddleware};
//!
//! // In a controller
//! if Auth::check() {
//! let user_id = Auth::id().unwrap();
//! }
//!
//! // Get the currently authenticated user
//! if let Some(user) = Auth::user().await? {
//! println!("User ID: {}", user.auth_identifier());
//! }
//!
//! // Get as concrete User type
//! if let Some(user) = Auth::user_as::<User>().await? {
//! println!("Welcome, user #{}!", user.id);
//! }
//!
//! // Login
//! Auth::login(user.id);
//!
//! // Logout
//! Auth::logout();
//!
//! // In routes
//! group!("/dashboard")
//! .middleware(AuthMiddleware::redirect_to("/login"))
//! .routes([...]);
//!
//! group!("/")
//! .middleware(GuestMiddleware::redirect_to("/dashboard"))
//! .routes([
//! get!("/login", auth::show_login),
//! ]);
//! ```
pub use Authenticatable;
pub use ;
pub use Auth;
pub use ;
pub use UserProvider;