mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-13 15:35:13 +00:00
feat: Add authentication middleware to charging-engine with public and protected route separation
- Add auth module import to main.rs - Add AuthConfig initialization from environment in main function - Add auth_config field to AppState struct - Add auth_middleware layer to protected routes - Move health check, credit check, deduct, balance, and usage recording to public routes (no auth required for packet-gateway integration) - Move add credit, subscriber management, rating plans, monitoring, and engine
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
mod auth;
|
||||
mod charging;
|
||||
mod monitoring;
|
||||
mod errors;
|
||||
@@ -11,6 +12,7 @@ use tracing::info;
|
||||
|
||||
use routes::create_router;
|
||||
use charging::{ChargingEngine, RatingPlansRepo};
|
||||
use auth::AuthConfig;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
@@ -44,8 +46,10 @@ async fn main() -> Result<()> {
|
||||
info!("Connected to Redis successfully");
|
||||
|
||||
// Create application state
|
||||
let auth_config = AuthConfig::from_env();
|
||||
let state = crate::models::AppState {
|
||||
charging_engine,
|
||||
auth_config,
|
||||
};
|
||||
|
||||
// Create router
|
||||
|
||||
Reference in New Issue
Block a user