mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 00:59:03 +01:00
Remove web worker support from microsoft-authentication extension (#276762)
* Initial plan * Remove web worker support from microsoft-authentication extension - Remove browser entry point from package.json - Remove browser webpack configuration - Remove browser-specific scripts (compile-web, watch-web) - Remove src/browser/ directory with browser-specific implementations - Remove ExtensionHost.WebWorker enum value - Remove supportsWebWorkerExtensionHost flags from all flows - Simplify authProvider.ts by removing web worker detection logic - Remove web worker test case from flows.test.ts - Successfully compiled with 0 errors Co-authored-by: TylerLeonhardt <2644648+TylerLeonhardt@users.noreply.github.com> * couple references --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d528178662
commit
a3fcd46091
@@ -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)
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user