-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
Adopt the MSAL broker to talk to the OS for Microsoft auth #233739
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 5 out of 16 changed files in this pull request and generated no suggestions.
Files not reviewed (11)
- extensions/microsoft-authentication/.vscodeignore: Language not supported
- extensions/microsoft-authentication/package-lock.json: Language not supported
- extensions/microsoft-authentication/package.json: Language not supported
- extensions/microsoft-authentication/packageMocks/keytar/package.json: Language not supported
- extensions/microsoft-authentication/tsconfig.json: Language not supported
- build/lib/extensions.js: Evaluated as low risk
- extensions/microsoft-authentication/src/node/publicClientCache.ts: Evaluated as low risk
- build/gulpfile.extensions.js: Evaluated as low risk
- build/gulpfile.vscode.js: Evaluated as low risk
- extensions/microsoft-authentication/src/node/authProvider.ts: Evaluated as low risk
- build/lib/extensions.ts: Evaluated as low risk
Comments skipped due to low confidence (7)
extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts:7
- Ensure that the NativeBrokerPlugin is correctly imported and used.
import { NativeBrokerPlugin } from '@azure/msal-node-extensions';
extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts:29
- Verify that ScopedAccountAccess is correctly instantiated and used.
private readonly _accountAccess = new ScopedAccountAccess(this._secretStorage, this._cloudName, this._clientId, this._authority);
extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts:89
- Ensure that initialize method is correctly called and handled.
await this._accountAccess.initialize();
extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts:126
- Ensure that setAllowedAccess method is correctly called and handled.
await this._accountAccess.setAllowedAccess(result.account!, true);
extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts:134
- Ensure that setAllowedAccess method is correctly called and handled.
return this._accountAccess.setAllowedAccess(account, false);
extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts:141
- Ensure that onDidAccountAccessChange method is correctly called and handled.
return this._accountAccess.onDidAccountAccessChange(() => this._update());
extensions/microsoft-authentication/src/node/cachedPublicClientApplication.ts:180
- Ensure that isAllowedAccess method is correctly called and handled.
after = after.filter(a => this._accountAccess.isAllowedAccess(a));
Tip: If you use Visual Studio Code, you can request a review from Copilot before you push from the "Source Control" tab. Learn more
// We don't use the feature that uses Dpapi, so we can just replace it with a mock. | ||
// This is a bit of a hack, but it's the easiest way to do it. Really, msal should | ||
// handle when this native node module is not available. | ||
new NormalModuleReplacementPlugin( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can go away when this is released: AzureAD/microsoft-authentication-library-for-js#7412
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed the build part. LGTM overall, minor nits
Running a full build for sanity https://monacotools.visualstudio.com/Monaco/_build/results?buildId=304750&view=results |
New sanity build after changes: https://monacotools.visualstudio.com/Monaco/_build/results?buildId=304949&view=results |
beaa10f
to
087a4e0
Compare
@@ -476,7 +477,8 @@ function tweakProductForServerWeb(product) { | |||
|
|||
const serverTask = task.define(`vscode-${type}${dashed(platform)}${dashed(arch)}${dashed(minified)}`, task.series( | |||
compileBuildTask, | |||
compileExtensionsBuildTask, | |||
cleanExtensionsBuildTask, | |||
compileNonNativeExtensionsBuildTask, | |||
compileExtensionMediaBuildTask, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we want compileExtensionsBuildTask
here ? I believe this task is only used for local build, so useful to build all targets ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does build all targets. We build the non-native ones here, and then the native ones in the serverTaskCI
which is included in this local build task at the bottom
@@ -500,7 +501,8 @@ BUILD_TARGETS.forEach(buildTarget => { | |||
|
|||
const vscodeTask = task.define(`vscode${dashed(platform)}${dashed(arch)}${dashed(minified)}`, task.series( | |||
compileBuildTask, | |||
compileExtensionsBuildTask, | |||
cleanExtensionsBuildTask, | |||
compileNonNativeExtensionsBuildTask, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compileNonNativeExtensionsBuildTask, | |
compileExtensionsBuildTask, |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this suggestion, we will be building the native ones twice. I separated them out so that we didn't double build based on your original feedback.
The non-native ones are built here, and then the native ones are part of vscodeTaskCI
which is added to the end of this local build task.
Am I misunderstanding something?
Not sure why the universal build fails on the parcel watcher, I will take a look at it today. |
// TODO: Should we consider expanding this to other files in this area? | ||
'**/node_modules/@parcel/node-addon-api/nothing.target.mk' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deepak1556 this fixed the Create Universal App step of the build for me. Let me know if you'd like to expand the scope but until then I've scoped it as small as possible.
Sanity build here: https://monacotools.visualstudio.com/Monaco/_build/results?buildId=305103&view=results ✅ smoke tested on macOS and Windows and everything seems operational. |
This adopts the
NativeBrokerPlugin
provided by@azure/msal-node-extensions
to provide the ability to use auth state from the OS, and show native auth dialogs instead of going to the browser.This has several pieces:
NativeBrokerPlugin
to our PCAs@azure/msal-node-extensions
that uses keytar@azure/msal-node-extensions
that uses it.node
and.dll
files are included in the bundleThere are a couple of followups:
handle
API to handle (heh) Auxiliary Windows Proposed API for window handle #233106acquireTokenSilent
andacquireTokenInteractive
and all the usage of this native node module into a separate process or maybe in Core... we'll see. Something to experiment with after we have something working. NEEDS FOLLOW UP ISSUEFixes #229431