Skip to content

Commit

Permalink
Merge pull request #27 from timsueberkrueb/samesite-cookies
Browse files Browse the repository at this point in the history
Set SameSite to Strict in auth cookies
  • Loading branch information
michaelvanstraten authored Nov 5, 2024
2 parents a92e6bc + 504bfa9 commit 89d579d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["derive", "./."]

[package]
name = "actix-jwt-auth-middleware"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
authors = ["Michael van Straten"]
repository = "https://github.com/michaelvanstraten/actix-jwt-auth-middleware"
Expand Down
2 changes: 2 additions & 0 deletions src/token_signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::marker::PhantomData;
use std::time::Duration;

use actix_web::cookie::Cookie;
use actix_web::cookie::SameSite;
use actix_web::http::header::HeaderValue;
use chrono::TimeDelta;
use derive_builder::Builder;
Expand Down Expand Up @@ -249,6 +250,7 @@ where
) -> AuthResult<Cookie<'static>> {
let token = self.create_signed_token(claims, token_lifetime)?;
Ok(Cookie::build(cookie_name.to_string(), token)
.same_site(SameSite::Strict)
.secure(true)
.finish())
}
Expand Down

0 comments on commit 89d579d

Please sign in to comment.