From f14ccecb1edade418be0111e6b3cbaa2a4b05a2c Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Fri, 29 Aug 2025 12:21:53 +0200 Subject: [PATCH] Add support for Entra ID v1.0 authorization servers in VSCode MCP Client (#262603) * Initial plan * Add v1.0 Entra ID support and optimize MCP discovery for Microsoft endpoints Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> * Add tests for v1.0 authorization server support Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> * Address code review feedback: remove redundant tests and Microsoft-specific logic Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> --- extensions/microsoft-authentication/package.json | 1 + .../src/common/test/scopeData.test.ts | 6 ++++++ extensions/microsoft-authentication/src/extensionV1.ts | 1 + extensions/microsoft-authentication/src/extensionV2.ts | 1 + 4 files changed, 9 insertions(+) diff --git a/extensions/microsoft-authentication/package.json b/extensions/microsoft-authentication/package.json index 0e92f035015..01371bb83bc 100644 --- a/extensions/microsoft-authentication/package.json +++ b/extensions/microsoft-authentication/package.json @@ -35,6 +35,7 @@ "label": "Microsoft", "id": "microsoft", "authorizationServerGlobs": [ + "https://login.microsoftonline.com/*", "https://login.microsoftonline.com/*/v2.0" ] }, diff --git a/extensions/microsoft-authentication/src/common/test/scopeData.test.ts b/extensions/microsoft-authentication/src/common/test/scopeData.test.ts index 9c057c359c0..3dc9d95aa14 100644 --- a/extensions/microsoft-authentication/src/common/test/scopeData.test.ts +++ b/extensions/microsoft-authentication/src/common/test/scopeData.test.ts @@ -102,4 +102,10 @@ suite('ScopeData', () => { const scopeData = new ScopeData(['custom_scope', 'VSCODE_TENANT:scope_tenant'], undefined, authorizationServer); assert.strictEqual(scopeData.tenant, 'url_tenant'); }); + + test('should extract tenant from v1.0 authorization server URL path', () => { + const authorizationServer = Uri.parse('https://login.microsoftonline.com/tenant123'); + const scopeData = new ScopeData(['custom_scope'], undefined, authorizationServer); + assert.strictEqual(scopeData.tenant, 'tenant123'); + }); }); diff --git a/extensions/microsoft-authentication/src/extensionV1.ts b/extensions/microsoft-authentication/src/extensionV1.ts index 9956ede25e1..02248dd989d 100644 --- a/extensions/microsoft-authentication/src/extensionV1.ts +++ b/extensions/microsoft-authentication/src/extensionV1.ts @@ -171,6 +171,7 @@ export async function activate(context: vscode.ExtensionContext, telemetryReport { supportsMultipleAccounts: true, supportedAuthorizationServers: [ + vscode.Uri.parse('https://login.microsoftonline.com/*'), vscode.Uri.parse('https://login.microsoftonline.com/*/v2.0') ] } diff --git a/extensions/microsoft-authentication/src/extensionV2.ts b/extensions/microsoft-authentication/src/extensionV2.ts index 3469c85a6aa..bafc8454f8c 100644 --- a/extensions/microsoft-authentication/src/extensionV2.ts +++ b/extensions/microsoft-authentication/src/extensionV2.ts @@ -83,6 +83,7 @@ export async function activate(context: ExtensionContext, mainTelemetryReporter: supportsMultipleAccounts: true, supportsChallenges: true, supportedAuthorizationServers: [ + Uri.parse('https://login.microsoftonline.com/*'), Uri.parse('https://login.microsoftonline.com/*/v2.0') ] }