pub struct SecurityHeadersPolicy {
pub no_sniff: bool,
pub frame_options: Option<FrameOptions>,
pub referrer_policy: Option<ReferrerPolicy>,
pub content_security_policy: Option<String>,
pub hsts: Option<HstsPolicy>,
}Expand description
Security response-header policy translated by framework adapters.
Fields§
§no_sniff: boolEmit X-Content-Type-Options: nosniff.
frame_options: Option<FrameOptions>Frame embedding restriction.
referrer_policy: Option<ReferrerPolicy>Browser referrer policy.
content_security_policy: Option<String>Optional application-defined Content Security Policy.
hsts: Option<HstsPolicy>Optional HTTPS-only HSTS policy.
Implementations§
Source§impl SecurityHeadersPolicy
impl SecurityHeadersPolicy
Sourcepub const fn secure_defaults() -> Self
pub const fn secure_defaults() -> Self
Returns conservative defaults that are safe for most API responses.
Sourcepub fn content_security_policy(
self,
policy: impl Into<String>,
) -> SoapResult<Self>
pub fn content_security_policy( self, policy: impl Into<String>, ) -> SoapResult<Self>
Sets an application-specific Content Security Policy without controls.
Sourcepub const fn hsts(self, policy: HstsPolicy) -> Self
pub const fn hsts(self, policy: HstsPolicy) -> Self
Enables HSTS. Applications should do this only when HTTPS is guaranteed.
Sourcepub fn validate(&self) -> SoapResult<()>
pub fn validate(&self) -> SoapResult<()>
Validates header values after direct public-field mutation.
Trait Implementations§
Source§impl Clone for SecurityHeadersPolicy
impl Clone for SecurityHeadersPolicy
Source§fn clone(&self) -> SecurityHeadersPolicy
fn clone(&self) -> SecurityHeadersPolicy
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 SecurityHeadersPolicy
impl Debug for SecurityHeadersPolicy
Source§impl Default for SecurityHeadersPolicy
impl Default for SecurityHeadersPolicy
impl Eq for SecurityHeadersPolicy
Source§impl PartialEq for SecurityHeadersPolicy
impl PartialEq for SecurityHeadersPolicy
impl StructuralPartialEq for SecurityHeadersPolicy
Auto Trait Implementations§
impl Freeze for SecurityHeadersPolicy
impl RefUnwindSafe for SecurityHeadersPolicy
impl Send for SecurityHeadersPolicy
impl Sync for SecurityHeadersPolicy
impl Unpin for SecurityHeadersPolicy
impl UnsafeUnpin for SecurityHeadersPolicy
impl UnwindSafe for SecurityHeadersPolicy
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