mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 04:23:32 +01:00
A big change, but a good one... This addresses some core issues around how we manage multiple PublicClientApplications (which are an object that should be created for each set of clientId,authority). Previously, we were doing some pretty nasty things to detect when a new PCA was created/deleted and as a result it would cause infinite loops and the likes... Now we've focused on managing that in SecretStorage by looking for a `publicClientApplications` key. This is all encapsulated in the new `PublicClientApplicationsSecretStorage`. Since we no longer relied on that hack, we still needed some way to have a PCA inform that: * accounts have changed * the last account was removed (signaling that this PCA could be disposed of in `PublicClientApplicationsSecretStorage`) Both of these events have been added to `CachedPublicClientApplication` (now in its own file) and are being used. (replacing the old `_accountChangeHandler` which was hacky... true events are cleaner). Last thing in the eventing space is that I try to minimize calls to `_storePublicClientApplications` so to not spam events across SecretStorage. You can see this in my usage of `_doCreatePublicClientApplication` over `getOrCreate`. Couple random other things: * `changed` accounts are properly bubbled up in `_onDidChangeSessionsEmitter` which is needed when a token is refreshed * `getSessions` when no scopes are passed in no longer causes new tokens to be minted * we use to only remove the first account we found but in some cases there may be the same account across different PCAs, so there's a `return` that's removed in `authProvider.ts` that fixes this bug * Logging is clearer and more verbose (in a good way)
Microsoft Authentication for Visual Studio Code
Notice: This extension is bundled with Visual Studio Code. It can be disabled but not uninstalled.
Features
This extension provides support for authenticating to Microsoft. It registers the microsoft Authentication Provider that can be leveraged by other extensions. This also provides the Microsoft authentication used by Settings Sync.
Additionally, it provides the microsoft-sovereign-cloud Authentication Provider that can be used to sign in to other Azure clouds like Azure for US Government or Azure China. Use the setting microsoft-sovereign-cloud.endpoint to select the authentication endpoint the provider should use. Please note that different scopes may also be required in different environments.