Skip to content

Commit

Permalink
make cookie expire when session ends
Browse files Browse the repository at this point in the history
  • Loading branch information
aumetra committed Dec 15, 2023
1 parent 3120eee commit 92a3107
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/csurf/src/future.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{CsrfHandle, CSRF_COOKIE_NAME};
use cookie::{Cookie, SameSite};
use cookie::{Cookie, Expiration, SameSite};
use http::{header, HeaderValue, Response};
use pin_project_lite::pin_project;
use std::{
Expand Down Expand Up @@ -27,6 +27,7 @@ where

let mut response = ready!(this.inner.poll(cx))?;
let mut cookie = Cookie::build(CSRF_COOKIE_NAME)
.expires(Expiration::Session)
.permanent()
.same_site(SameSite::Strict)
.secure(true)
Expand Down

0 comments on commit 92a3107

Please sign in to comment.