From 0b11396c4f6948ca4e10d6f5bdd0ff033067dc22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Mon, 25 Mar 2024 15:00:09 +0000 Subject: [PATCH] Rename the authentication token --- rust/agama-server/src/web/auth.rs | 2 +- rust/agama-server/src/web/http.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rust/agama-server/src/web/auth.rs b/rust/agama-server/src/web/auth.rs index cdb3eba495..5394cc5fbc 100644 --- a/rust/agama-server/src/web/auth.rs +++ b/rust/agama-server/src/web/auth.rs @@ -78,7 +78,7 @@ impl FromRequestParts for TokenClaims { .await .map_err(|_| AuthError::MissingToken)?; cookie - .get("token") + .get("agamaToken") .ok_or(AuthError::MissingToken)? .to_owned() } diff --git a/rust/agama-server/src/web/http.rs b/rust/agama-server/src/web/http.rs index bbb71966c9..dce25e517e 100644 --- a/rust/agama-server/src/web/http.rs +++ b/rust/agama-server/src/web/http.rs @@ -60,7 +60,7 @@ pub async fn login( }); let mut headers = HeaderMap::new(); - let cookie = format!("token={}; HttpOnly", &token); + let cookie = format!("agamaToken={}; HttpOnly", &token); headers.insert( SET_COOKIE, cookie.parse().expect("could not build a valid cookie"), @@ -74,7 +74,7 @@ pub async fn login( ))] pub async fn logout(_claims: TokenClaims) -> Result { let mut headers = HeaderMap::new(); - let cookie = "token=deleted; HttpOnly; Expires=Thu, 01 Jan 1970 00:00:00 GMT".to_string(); + let cookie = "agamaToken=deleted; HttpOnly; Expires=Thu, 01 Jan 1970 00:00:00 GMT".to_string(); headers.insert( SET_COOKIE, cookie.parse().expect("could not build a valid cookie"),