pub struct ServerCommunicationConfigMiddleware {
provider: Arc<dyn CookieProvider>,
in_flight: Arc<Mutex<HashMap<String, Arc<Notify>>>>,
}Expand description
Middleware that injects SSO load balancer cookies and re-acquires them on 302/307.
Must be outermost in the middleware chain so it observes raw 3xx responses before auth middleware. Auto-redirect must be disabled on the underlying reqwest::Client.
On WASM targets, uses a proactive strategy: checks needs_bootstrap() before
each request, acquires cookies if needed, injects them, then sends. This is
required because reqwest::redirect::Policy is unavailable on WASM and the
browser auto-follows redirects, making reactive 302/307 detection impossible.
§Security
Cookie values are NEVER logged.
Fields§
§provider: Arc<dyn CookieProvider>§in_flight: Arc<Mutex<HashMap<String, Arc<Notify>>>>Tracks in-flight cookie acquisitions per hostname to prevent duplicate concurrent SSO acquisition flows. When a task is acquiring for a hostname, other tasks wait on the Notify rather than starting a redundant acquisition.
Not used on WASM targets (single-threaded, proactive strategy).
Implementations§
Source§impl ServerCommunicationConfigMiddleware
impl ServerCommunicationConfigMiddleware
Sourcepub fn new(provider: Arc<dyn CookieProvider>) -> Self
pub fn new(provider: Arc<dyn CookieProvider>) -> Self
Creates a new middleware instance wrapping the given cookie provider.
Trait Implementations§
Source§impl Middleware for ServerCommunicationConfigMiddleware
impl Middleware for ServerCommunicationConfigMiddleware
Source§fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: Request,
extensions: &'life1 mut Extensions,
next: Next<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: Request,
extensions: &'life1 mut Extensions,
next: Next<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
next.run(req, extensions). Read moreAuto Trait Implementations§
impl Freeze for ServerCommunicationConfigMiddleware
impl !RefUnwindSafe for ServerCommunicationConfigMiddleware
impl Send for ServerCommunicationConfigMiddleware
impl Sync for ServerCommunicationConfigMiddleware
impl Unpin for ServerCommunicationConfigMiddleware
impl UnsafeUnpin for ServerCommunicationConfigMiddleware
impl !UnwindSafe for ServerCommunicationConfigMiddleware
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more