pub struct Middleware(/* private fields */);Expand description
ModSecurity middleware service
Middleware must be registered with App::wrap() method.
§Examples
use actix_web::App;
use actix_modsecurity::{Middleware, ModSecurity};
let mut security = ModSecurity::new();
security.add_rules(r#"
SecRuleEngine On
SecRule REQUEST_URI "@rx admin" "id:1,phase:1,deny,status:401"
"#).expect("Failed to add rules");
let app = App::new().wrap(Middleware::new(security));Implementations§
Source§impl Middleware
impl Middleware
Sourcepub fn new(modsecurity: ModSecurity) -> Self
pub fn new(modsecurity: ModSecurity) -> Self
Creates a new ModSecurity middleware instance
Trait Implementations§
Source§impl Into<Middleware> for ModSecurity
impl Into<Middleware> for ModSecurity
Source§fn into(self) -> Middleware
fn into(self) -> Middleware
Converts this type into the (usually inferred) input type.
Source§impl<S> Transform<S, ServiceRequest> for Middlewarewhere
S: Service<ServiceRequest, Response = ServiceResponse<BoxBody>, Error = Error> + 'static,
S::Future: 'static,
impl<S> Transform<S, ServiceRequest> for Middlewarewhere
S: Service<ServiceRequest, Response = ServiceResponse<BoxBody>, Error = Error> + 'static,
S::Future: 'static,
Source§type Response = ServiceResponse
type Response = ServiceResponse
Responses produced by the service.
Source§type Transform = ModSecurityService<S>
type Transform = ModSecurityService<S>
The
TransformService value created by this factorySource§type Future = Ready<Result<<Middleware as Transform<S, ServiceRequest>>::Transform, <Middleware as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<Middleware as Transform<S, ServiceRequest>>::Transform, <Middleware as Transform<S, ServiceRequest>>::InitError>>
The future response value.
Source§fn new_transform(&self, service: S) -> Self::Future
fn new_transform(&self, service: S) -> Self::Future
Creates and returns a new Transform component, asynchronously
Auto Trait Implementations§
impl Freeze for Middleware
impl RefUnwindSafe for Middleware
impl !Send for Middleware
impl !Sync for Middleware
impl Unpin for Middleware
impl UnwindSafe for Middleware
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