pub struct CookieMiddleware { /* private fields */ }Expand description
cookiebox’s cookie middleware
CookieMiddleware generates storage data from the cookie header and transform cookies via the Processor.
use actix_web::{web, App, HttpServer, HttpResponse};
use cookiebox::{Processor, ProcessorConfig, CookieMiddleware};
#[actix_web::main]
async fn main() -> std::io::Result<()> {
// Start by creating a `Processor` from the `ProcessorConfig`
// This decides which cookie needs to decrypted or verified.
let processor: Processor = ProcessorConfig::default().into();
HttpServer::new(move ||
App::new()
// Add cookie middleware
.wrap(CookieMiddleware::new(processor.clone()))
.default_service(web::to(|| HttpResponse::Ok())))
.bind(("127.0.0.1", 8080))?
.run()
.await
}Implementations§
Trait Implementations§
Source§impl<S, B> Transform<S, ServiceRequest> for CookieMiddlewarewhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
B: 'static,
impl<S, B> Transform<S, ServiceRequest> for CookieMiddlewarewhere
S: Service<ServiceRequest, Response = ServiceResponse<B>, Error = Error> + 'static,
B: 'static,
Source§type Response = ServiceResponse<B>
type Response = ServiceResponse<B>
Responses produced by the service.
Source§type Future = Ready<Result<<CookieMiddleware as Transform<S, ServiceRequest>>::Transform, <CookieMiddleware as Transform<S, ServiceRequest>>::InitError>>
type Future = Ready<Result<<CookieMiddleware as Transform<S, ServiceRequest>>::Transform, <CookieMiddleware 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 CookieMiddleware
impl RefUnwindSafe for CookieMiddleware
impl !Send for CookieMiddleware
impl !Sync for CookieMiddleware
impl Unpin for CookieMiddleware
impl UnwindSafe for CookieMiddleware
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