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
/// Authentication identity trait - replacement for the deprecated [`User`](crate::User) trait.
///
/// Provides identity and authentication status methods. Use with
/// [`BaseUser`](crate::BaseUser)/[`FullUser`](crate::FullUser) +
/// [`PermissionsMixin`](crate::PermissionsMixin) for full user functionality.
///
/// # Examples
///
/// ```
/// use reinhardt_auth::AuthIdentity;
///
/// struct MyUser {
/// id: i64,
/// is_superuser: bool,
/// }
///
/// impl AuthIdentity for MyUser {
/// fn id(&self) -> String { self.id.to_string() }
/// fn is_authenticated(&self) -> bool { true }
/// fn is_admin(&self) -> bool { self.is_superuser }
/// }
///
/// let user = MyUser { id: 1, is_superuser: false };
/// assert!(user.is_authenticated());
/// assert!(!user.is_admin());
/// assert_eq!(user.id(), "1");
/// ```