This commit is contained in:
2026-06-28 18:12:00 +02:00
parent 5152ec0f7e
commit 7a593fc204
27 changed files with 413 additions and 100 deletions
+6
View File
@@ -5,6 +5,7 @@ use axum::{
middleware::Next,
response::{IntoResponse, Response},
};
use axum_extra::extract::CookieJar;
use std::sync::Arc;
use std::time::Instant;
use tracing::{info, Instrument};
@@ -103,6 +104,11 @@ pub async fn auth_middleware(
None
}
})
.or_else(|| {
// Grâce à CookieJar, on extrait proprement le cookie "token" ou "jwt"
let jar = CookieJar::from_headers(req.headers());
jar.get("token").map(|cookie| cookie.value().to_string())
})
.or_else(|| {
req.uri().query().and_then(|q| {
form_urlencoded::parse(q.as_bytes())