pub struct SessionMiddleware { /* private fields */ }
Expand description
Session-aware MCP authentication middleware
Implementations§
Source§impl SessionMiddleware
impl SessionMiddleware
Sourcepub fn new(
auth_manager: Arc<AuthenticationManager>,
session_manager: Arc<SessionManager>,
security_validator: Arc<RequestSecurityValidator>,
config: SessionMiddlewareConfig,
) -> Self
pub fn new( auth_manager: Arc<AuthenticationManager>, session_manager: Arc<SessionManager>, security_validator: Arc<RequestSecurityValidator>, config: SessionMiddlewareConfig, ) -> Self
Create new session middleware
Sourcepub fn with_default_config(
auth_manager: Arc<AuthenticationManager>,
session_manager: Arc<SessionManager>,
) -> Self
pub fn with_default_config( auth_manager: Arc<AuthenticationManager>, session_manager: Arc<SessionManager>, ) -> Self
Create with default configuration
Sourcepub async fn process_request(
&self,
request: Request,
headers: Option<&HashMap<String, String>>,
) -> Result<(Request, SessionRequestContext), McpError>
pub async fn process_request( &self, request: Request, headers: Option<&HashMap<String, String>>, ) -> Result<(Request, SessionRequestContext), McpError>
Process an incoming MCP request with session awareness
Sourcepub async fn process_response(
&self,
response: Response,
context: &SessionRequestContext,
) -> Result<(Response, HashMap<String, String>), McpError>
pub async fn process_response( &self, response: Response, context: &SessionRequestContext, ) -> Result<(Response, HashMap<String, String>), McpError>
Process response (add session headers if needed)
Sourcepub fn session_manager(&self) -> &SessionManager
pub fn session_manager(&self) -> &SessionManager
Get session manager for external access
Sourcepub fn auth_manager(&self) -> &AuthenticationManager
pub fn auth_manager(&self) -> &AuthenticationManager
Get authentication manager
Auto Trait Implementations§
impl Freeze for SessionMiddleware
impl !RefUnwindSafe for SessionMiddleware
impl Send for SessionMiddleware
impl Sync for SessionMiddleware
impl Unpin for SessionMiddleware
impl !UnwindSafe for SessionMiddleware
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