diff --git a/extensions/microsoft-authentication/.vscodeignore b/extensions/microsoft-authentication/.vscodeignore index e7feddb5da8..e2daf4b8a89 100644 --- a/extensions/microsoft-authentication/.vscodeignore +++ b/extensions/microsoft-authentication/.vscodeignore @@ -3,7 +3,6 @@ out/test/** out/** extension.webpack.config.js -extension-browser.webpack.config.js package-lock.json src/** .gitignore diff --git a/extensions/microsoft-authentication/extension-browser.webpack.config.js b/extensions/microsoft-authentication/extension-browser.webpack.config.js deleted file mode 100644 index daf3fdf8447..00000000000 --- a/extensions/microsoft-authentication/extension-browser.webpack.config.js +++ /dev/null @@ -1,27 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -// @ts-check -import path from 'path'; -import { browser as withBrowserDefaults } from '../shared.webpack.config.mjs'; - -export default withBrowserDefaults({ - context: import.meta.dirname, - node: { - global: true, - __filename: false, - __dirname: false, - }, - entry: { - extension: './src/extension.ts', - }, - resolve: { - alias: { - './node/authServer': path.resolve(import.meta.dirname, 'src/browser/authServer'), - './node/buffer': path.resolve(import.meta.dirname, 'src/browser/buffer'), - './node/fetch': path.resolve(import.meta.dirname, 'src/browser/fetch'), - './node/authProvider': path.resolve(import.meta.dirname, 'src/browser/authProvider'), - } - } -}); diff --git a/extensions/microsoft-authentication/package.json b/extensions/microsoft-authentication/package.json index 178475bb711..e4cb7fe038f 100644 --- a/extensions/microsoft-authentication/package.json +++ b/extensions/microsoft-authentication/package.json @@ -129,13 +129,10 @@ }, "aiKey": "0c6ae279ed8443289764825290e4f9e2-1a736e7c-1324-4338-be46-fc2a58ae4d14-7255", "main": "./out/extension.js", - "browser": "./dist/browser/extension.js", "scripts": { "vscode:prepublish": "npm run compile", "compile": "gulp compile-extension:microsoft-authentication", - "compile-web": "npx webpack-cli --config extension-browser.webpack.config --mode none", - "watch": "gulp watch-extension:microsoft-authentication", - "watch-web": "npx webpack-cli --config extension-browser.webpack.config --mode none --watch --info-verbosity verbose" + "watch": "gulp watch-extension:microsoft-authentication" }, "devDependencies": { "@types/node": "22.x", diff --git a/extensions/microsoft-authentication/src/browser/authProvider.ts b/extensions/microsoft-authentication/src/browser/authProvider.ts deleted file mode 100644 index 3b4da5b18fa..00000000000 --- a/extensions/microsoft-authentication/src/browser/authProvider.ts +++ /dev/null @@ -1,29 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { AuthenticationProvider, AuthenticationProviderAuthenticationSessionsChangeEvent, AuthenticationSession, EventEmitter } from 'vscode'; - -export class MsalAuthProvider implements AuthenticationProvider { - private _onDidChangeSessions = new EventEmitter(); - onDidChangeSessions = this._onDidChangeSessions.event; - - initialize(): Thenable { - throw new Error('Method not implemented.'); - } - - getSessions(): Thenable { - throw new Error('Method not implemented.'); - } - createSession(): Thenable { - throw new Error('Method not implemented.'); - } - removeSession(): Thenable { - throw new Error('Method not implemented.'); - } - - dispose() { - this._onDidChangeSessions.dispose(); - } -} diff --git a/extensions/microsoft-authentication/src/browser/authServer.ts b/extensions/microsoft-authentication/src/browser/authServer.ts deleted file mode 100644 index 60b53c713a8..00000000000 --- a/extensions/microsoft-authentication/src/browser/authServer.ts +++ /dev/null @@ -1,12 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -export function startServer(_: any): any { - throw new Error('Not implemented'); -} - -export function createServer(_: any): any { - throw new Error('Not implemented'); -} diff --git a/extensions/microsoft-authentication/src/browser/buffer.ts b/extensions/microsoft-authentication/src/browser/buffer.ts deleted file mode 100644 index 794bb19f579..00000000000 --- a/extensions/microsoft-authentication/src/browser/buffer.ts +++ /dev/null @@ -1,17 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -export function base64Encode(text: string): string { - return btoa(text); -} - -export function base64Decode(text: string): string { - // modification of https://stackoverflow.com/a/38552302 - const replacedCharacters = text.replace(/-/g, '+').replace(/_/g, '/'); - const decodedText = decodeURIComponent(atob(replacedCharacters).split('').map(function (c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); - }).join('')); - return decodedText; -} diff --git a/extensions/microsoft-authentication/src/browser/fetch.ts b/extensions/microsoft-authentication/src/browser/fetch.ts deleted file mode 100644 index c61281ca8f8..00000000000 --- a/extensions/microsoft-authentication/src/browser/fetch.ts +++ /dev/null @@ -1,6 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -export default fetch; diff --git a/extensions/microsoft-authentication/src/node/authProvider.ts b/extensions/microsoft-authentication/src/node/authProvider.ts index ac57bf0680b..e72f04ed208 100644 --- a/extensions/microsoft-authentication/src/node/authProvider.ts +++ b/extensions/microsoft-authentication/src/node/authProvider.ts @@ -209,12 +209,9 @@ export class MsalAuthProvider implements AuthenticationProvider { } }; - const isNodeEnvironment = typeof process !== 'undefined' && typeof process?.versions?.node === 'string'; const callbackUri = await env.asExternalUri(Uri.parse(`${env.uriScheme}://vscode.microsoft-authentication`)); const flows = getMsalFlows({ - extensionHost: isNodeEnvironment - ? this._context.extension.extensionKind === ExtensionKind.UI ? ExtensionHost.Local : ExtensionHost.Remote - : ExtensionHost.WebWorker, + extensionHost: this._context.extension.extensionKind === ExtensionKind.UI ? ExtensionHost.Local : ExtensionHost.Remote, supportedClient: isSupportedClient(callbackUri), isBrokerSupported: cachedPca.isBrokerAvailable }); @@ -348,12 +345,9 @@ export class MsalAuthProvider implements AuthenticationProvider { } }; - const isNodeEnvironment = typeof process !== 'undefined' && typeof process?.versions?.node === 'string'; const callbackUri = await env.asExternalUri(Uri.parse(`${env.uriScheme}://vscode.microsoft-authentication`)); const flows = getMsalFlows({ - extensionHost: isNodeEnvironment - ? this._context.extension.extensionKind === ExtensionKind.UI ? ExtensionHost.Local : ExtensionHost.Remote - : ExtensionHost.WebWorker, + extensionHost: this._context.extension.extensionKind === ExtensionKind.UI ? ExtensionHost.Local : ExtensionHost.Remote, isBrokerSupported: cachedPca.isBrokerAvailable, supportedClient: isSupportedClient(callbackUri) }); diff --git a/extensions/microsoft-authentication/src/node/flows.ts b/extensions/microsoft-authentication/src/node/flows.ts index 4a3c877691b..22782330bd6 100644 --- a/extensions/microsoft-authentication/src/node/flows.ts +++ b/extensions/microsoft-authentication/src/node/flows.ts @@ -14,14 +14,12 @@ import { Config } from '../common/config'; const DEFAULT_REDIRECT_URI = 'https://vscode.dev/redirect'; export const enum ExtensionHost { - WebWorker, Remote, Local } interface IMsalFlowOptions { supportsRemoteExtensionHost: boolean; - supportsWebWorkerExtensionHost: boolean; supportsUnsupportedClient: boolean; supportsBroker: boolean; } @@ -48,7 +46,6 @@ class DefaultLoopbackFlow implements IMsalFlow { label = 'default'; options: IMsalFlowOptions = { supportsRemoteExtensionHost: false, - supportsWebWorkerExtensionHost: false, supportsUnsupportedClient: true, supportsBroker: true }; @@ -78,7 +75,6 @@ class UrlHandlerFlow implements IMsalFlow { label = 'protocol handler'; options: IMsalFlowOptions = { supportsRemoteExtensionHost: true, - supportsWebWorkerExtensionHost: false, supportsUnsupportedClient: false, supportsBroker: false }; @@ -108,7 +104,6 @@ class DeviceCodeFlow implements IMsalFlow { label = 'device code'; options: IMsalFlowOptions = { supportsRemoteExtensionHost: true, - supportsWebWorkerExtensionHost: false, supportsUnsupportedClient: true, supportsBroker: false }; @@ -139,13 +134,8 @@ export function getMsalFlows(query: IMsalFlowQuery): IMsalFlow[] { const flows = []; for (const flow of allFlows) { let useFlow: boolean = true; - switch (query.extensionHost) { - case ExtensionHost.Remote: - useFlow &&= flow.options.supportsRemoteExtensionHost; - break; - case ExtensionHost.WebWorker: - useFlow &&= flow.options.supportsWebWorkerExtensionHost; - break; + if (query.extensionHost === ExtensionHost.Remote) { + useFlow &&= flow.options.supportsRemoteExtensionHost; } useFlow &&= flow.options.supportsBroker || !query.isBrokerSupported; useFlow &&= flow.options.supportsUnsupportedClient || query.supportedClient; diff --git a/extensions/microsoft-authentication/src/node/test/flows.test.ts b/extensions/microsoft-authentication/src/node/test/flows.test.ts index 1cd4bd6077a..b2685e783cc 100644 --- a/extensions/microsoft-authentication/src/node/test/flows.test.ts +++ b/extensions/microsoft-authentication/src/node/test/flows.test.ts @@ -43,16 +43,6 @@ suite('getMsalFlows', () => { assert.strictEqual(flows[1].label, 'device code'); }); - test('should return no flows for web worker extension host', () => { - const query: IMsalFlowQuery = { - extensionHost: ExtensionHost.WebWorker, - supportedClient: true, - isBrokerSupported: false - }; - const flows = getMsalFlows(query); - assert.strictEqual(flows.length, 0); - }); - test('should return only default and device code flows for local extension host with unsupported client and no broker', () => { const query: IMsalFlowQuery = { extensionHost: ExtensionHost.Local, diff --git a/extensions/microsoft-authentication/tsconfig.json b/extensions/microsoft-authentication/tsconfig.json index 7f97ae747b4..e9a3ade3ed5 100644 --- a/extensions/microsoft-authentication/tsconfig.json +++ b/extensions/microsoft-authentication/tsconfig.json @@ -4,10 +4,7 @@ "outDir": "./out", "noFallthroughCasesInSwitch": true, "noUnusedLocals": false, - "skipLibCheck": true, - "lib": [ - "WebWorker" - ] + "skipLibCheck": true }, "include": [ "src/**/*",