Address potential variations in the value of the authority url#971
Merged
Address potential variations in the value of the authority url#971
Conversation
Contributor
Author
|
@copilot please review |
Contributor
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves authority URL handling in agents-hosting auth flows by introducing a shared resolveAuthority(authority, tenantId) helper that supports both “base authority + tenantId” and “tenant embedded in authority” configuration styles, aligning behavior with Python/.NET and avoiding malformed URLs containing undefined.
Changes:
- Added
resolveAuthority()utility and updated default issuer construction to use it (withbotframework.comfallback when tenantId is missing). - Updated JWT middleware JWKS URI construction and MSAL connection defaults to use the resolved authority.
- Added/updated tests for authority resolution and the embedded-tenant authority scenario.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/agents-hosting/src/auth/authConfiguration.ts | Adds resolveAuthority() and uses it when building default issuers (avoids undefined tenant segments). |
| packages/agents-hosting/src/auth/jwt-middleware.ts | Uses resolveAuthority() when constructing the JWKS discovery URI. |
| packages/agents-hosting/src/auth/msalConnectionManager.ts | Uses resolveAuthority() for default issuer URLs in connection defaults. |
| packages/agents-hosting/src/auth/msalTokenProvider.ts | Refactors authority resolution to delegate to the shared utility and handle agentic overrides more cleanly. |
| packages/agents-hosting/test/hosting/authConfiguration.test.ts | Updates issuer expectations and adds targeted tests for resolveAuthority(). |
| packages/agents-hosting/test/hosting/jwt-middleware.test.ts | Adds a test case for embedded-tenant authority configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MattB-msft
approved these changes
Mar 3, 2026
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.
Resolves #953
Introduce a method to resolve the authority URL that allows for it to include the tenant ID in the configured URL instead of separately.
Previously, we always expected authority to be in the format 'http://login.microsoft.com' and to NOT include the tenantId. This is inconsistent with Python and Dotnet, so this PR addresses that.
Major changes:
NEW:
Prior to these changes, configurations lacking a tenant ID would create urls with
undefinedin the authority url. This is obviously incorrect. The one exception is that inside the msalTokenProvider, we would default tobotframework.comIn this PR, we have added this behavior to all places where this authority URL is used.
TODO:
-[ ] Double check that botframework.com should be used as a default tenant id if not specified