pub struct SecurityMiddlewareBuilder { /* private fields */ }Expand description
Security middleware suite builder that helps configure and integrate all security middleware with the framework’s MiddlewarePipeline
Implementations§
Source§impl SecurityMiddlewareBuilder
impl SecurityMiddlewareBuilder
Sourcepub fn with_cors(self, config: CorsConfig) -> Self
pub fn with_cors(self, config: CorsConfig) -> Self
Add CORS middleware with configuration
Sourcepub fn with_cors_permissive(self) -> Self
pub fn with_cors_permissive(self) -> Self
Add CORS middleware with permissive settings (not recommended for production)
Sourcepub fn with_csrf(self, config: CsrfConfig) -> Self
pub fn with_csrf(self, config: CsrfConfig) -> Self
Add CSRF middleware with configuration
Sourcepub fn with_csrf_default(self) -> Self
pub fn with_csrf_default(self) -> Self
Add CSRF middleware with default configuration
Sourcepub fn build(self) -> MiddlewarePipeline
pub fn build(self) -> MiddlewarePipeline
Build the security middleware pipeline
The middleware are added in the following order for optimal security:
- CORS middleware (handles preflight requests early)
- CSRF middleware (validates tokens after CORS)
Trait Implementations§
Source§impl Debug for SecurityMiddlewareBuilder
impl Debug for SecurityMiddlewareBuilder
Source§impl Default for SecurityMiddlewareBuilder
impl Default for SecurityMiddlewareBuilder
Source§fn default() -> SecurityMiddlewareBuilder
fn default() -> SecurityMiddlewareBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SecurityMiddlewareBuilder
impl RefUnwindSafe for SecurityMiddlewareBuilder
impl Send for SecurityMiddlewareBuilder
impl Sync for SecurityMiddlewareBuilder
impl Unpin for SecurityMiddlewareBuilder
impl UnsafeUnpin for SecurityMiddlewareBuilder
impl UnwindSafe for SecurityMiddlewareBuilder
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more