pub struct SecurityPolicy {
pub content_security_policy: String,
pub hsts: Option<Duration>,
pub hsts_include_subdomains: bool,
}Expand description
Configurable CSP, HSTS, and browser hardening headers.
Fields§
§content_security_policy: String§hsts: Option<Duration>§hsts_include_subdomains: boolImplementations§
Source§impl SecurityPolicy
impl SecurityPolicy
Sourcepub fn with_nonce(self) -> Result<NonceSecurityPolicy, CspPolicyError>
pub fn with_nonce(self) -> Result<NonceSecurityPolicy, CspPolicyError>
Enable per-request CSP nonces while retaining this policy’s directives and HSTS settings.
§Errors
Returns an error for duplicate/unsafe directives or a stale hard-coded nonce.
Trait Implementations§
Source§impl Clone for SecurityPolicy
impl Clone for SecurityPolicy
Source§fn clone(&self) -> SecurityPolicy
fn clone(&self) -> SecurityPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecurityPolicy
impl Debug for SecurityPolicy
Source§impl Default for SecurityPolicy
impl Default for SecurityPolicy
Source§fn default() -> SecurityPolicy
fn default() -> SecurityPolicy
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SecurityPolicy
impl RefUnwindSafe for SecurityPolicy
impl Send for SecurityPolicy
impl Sync for SecurityPolicy
impl Unpin for SecurityPolicy
impl UnsafeUnpin for SecurityPolicy
impl UnwindSafe for SecurityPolicy
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