refactor: centralize auth system across all modules
All modules now use the main IAM JWT (ACCESS_TOKEN_SECRET) for authentication, removing three separate auth systems (hackathon Supabase, hackathon JWT, QR JWT). Changes: - hackathon: replace HackathonJwtService with decode_access_token() from imphnen-libs - remove entire src/auth/ (Supabase signup/login/GitHub/forgot-reset) - remove common/hackathon_jwt.rs, common/supabase_client.rs - remove Supabase from HackathonConfig (JWT, GitHub OAuth, Supabase anon/service keys) - replace Supabase Storage with MinioService from imphnen-libs - all route jwt params removed; hackathon_router takes MinioService instead - qr: replace QrJwtService with decode_access_token() from imphnen-libs - remove entire src/auth/ (register/login/Google OAuth/refresh) - remove common/qr_jwt.rs, src/config.rs - qr_auth_middleware now lazy-upserts users into QR DB on first access - qr_router(pool) — no config needed - gateway: create MinioService once and pass to hackathon_router; qr_router simplified Users now register/login via /v1/auth/* and use the same JWT for all endpoints. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
4bba182ea3
commit
2ae43b3bcc
@@ -17,7 +17,8 @@ use imphnen_dimentorin::{
|
||||
};
|
||||
use imphnen_gacha::gacha_router;
|
||||
use imphnen_hackathon::{hackathon_router, HackathonConfig};
|
||||
use imphnen_qr::{qr_router, QrConfig};
|
||||
use imphnen_qr::qr_router;
|
||||
use imphnen_libs::{MinioConfig, create_minio_service_from_config};
|
||||
use imphnen_iam::{
|
||||
auth_public_routes,
|
||||
permissions_protected_routes,
|
||||
@@ -46,7 +47,11 @@ pub async fn gateway_service(
|
||||
let db = state.postgres_connection.conn.clone();
|
||||
let state_arc = Arc::new(state.clone());
|
||||
let hackathon_config = Arc::new(HackathonConfig::from_env());
|
||||
let qr_config = Arc::new(QrConfig::from_env());
|
||||
let minio = Arc::new(
|
||||
create_minio_service_from_config(MinioConfig::from_env().expect("MinIO config required"))
|
||||
.await
|
||||
.expect("Failed to create MinIO service"),
|
||||
);
|
||||
let qr_pool = Arc::new(
|
||||
sqlx::PgPool::connect(
|
||||
&std::env::var("QR_DATABASE_URL").expect("QR_DATABASE_URL must be set"),
|
||||
@@ -76,8 +81,8 @@ pub async fn gateway_service(
|
||||
Router::new()
|
||||
.route("/", get(Redirect::to("/docs")))
|
||||
.nest("/v1", public_routes.merge(protected_routes))
|
||||
.nest("/v1/hackathon", hackathon_router(db.clone(), hackathon_config))
|
||||
.nest("/v1/qr", qr_router(qr_pool, qr_config))
|
||||
.nest("/v1/hackathon", hackathon_router(db.clone(), hackathon_config, minio))
|
||||
.nest("/v1/qr", qr_router(qr_pool))
|
||||
.merge(SwaggerUi::new("/docs").url("/openapi.json", docs_router()))
|
||||
.layer(cors_middleware())
|
||||
.layer(from_fn(security_headers_middleware))
|
||||
|
||||
Reference in New Issue
Block a user