pub struct SecurityHeadersConfig { /* private fields */ }Expand description
Secure-by-default response header configuration.
Implementations§
Source§impl SecurityHeadersConfig
impl SecurityHeadersConfig
Sourcepub fn validate(&self) -> Result<(), AppError>
pub fn validate(&self) -> Result<(), AppError>
Validate the configuration.
§Errors
Returns an error when the configuration cannot be safely applied.
Sourcepub const fn with_transport_security(
self,
transport_security: TransportSecurity,
) -> SecurityHeadersConfig
pub const fn with_transport_security( self, transport_security: TransportSecurity, ) -> SecurityHeadersConfig
Select the transport security mode.
Sourcepub fn with_content_security_policy(
self,
value: Option<String>,
) -> SecurityHeadersConfig
pub fn with_content_security_policy( self, value: Option<String>, ) -> SecurityHeadersConfig
Override the Content Security Policy header. Pass None to disable it.
Sourcepub fn with_permissions_policy(
self,
value: Option<String>,
) -> SecurityHeadersConfig
pub fn with_permissions_policy( self, value: Option<String>, ) -> SecurityHeadersConfig
Override the Permissions Policy header. Pass None to disable it.
Sourcepub fn with_referrer_policy(
self,
value: Option<String>,
) -> SecurityHeadersConfig
pub fn with_referrer_policy( self, value: Option<String>, ) -> SecurityHeadersConfig
Override the Referrer Policy header. Pass None to disable it.
Sourcepub fn with_frame_options(self, value: Option<String>) -> SecurityHeadersConfig
pub fn with_frame_options(self, value: Option<String>) -> SecurityHeadersConfig
Override the X-Frame-Options header. Pass None to disable it.
Sourcepub fn with_content_type_options(
self,
value: Option<String>,
) -> SecurityHeadersConfig
pub fn with_content_type_options( self, value: Option<String>, ) -> SecurityHeadersConfig
Override the X-Content-Type-Options header. Pass None to disable it.
Sourcepub fn header_pairs(&self) -> Result<Vec<(HeaderName, HeaderValue)>, AppError>
pub fn header_pairs(&self) -> Result<Vec<(HeaderName, HeaderValue)>, AppError>
Build validated header pairs for transport adapters.
§Errors
Returns an error when a configured header value is invalid.
Trait Implementations§
Source§impl Clone for SecurityHeadersConfig
impl Clone for SecurityHeadersConfig
Source§fn clone(&self) -> SecurityHeadersConfig
fn clone(&self) -> SecurityHeadersConfig
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 SecurityHeadersConfig
impl Debug for SecurityHeadersConfig
Source§impl Default for SecurityHeadersConfig
impl Default for SecurityHeadersConfig
Source§fn default() -> SecurityHeadersConfig
fn default() -> SecurityHeadersConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SecurityHeadersConfig
impl RefUnwindSafe for SecurityHeadersConfig
impl Send for SecurityHeadersConfig
impl Sync for SecurityHeadersConfig
impl Unpin for SecurityHeadersConfig
impl UnsafeUnpin for SecurityHeadersConfig
impl UnwindSafe for SecurityHeadersConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request