feat: implement authentication module with JWT support and user management

This commit is contained in:
GW_MC
2025-12-15 15:51:45 +08:00
parent 1233f3b736
commit 3354154b87
13 changed files with 1232 additions and 5 deletions

View File

@@ -8,7 +8,13 @@ use std::sync::Arc;
use axum::{Extension, Router};
use migration::sea_orm::DatabaseConnection;
use crate::{middlewares, services::settings::SettingsStore};
use crate::{
middlewares,
services::{
auth::{authentication::AuthenticationService, user::UserService},
settings::SettingsStore,
},
};
#[derive(Clone)]
pub struct AppState {
@@ -25,6 +31,10 @@ pub type ServiceState<T> = Arc<T>;
pub struct AppService {
#[allow(dead_code)] // TODO: remove when used
pub settings: ServiceState<dyn SettingsStore>,
#[allow(dead_code)] // TODO: remove when used
pub authentication: ServiceState<dyn AuthenticationService>,
#[allow(dead_code)] // TODO: remove when used
pub user: ServiceState<dyn UserService>,
}
pub fn get_root_router(state: impl Into<Arc<AppState>>) -> Router {