Repository navigation
Improving the auth handler configuration design - #644
Open
Rodrigo Brandão (rodrigobr-msft) wants to merge 5 commits into
Open
Rodrigo Brandão (rodrigobr-msft) wants to merge 5 commits into
Rodrigo Brandão (rodrigobr-msft) wants to merge 5 commits into
Conversation
Rodrigo Brandão (rodrigobr-msft)
requested a review
from a team
as a code owner
November 4, 2026 23:31
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Directly constructed AuthHandlerSettings retain auth_type casing, causing supported settings-object paths to reject values such as "UserAuthorization" with a ValueError.
1 open issue
What changed in this PR
Refactors OAuth handler configuration around AuthHandlerSettings, integrating authorization handlers with the SDK’s shared configuration infrastructure while retaining deprecated legacy APIs.
Changes:
- Adds dataclass-based settings with mapping and configuration loaders.
- Updates authorization handlers and public exports to support the new settings API.
- Adds configuration and compatibility tests, including deprecation-warning checks.
| File | Description |
|---|---|
tests/hosting_core/app/_oauth/test_authorization.py |
Tests settings inputs, configuration loading, and legacy argument warnings. |
tests/hosting_core/app/_oauth/test_auth_handler.py |
Tests settings normalization, defaults, and legacy construction. |
pytest.ini |
Filters expected authentication deprecation warnings. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/authorization.py |
Loads and dispatches handlers using the new settings type. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/auth_handler.py |
Introduces AuthHandlerSettings and retains deprecated AuthHandler. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/_handlers/connector_user_authorization.py |
Accepts the new settings argument for connector authorization. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/_handlers/agentic_user_authorization.py |
Accepts settings and reads alternate blueprint configuration from resolved settings. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/_handlers/_user_authorization.py |
Removes an unused import. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/_handlers/_authorization_handler.py |
Resolves settings inputs and warns on deprecated arguments. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/oauth/__init__.py |
Exports AuthHandlerSettings from OAuth. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/app_options.py |
Updates application authorization settings annotations. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/app/__init__.py |
Exports the new settings type and adjusts the export list. |
libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/__init__.py |
Exports the new settings type from core. |
libraries/microsoft-agents-authentication-msal/microsoft_agents/authentication/msal/msal_auth.py |
Removes an unused import. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Refactor OAuth handler configuration around
AuthHandlerSettings, aligning it with the SDK's shared configuration infrastructure.from_mappingandfrom_configurationsupport.settingsconstructor argument across authorization handlers.AuthHandlerconstruction and exports, while deprecating it and theauth_handler/auth_handler_settingsarguments.Tests
_from_settingshelper.Validation