Skip to content

Commit

Permalink
Rename the authentication token
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Mar 25, 2024
1 parent 030b4cc commit 0b11396
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rust/agama-server/src/web/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl FromRequestParts<ServiceState> for TokenClaims {
.await
.map_err(|_| AuthError::MissingToken)?;
cookie
.get("token")
.get("agamaToken")
.ok_or(AuthError::MissingToken)?
.to_owned()
}
Expand Down
4 changes: 2 additions & 2 deletions rust/agama-server/src/web/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -74,7 +74,7 @@ pub async fn login(
))]
pub async fn logout(_claims: TokenClaims) -> Result<impl IntoResponse, AuthError> {
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"),
Expand Down

0 comments on commit 0b11396

Please sign in to comment.