@@ -55,11 +55,11 @@ def __init__(
5555 only if auth_handlers is empty or None.
5656
5757 :param storage: The storage system to use for state management.
58- :type storage: Storage
58+ :type storage: :class:`microsoft_agents.hosting.core.storage. Storage`
5959 :param connection_manager: The connection manager for OAuth providers.
60- :type connection_manager: Connections
60+ :type connection_manager: :class:`microsoft_agents.hosting.core.authorization. Connections`
6161 :param auth_handlers: Configuration for OAuth providers.
62- :type auth_handlers: dict[str, AuthHandler], Optional
62+ :type auth_handlers: dict[str, :class:`microsoft_agents.hosting.core.app.oauth.auth_handler. AuthHandler` ], Optional
6363 :raises ValueError: When storage is None or no auth handlers provided.
6464 """
6565 if not storage :
@@ -105,7 +105,7 @@ def _init_handlers(self) -> None:
105105 it initializes an instance of each variant that is referenced.
106106
107107 :param auth_handlers: A dictionary of auth handler configurations.
108- :type auth_handlers: dict[str, AuthHandler]
108+ :type auth_handlers: dict[str, :class:`microsoft_agents.hosting.core.app.oauth.auth_handler. AuthHandler` ]
109109 """
110110 for name , auth_handler in self ._handler_settings .items ():
111111 auth_type = auth_handler .auth_type
@@ -126,26 +126,42 @@ def _sign_in_state_key(context: TurnContext) -> str:
126126 can be used to inspect or manipulate the state directly if needed.
127127
128128 :param context: The turn context for the current turn of conversation.
129- :type context: TurnContext
129+ :type context: :class:`microsoft_agents.hosting.core.turn_context. TurnContext`
130130 :return: A unique (across other values of channel_id and user_id) key for the sign-in state.
131131 :rtype: str
132132 """
133133 return f"auth:_SignInState:{ context .activity .channel_id } :{ context .activity .from_property .id } "
134134
135135 async def _load_sign_in_state (self , context : TurnContext ) -> Optional [_SignInState ]:
136- """Load the sign-in state from storage for the given context."""
136+ """Load the sign-in state from storage for the given context.
137+
138+ :param context: The turn context for the current turn of conversation.
139+ :type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
140+ :return: The sign-in state if found, None otherwise.
141+ :rtype: Optional[:class:`microsoft_agents.hosting.core.app.oauth._sign_in_state._SignInState`]
142+ """
137143 key = self ._sign_in_state_key (context )
138144 return (await self ._storage .read ([key ], target_cls = _SignInState )).get (key )
139145
140146 async def _save_sign_in_state (
141147 self , context : TurnContext , state : _SignInState
142148 ) -> None :
143- """Save the sign-in state to storage for the given context."""
149+ """Save the sign-in state to storage for the given context.
150+
151+ :param context: The turn context for the current turn of conversation.
152+ :type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
153+ :param state: The sign-in state to save.
154+ :type state: :class:`microsoft_agents.hosting.core.app.oauth._sign_in_state._SignInState`
155+ """
144156 key = self ._sign_in_state_key (context )
145157 await self ._storage .write ({key : state })
146158
147159 async def _delete_sign_in_state (self , context : TurnContext ) -> None :
148- """Delete the sign-in state from storage for the given context."""
160+ """Delete the sign-in state from storage for the given context.
161+
162+ :param context: The turn context for the current turn of conversation.
163+ :type context: :class:`microsoft_agents.hosting.core.turn_context.TurnContext`
164+ """
149165 key = self ._sign_in_state_key (context )
150166 await self ._storage .delete ([key ])
151167
@@ -179,7 +195,7 @@ def _resolve_handler(self, handler_id: str) -> _AuthorizationHandler:
179195 :param handler_id: The ID of the auth handler to resolve.
180196 :type handler_id: str
181197 :return: The corresponding AuthorizationHandler instance.
182- :rtype: AuthorizationHandler
198+ :rtype: :class:`microsoft_agents.hosting.core.app.oauth._handlers._AuthorizationHandler`
183199 :raises ValueError: If the handler ID is not recognized or not configured.
184200 """
185201 if handler_id not in self ._handlers :
@@ -200,13 +216,13 @@ async def _start_or_continue_sign_in(
200216 Storage is updated as needed with _SignInState data for caching purposes.
201217
202218 :param context: The turn context for the current turn of conversation.
203- :type context: TurnContext
219+ :type context: :class:`microsoft_agents.hosting.core.turn_context. TurnContext`
204220 :param state: The turn state for the current turn of conversation.
205- :type state: TurnState
221+ :type state: :class:`microsoft_agents.hosting.core.app.state.turn_state. TurnState`
206222 :param auth_handler_id: The ID of the auth handler to use for sign-in. If None, the first handler will be used.
207223 :type auth_handler_id: str
208224 :return: A _SignInResponse indicating the result of the sign-in attempt.
209- :rtype: _SignInResponse
225+ :rtype: :class:`microsoft_agents.hosting.core.app.oauth._sign_in_response. _SignInResponse`
210226 """
211227
212228 auth_handler_id = auth_handler_id or self ._default_handler_id
@@ -250,7 +266,7 @@ async def sign_out(
250266 """Attempts to sign out the user from a specified auth handler or the default handler.
251267
252268 :param context: The turn context for the current turn of conversation.
253- :type context: TurnContext
269+ :type context: :class:`microsoft_agents.hosting.core.turn_context. TurnContext`
254270 :param auth_handler_id: The ID of the auth handler to sign out from. If None, sign out from all handlers.
255271 :type auth_handler_id: Optional[str]
256272 :return: None
@@ -272,11 +288,11 @@ async def _on_turn_auth_intercept(
272288 from the cached _SignInState.
273289
274290 :param context: The context object for the current turn.
275- :type context: TurnContext
291+ :type context: :class:`microsoft_agents.hosting.core.turn_context. TurnContext`
276292 :param state: The turn state for the current turn.
277- :type state: TurnState
293+ :type state: :class:`microsoft_agents.hosting.core.app.state.turn_state. TurnState`
278294 :return: A tuple indicating whether the turn should be skipped and the continuation activity if applicable.
279- :rtype: tuple[bool, Optional[Activity]]
295+ :rtype: tuple[bool, Optional[:class:`microsoft_agents.activity. Activity` ]]
280296 """
281297 sign_in_state = await self ._load_sign_in_state (context )
282298
@@ -306,11 +322,11 @@ async def get_token(
306322 The token is taken from cache, so this does not initiate nor continue a sign-in flow.
307323
308324 :param context: The context object for the current turn.
309- :type context: TurnContext
325+ :type context: :class:`microsoft_agents.hosting.core.turn_context. TurnContext`
310326 :param auth_handler_id: The ID of the auth handler to get the token for.
311327 :type auth_handler_id: str
312328 :return: The token response from the OAuth provider.
313- :rtype: TokenResponse
329+ :rtype: :class:`microsoft_agents.activity. TokenResponse`
314330 """
315331 return await self .exchange_token (context , auth_handler_id = auth_handler_id )
316332
@@ -324,7 +340,7 @@ async def exchange_token(
324340 """Exchanges or refreshes the token for a specific auth handler or the default handler.
325341
326342 :param context: The context object for the current turn.
327- :type context: TurnContext
343+ :type context: :class:`microsoft_agents.hosting.core.turn_context. TurnContext`
328344 :param scopes: The scopes to request during the token exchange or refresh. Defaults
329345 to the list given in the AuthHandler configuration if None.
330346 :type scopes: Optional[list[str]]
@@ -335,7 +351,7 @@ async def exchange_token(
335351 the connection defined in the AuthHandler configuration will be used.
336352 :type exchange_connection: Optional[str]
337353 :return: The token response from the OAuth provider.
338- :rtype: TokenResponse
354+ :rtype: :class:`microsoft_agents.activity. TokenResponse`
339355 :raises ValueError: If the specified auth handler ID is not recognized or not configured.
340356 """
341357
@@ -376,6 +392,7 @@ def on_sign_in_success(
376392 Sets a handler to be called when sign-in is successfully completed.
377393
378394 :param handler: The handler function to call on successful sign-in.
395+ :type handler: Callable[[:class:`microsoft_agents.hosting.core.turn_context.TurnContext`, :class:`microsoft_agents.hosting.core.app.state.turn_state.TurnState`, Optional[str]], Awaitable[None]]
379396 """
380397 self ._sign_in_success_handler = handler
381398
@@ -387,5 +404,6 @@ def on_sign_in_failure(
387404 Sets a handler to be called when sign-in fails.
388405
389406 :param handler: The handler function to call on sign-in failure.
407+ :type handler: Callable[[:class:`microsoft_agents.hosting.core.turn_context.TurnContext`, :class:`microsoft_agents.hosting.core.app.state.turn_state.TurnState`, Optional[str]], Awaitable[None]]
390408 """
391409 self ._sign_in_failure_handler = handler
0 commit comments