wae_authentication/csrf/
config.rs1#[derive(Debug, Clone)]
5pub struct CsrfConfig {
6 pub token_ttl: u64,
8 pub token_length: usize,
10}
11
12impl Default for CsrfConfig {
13 fn default() -> Self {
14 Self { token_ttl: 3600, token_length: 32 }
15 }
16}
17
18impl CsrfConfig {
19 pub fn new(token_ttl: u64, token_length: usize) -> Self {
25 Self { token_ttl, token_length: token_length.clamp(16, 64) }
26 }
27
28 pub fn with_token_ttl(mut self, ttl: u64) -> Self {
33 self.token_ttl = ttl;
34 self
35 }
36
37 pub fn with_token_length(mut self, length: usize) -> Self {
42 self.token_length = length.clamp(16, 64);
43 self
44 }
45}