You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Aiohttp authorization crashes on unhashable app cache keys, malformed audience settings can broaden inbound trust, and six middleware tests still omit the new cache_key argument.
This PR refactors inbound JWT authorization in the Microsoft 365 Agents SDK for Python around dedicated configuration models, while retaining a legacy AgentAuthConfiguration conversion path.
Changes:
Adds token-validation policy and per-connection JWT settings.
Updates audience routing and adds application-scoped validator caching to framework middleware.
Adds tests for configuration binding, authorization, and cache ownership.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The middleware no longer guards access to the optional ASGI application and its state, causing an AttributeError instead of the intended configuration-not-found response when either is absent.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Restore safe handling for missing optional app state
Please retain the previous guard around the optional application and its state. scope["app"] is not required by ASGI, so directly wrapping an ASGI application without this extension now raises AttributeError while evaluating app.state, before _authorize_request can return its configuration-not-found response. Using nested getattr calls preserves the existing error handling for applications without app or state.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Legacy indexed scope mappings are passed through without conversion to lists, causing ValueError during JwtTokenValidator construction and breaking authorization for existing configurations.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Convert legacy indexed scope mappings to lists before binding
The legacy environment loader preserves indexed scopes such as SCOPES__0 as a mapping, which AgentAuthConfiguration.SCOPES retains. Passing that mapping through this binder raises ValueError in Configuration.get_scopes(), so constructing JwtTokenValidator now breaks authorization for existing configurations such as test_samples/entra_sidecar/env.TEMPLATE. Convert legacy scope mappings to lists before binding.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues remain for the JWT authorization configuration refactor.
No open issues 🎉
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
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
Ports the JWT configuration refactor from
users/robrandao/settings:ConnectionSettingsBase,JwtConnectionSettings, andTokenValidationConfiguration.JwtTokenValidatorto bind application configuration while retaining legacyAgentAuthConfigurationsupport.get_str_list, preserving aliases and empty-value defaults.ConnectionsandConnectionManagerunchanged.Testing