tsa_auth_adapter/
lib.rs

1pub mod memory;
2
3pub use memory::*;
4
5#[cfg(feature = "seaorm")]
6pub mod seaorm;
7
8#[cfg(feature = "redis")]
9pub mod redis;
10
11#[cfg(feature = "mongodb")]
12pub mod mongodb;
13
14#[cfg(feature = "dynamodb")]
15pub mod dynamodb;
16
17#[cfg(feature = "firestore")]
18pub mod firestore;
19
20#[cfg(feature = "bigtable")]
21pub mod bigtable;
22
23#[macro_export]
24macro_rules! impl_adapter {
25    ($adapter_name:ty, $prefix:ident) => {
26        paste::paste! {
27            impl tsa_auth_core::Adapter for $adapter_name {
28                type UserRepo = [<$prefix UserRepository>];
29                type SessionRepo = [<$prefix SessionRepository>];
30                type AccountRepo = [<$prefix AccountRepository>];
31                type VerificationTokenRepo = [<$prefix VerificationTokenRepository>];
32                type TwoFactorRepo = [<$prefix TwoFactorRepository>];
33                type OrganizationRepo = [<$prefix OrganizationRepository>];
34                type OrganizationMemberRepo = [<$prefix OrganizationMemberRepository>];
35                type OrganizationInvitationRepo = [<$prefix OrganizationInvitationRepository>];
36                type ApiKeyRepo = [<$prefix ApiKeyRepository>];
37                type PasskeyRepo = [<$prefix PasskeyRepository>];
38                type PasskeyChallengeRepo = [<$prefix PasskeyChallengeRepository>];
39                type AuditLogRepo = [<$prefix AuditLogRepository>];
40                type AccountLockoutRepo = [<$prefix AccountLockoutRepository>];
41                type PasswordHistoryRepo = [<$prefix PasswordHistoryRepository>];
42                type IpRuleRepo = [<$prefix IpRuleRepository>];
43                type ImpersonationSessionRepo = [<$prefix ImpersonationSessionRepository>];
44
45                fn users(&self) -> &Self::UserRepo { &self.users }
46                fn sessions(&self) -> &Self::SessionRepo { &self.sessions }
47                fn accounts(&self) -> &Self::AccountRepo { &self.accounts }
48                fn verification_tokens(&self) -> &Self::VerificationTokenRepo { &self.verification_tokens }
49                fn two_factor(&self) -> &Self::TwoFactorRepo { &self.two_factor }
50                fn organizations(&self) -> &Self::OrganizationRepo { &self.organizations }
51                fn organization_members(&self) -> &Self::OrganizationMemberRepo { &self.organization_members }
52                fn organization_invitations(&self) -> &Self::OrganizationInvitationRepo { &self.organization_invitations }
53                fn api_keys(&self) -> &Self::ApiKeyRepo { &self.api_keys }
54                fn passkeys(&self) -> &Self::PasskeyRepo { &self.passkeys }
55                fn passkey_challenges(&self) -> &Self::PasskeyChallengeRepo { &self.passkey_challenges }
56                fn audit_logs(&self) -> &Self::AuditLogRepo { &self.audit_logs }
57                fn account_lockouts(&self) -> &Self::AccountLockoutRepo { &self.account_lockouts }
58                fn password_history(&self) -> &Self::PasswordHistoryRepo { &self.password_history }
59                fn ip_rules(&self) -> &Self::IpRuleRepo { &self.ip_rules }
60                fn impersonation_sessions(&self) -> &Self::ImpersonationSessionRepo { &self.impersonation_sessions }
61            }
62        }
63    };
64}