mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-20 00:28:52 +01:00
I moved to a factory model because there was just so much that needed to be async. I think the amount of async code will be reduced in the future as we remove some migration logic, but this makes sure we don't accidentally create instances without awaiting their initialization.
24 lines
1.4 KiB
TypeScript
24 lines
1.4 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
import type { AccountInfo, AuthenticationResult, InteractiveRequest, RefreshTokenRequest, SilentFlowRequest } from '@azure/msal-node';
|
|
import type { Disposable, Event } from 'vscode';
|
|
|
|
export interface ICachedPublicClientApplication {
|
|
onDidAccountsChange: Event<{ added: AccountInfo[]; changed: AccountInfo[]; deleted: AccountInfo[] }>;
|
|
onDidRemoveLastAccount: Event<void>;
|
|
acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult>;
|
|
acquireTokenInteractive(request: InteractiveRequest): Promise<AuthenticationResult>;
|
|
acquireTokenByRefreshToken(request: RefreshTokenRequest): Promise<AuthenticationResult | null>;
|
|
removeAccount(account: AccountInfo): Promise<void>;
|
|
accounts: AccountInfo[];
|
|
clientId: string;
|
|
}
|
|
|
|
export interface ICachedPublicClientApplicationManager {
|
|
onDidAccountsChange: Event<{ added: AccountInfo[]; changed: AccountInfo[]; deleted: AccountInfo[] }>;
|
|
getOrCreate(clientId: string, refreshTokensToMigrate?: string[]): Promise<ICachedPublicClientApplication>;
|
|
getAll(): ICachedPublicClientApplication[];
|
|
}
|