feat: add auth middleware chain with ctx resolver and cookie parsing

This commit is contained in:
2026-04-21 00:04:10 +03:00
parent 90c9b9d6ff
commit a120838cbc
10 changed files with 252 additions and 45 deletions

View File

@@ -6,7 +6,7 @@ use serde::Deserialize;
use serde_json::{Value, json};
use tower_cookies::{Cookie, Cookies};
use crate::error::LoftError;
use crate::{error::LoftError, web::AUTH_TOKEN};
pub fn routes_login() -> Router {
Router::new()
@@ -24,7 +24,7 @@ async fn login(
}
// FIXME: real auth-token generation-signature
cookies.add(Cookie::new("auth-token", "user-1.exp.sign"));
cookies.add(Cookie::new(AUTH_TOKEN, "user-1.exp.sign"));
let body = Json(json!({
"result": {