beep_auth/domain/ports.rs
1use crate::domain::models::{claims::Claims, errors::AuthError, identity::Identity};
2
3pub trait AuthRepository: Send + Sync {
4 fn validate_token(&self, token: &str)
5 -> impl Future<Output = Result<Claims, AuthError>> + Send;
6
7 fn identify(&self, token: &str) -> impl Future<Output = Result<Identity, AuthError>> + Send;
8}
9
10pub trait HasAuthRepository {
11 type AuthRepo: AuthRepository;
12
13 fn auth_repository(&self) -> &Self::AuthRepo;
14}