Repository navigation
JWT authorization configuration refactor #638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Rodrigo Brandão (rodrigobr-msft)
wants to merge
10
commits into
main
Choose a base branch
from
users/robrandao/jwt-refactor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
6aa0caf
Caching of TokenValidator for jwt middleware
rodrigobr-msft 4b69f23
Merge branch 'main' of https://github.com/microsoft/Agents-for-python…
rodrigobr-msft 15db5ba
Porting jwt config changes
rodrigobr-msft 21aaf64
Improving tests
rodrigobr-msft 8a2fe39
Formatting
rodrigobr-msft 02cae35
Small test fix
rodrigobr-msft 1d061d2
Addressing PR feedback
rodrigobr-msft 4956a99
Changelog
rodrigobr-msft 1a6d053
Addressing PR feedback
rodrigobr-msft 853854e
Back-compat fix
rodrigobr-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
40 changes: 40 additions & 0 deletions
40
...s-hosting-core/microsoft_agents/hosting/core/authorization/jwt/jwt_connection_settings.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from dataclasses import dataclass, field | ||
|
|
||
| from microsoft_agents.activity.config import Configuration, xpath | ||
|
|
||
| from .._entra_issuers import default_connection_issuers | ||
| from ..connection_settings_base import ConnectionSettingsBase | ||
|
|
||
|
|
||
| @dataclass(frozen=True) | ||
| class JwtConnectionSettings(ConnectionSettingsBase): | ||
| """Provider-independent connection settings for inbound JWT validation.""" | ||
|
|
||
| validate_issuer: bool = False | ||
| issuers: list[str] = field(default_factory=list) | ||
| anonymous_allowed: bool = False | ||
|
|
||
| @classmethod | ||
| def _get_init_kwargs(cls, config: Configuration) -> dict: | ||
| base = super()._get_init_kwargs(config) | ||
| issuers = config.get_str_list(xpath("issuers")) | ||
| issuers = issuers or default_connection_issuers( | ||
| base.get("tenant_id"), base.get("authority") | ||
| ) | ||
| base.update( | ||
| { | ||
| "validate_issuer": config.get_bool( | ||
| xpath("validate_issuer"), default=False | ||
| ), | ||
| "issuers": issuers, | ||
| "anonymous_allowed": config.get_bool( | ||
| xpath("anonymous_allowed"), default=False | ||
| ), | ||
| } | ||
| ) | ||
| return base |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.