File tree Expand file tree Collapse file tree 3 files changed +7
-4
lines changed
Expand file tree Collapse file tree 3 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 66class User (ABC ):
77 """A representation of an authenticated user."""
88
9- @abstractmethod
109 @property
10+ @abstractmethod
1111 def is_authenticated (self ) -> bool :
1212 """Returns whether the current user is authenticated."""
1313
14- @abstractmethod
1514 @property
15+ @abstractmethod
1616 def user_name (self ) -> str :
1717 """Returns the user name of the current user."""
1818
Original file line number Diff line number Diff line change 1515from starlette .responses import JSONResponse , Response
1616from starlette .routing import Route
1717
18+ from a2a .auth .user import UnauthenticatedUser
1819from a2a .auth .user import User as A2AUser
1920from a2a .server .context import ServerCallContext
2021from a2a .server .request_handlers .jsonrpc_handler import JSONRPCHandler
@@ -60,7 +61,7 @@ class DefaultCallContextBuilder(CallContextBuilder):
6061 """A default implementation of CallContextBuilder."""
6162
6263 def build (self , request : Request ) -> ServerCallContext :
63- user = None
64+ user = UnauthenticatedUser ()
6465 state = {}
6566 with contextlib .suppress (Exception ):
6667 user = request .user
Original file line number Diff line number Diff line change 33import collections .abc
44import typing
55
6- from pydantic import BaseModel , Field
6+ from pydantic import BaseModel , ConfigDict , Field
77
88from a2a .auth .user import UnauthenticatedUser , User
99
@@ -17,5 +17,7 @@ class ServerCallContext(BaseModel):
1717 This class allows storing arbitrary user data in the state attribute.
1818 """
1919
20+ model_config = ConfigDict (arbitrary_types_allowed = True )
21+
2022 state : State = Field (default = {})
2123 user : User = Field (default = UnauthenticatedUser ())
You can’t perform that action at this time.
0 commit comments