Skip to main content

with_token_scope

Function with_token_scope 

Source
pub async fn with_token_scope<F: Future>(token: SecretString, f: F) -> F::Output
Expand description

Run a future with CURRENT_TOKEN set so that current_token() returns the given value inside the future. Useful when MCP tool handlers need the raw bearer token but run in a spawned task where the RBAC middleware’s task-local scope is no longer active.