Skip to content

Commit

Permalink
feat: allow to set a custom name for the csrf cookie (#801)
Browse files Browse the repository at this point in the history
  • Loading branch information
brussee committed Aug 8, 2024
1 parent 9db2be1 commit d984022
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions poem/src/middleware/csrf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ impl Csrf {
Default::default()
}

/// Sets the name of the csrf cookie. Default is `poem-csrf-token`.
#[must_use]
pub fn cookie_name(self, value: impl Into<String>) -> Self {
Self {
cookie_name: value.into(),
..self
}
}

/// Sets AES256 key to provide signed, encrypted CSRF tokens and cookies.
#[must_use]
pub fn key(self, key: [u8; 32]) -> Self {
Expand Down

0 comments on commit d984022

Please sign in to comment.