Function auth_middleware
Source pub async fn auth_middleware(
__arg0: State<AuthState>,
req: Request<Body>,
next: Next,
) -> Result<Response, StatusCode>
Expand description
Axum middleware that authenticates every request.
On success, injects AgentRole into request extensions (for role mapping mode).
On failure, returns 401 Unauthorized.
ยงErrors
Returns StatusCode::UNAUTHORIZED if authentication is required and the
request does not provide valid credentials.