pub struct CsrfConfigBuilder { /* private fields */ }
Expand description
A utility to help build a CsrfConfig
in an API backwards compatible way.
Implementations§
Source§impl CsrfConfigBuilder
impl CsrfConfigBuilder
Sourcepub fn ttl_seconds(self, ttl_seconds: i64) -> Self
pub fn ttl_seconds(self, ttl_seconds: i64) -> Self
Set the TTL in seconds for CSRF cookies and tokens.
Default: 3600
Sourcepub fn protected_methods(self, protected_methods: HashSet<Method>) -> Self
pub fn protected_methods(self, protected_methods: HashSet<Method>) -> Self
Set the HTTP methods that are require CSRF protection.
Default: POST
, PUT
, PATCH
, DELETE
Set the Secure
flag on the CSRF cookie. If this is set to true, then user agents will
only send the cookie over HTTPS.
Default: false/absent.
Sourcepub fn finish(self) -> Result<CsrfConfig, CsrfConfigError>
pub fn finish(self) -> Result<CsrfConfig, CsrfConfigError>
Validate and build the CsrfConfig
.
Auto Trait Implementations§
impl Freeze for CsrfConfigBuilder
impl RefUnwindSafe for CsrfConfigBuilder
impl Send for CsrfConfigBuilder
impl Sync for CsrfConfigBuilder
impl Unpin for CsrfConfigBuilder
impl UnwindSafe for CsrfConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> PersistentInto<Arc<Mutex<T>>> for T
impl<T> PersistentInto<Arc<Mutex<T>>> for T
Source§fn persistent_into(self) -> Arc<Mutex<T>>
fn persistent_into(self) -> Arc<Mutex<T>>
Convert
self
into a value of type T
.Source§impl<T> PersistentInto<Arc<RwLock<T>>> for T
impl<T> PersistentInto<Arc<RwLock<T>>> for T
Source§fn persistent_into(self) -> Arc<RwLock<T>>
fn persistent_into(self) -> Arc<RwLock<T>>
Convert
self
into a value of type T
.Source§impl<T> PersistentInto<Arc<T>> for T
impl<T> PersistentInto<Arc<T>> for T
Source§fn persistent_into(self) -> Arc<T>
fn persistent_into(self) -> Arc<T>
Convert
self
into a value of type T
.Source§impl<T> PersistentInto<T> for T
impl<T> PersistentInto<T> for T
Source§fn persistent_into(self) -> T
fn persistent_into(self) -> T
Convert
self
into a value of type T
.