INNER CODE UNIT · Python

A2ABearerAuthMiddleware

evalstate/fast-agent · src/fast_agent/a2a/server.py:158

class A2ABearerAuthMiddleware:
    """Require bearer authentication for A2A action routes."""

    def __init__(self, app: ASGIApp, *, provider: str) -> None:
        self.app = app
        self.provider = provider
        self.token_verifier = HuggingFaceOAuthOrHubTokenVerifier()

    async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
        if scope["type"] != "http":
            await self.app(scope, receive, send)
            return

        path = str(scope.get("path", ""))
        if not path.startswith("/a2a/"):
            await self.app(scope, receive, send)
            return

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…