pub enum MiddlewareSlot {
BeforeCors,
AfterAuth,
AfterSpa,
}Expand description
Where a user middleware runs relative to the framework’s built-in stages.
The default for HostBuilder::use_middleware is MiddlewareSlot::AfterAuth,
so a middleware that reads the authenticated principal (ctx.claims())
actually sees it: authentication runs before the slot. Use
MiddlewareSlot::BeforeCors only when the middleware must observe requests
that CORS would otherwise short-circuit (e.g. preflight accounting), and
MiddlewareSlot::AfterSpa for post-static-file hooks.
Variants§
BeforeCors
After RequestId, before CORS/preflight handling.
AfterAuth
After authentication, before the SPA static-file middleware (default).
AfterSpa
After the SPA middleware, immediately before the router.
Trait Implementations§
Source§impl Clone for MiddlewareSlot
impl Clone for MiddlewareSlot
impl Copy for MiddlewareSlot
Source§impl Debug for MiddlewareSlot
impl Debug for MiddlewareSlot
impl Eq for MiddlewareSlot
Source§impl PartialEq for MiddlewareSlot
impl PartialEq for MiddlewareSlot
impl StructuralPartialEq for MiddlewareSlot
Auto Trait Implementations§
impl Forget for MiddlewareSlot
impl Freeze for MiddlewareSlot
impl Move for MiddlewareSlot
impl RefUnwindSafe for MiddlewareSlot
impl Send for MiddlewareSlot
impl Sync for MiddlewareSlot
impl Unpin for MiddlewareSlot
impl UnsafeUnpin for MiddlewareSlot
impl UnwindSafe for MiddlewareSlot
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