Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/microsoft-authentication/src/common/publicClientCache.ts
5242 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
import type { AccountInfo, AuthenticationResult, InteractiveRequest, RefreshTokenRequest, SilentFlowRequest, DeviceCodeRequest } from '@azure/msal-node';
6
import type { Disposable, Event } from 'vscode';
7
8
export interface ICachedPublicClientApplication {
9
onDidAccountsChange: Event<{ added: AccountInfo[]; changed: AccountInfo[]; deleted: AccountInfo[] }>;
10
onDidRemoveLastAccount: Event<void>;
11
acquireTokenSilent(request: SilentFlowRequest): Promise<AuthenticationResult>;
12
acquireTokenInteractive(request: InteractiveRequest): Promise<AuthenticationResult>;
13
acquireTokenByDeviceCode(request: Omit<DeviceCodeRequest, 'deviceCodeCallback'>): Promise<AuthenticationResult | null>;
14
acquireTokenByRefreshToken(request: RefreshTokenRequest): Promise<AuthenticationResult | null>;
15
removeAccount(account: AccountInfo): Promise<void>;
16
accounts: AccountInfo[];
17
clientId: string;
18
isBrokerAvailable: Readonly<boolean>;
19
}
20
21
export interface ICachedPublicClientApplicationManager {
22
onDidAccountsChange: Event<{ added: AccountInfo[]; changed: AccountInfo[]; deleted: AccountInfo[] }>;
23
getOrCreate(clientId: string, migrate?: { refreshTokensToMigrate?: string[]; tenant: string }): Promise<ICachedPublicClientApplication>;
24
getAll(): ICachedPublicClientApplication[];
25
}
26
27