@microsoft/vscode-azext-azureauth 5.1.0 → 6.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +9 -79
  3. package/dist/cjs/src/contracts/AzureAccount.js +7 -0
  4. package/dist/cjs/src/contracts/AzureSubscriptionProviderRequestOptions.js +48 -0
  5. package/dist/cjs/src/index.js +13 -10
  6. package/dist/cjs/src/providers/AzureDevOpsSubscriptionProvider.js +178 -0
  7. package/dist/cjs/src/providers/AzureSubscriptionProviderBase.js +393 -0
  8. package/dist/cjs/src/providers/VSCodeAzureSubscriptionProvider.js +269 -0
  9. package/dist/cjs/src/utils/Limiter.js +41 -0
  10. package/dist/cjs/src/{NotSignedInError.js → utils/NotSignedInError.js} +3 -2
  11. package/dist/cjs/src/utils/configuredAzureEnv.js +11 -16
  12. package/dist/cjs/src/utils/dedupeSubscriptions.js +27 -0
  13. package/dist/cjs/src/utils/getMetricsForTelemetry.js +47 -0
  14. package/dist/cjs/src/{getSessionFromVSCode.js → utils/getSessionFromVSCode.js} +5 -2
  15. package/dist/cjs/src/utils/getSignalForToken.js +29 -0
  16. package/dist/cjs/src/utils/map/CaselessMap.js +71 -0
  17. package/dist/cjs/src/utils/map/TwoKeyCaselessMap.js +194 -0
  18. package/dist/cjs/src/utils/screen.js +62 -0
  19. package/dist/cjs/src/{signInToTenant.js → utils/signInToTenant.js} +15 -13
  20. package/dist/cjs/src/utils/tryGetTokenExpiration.js +25 -0
  21. package/dist/esm/src/contracts/AzureAccount.d.ts +5 -0
  22. package/dist/esm/src/contracts/AzureAccount.js +6 -0
  23. package/dist/esm/src/{AzureAuthentication.d.ts → contracts/AzureAuthentication.d.ts} +1 -1
  24. package/dist/esm/src/{AzureSubscription.d.ts → contracts/AzureSubscription.d.ts} +4 -4
  25. package/dist/esm/src/contracts/AzureSubscriptionProvider.d.ts +112 -0
  26. package/dist/esm/src/contracts/AzureSubscriptionProviderRequestOptions.d.ts +103 -0
  27. package/dist/esm/src/contracts/AzureSubscriptionProviderRequestOptions.js +44 -0
  28. package/dist/esm/src/contracts/AzureTenant.d.ts +15 -0
  29. package/dist/esm/src/index.d.ts +13 -10
  30. package/dist/esm/src/index.js +13 -10
  31. package/dist/esm/src/providers/AzureDevOpsSubscriptionProvider.d.ts +68 -0
  32. package/dist/esm/src/providers/AzureDevOpsSubscriptionProvider.js +140 -0
  33. package/dist/esm/src/providers/AzureSubscriptionProviderBase.d.ts +74 -0
  34. package/dist/esm/src/providers/AzureSubscriptionProviderBase.js +356 -0
  35. package/dist/esm/src/providers/VSCodeAzureSubscriptionProvider.d.ts +70 -0
  36. package/dist/esm/src/providers/VSCodeAzureSubscriptionProvider.js +232 -0
  37. package/dist/esm/src/utils/Limiter.d.ts +9 -0
  38. package/dist/esm/src/utils/Limiter.js +37 -0
  39. package/dist/esm/src/{NotSignedInError.d.ts → utils/NotSignedInError.d.ts} +2 -2
  40. package/dist/esm/src/{NotSignedInError.js → utils/NotSignedInError.js} +3 -2
  41. package/dist/esm/src/utils/configuredAzureEnv.d.ts +7 -4
  42. package/dist/esm/src/utils/configuredAzureEnv.js +11 -16
  43. package/dist/esm/src/utils/dedupeSubscriptions.d.ts +14 -0
  44. package/dist/esm/src/utils/dedupeSubscriptions.js +24 -0
  45. package/dist/esm/src/utils/getMetricsForTelemetry.d.ts +32 -0
  46. package/dist/esm/src/utils/getMetricsForTelemetry.js +44 -0
  47. package/dist/esm/src/{getSessionFromVSCode.js → utils/getSessionFromVSCode.js} +5 -2
  48. package/dist/esm/src/utils/getSignalForToken.d.ts +7 -0
  49. package/dist/esm/src/utils/getSignalForToken.js +26 -0
  50. package/dist/esm/src/utils/map/CaselessMap.d.ts +28 -0
  51. package/dist/esm/src/utils/map/CaselessMap.js +67 -0
  52. package/dist/esm/src/utils/map/TwoKeyCaselessMap.d.ts +49 -0
  53. package/dist/esm/src/utils/map/TwoKeyCaselessMap.js +190 -0
  54. package/dist/esm/src/utils/screen.d.ts +9 -0
  55. package/dist/esm/src/utils/screen.js +59 -0
  56. package/dist/esm/src/utils/signInToTenant.d.ts +7 -0
  57. package/dist/esm/src/{signInToTenant.js → utils/signInToTenant.js} +16 -14
  58. package/dist/esm/src/utils/tryGetTokenExpiration.d.ts +2 -0
  59. package/dist/esm/src/utils/tryGetTokenExpiration.js +22 -0
  60. package/package.json +33 -23
  61. package/AzureFederatedCredentialsGuide.md +0 -174
  62. package/dist/cjs/src/AzureDevOpsSubscriptionProvider.js +0 -215
  63. package/dist/cjs/src/VSCodeAzureSubscriptionProvider.js +0 -385
  64. package/dist/cjs/src/utils/getUnauthenticatedTenants.js +0 -23
  65. package/dist/cjs/src/utils/isGetSubscriptionsFilter.js +0 -27
  66. package/dist/esm/src/AzureDevOpsSubscriptionProvider.d.ts +0 -68
  67. package/dist/esm/src/AzureDevOpsSubscriptionProvider.js +0 -210
  68. package/dist/esm/src/AzureSubscriptionProvider.d.ts +0 -82
  69. package/dist/esm/src/AzureTenant.d.ts +0 -5
  70. package/dist/esm/src/VSCodeAzureSubscriptionProvider.d.ts +0 -112
  71. package/dist/esm/src/VSCodeAzureSubscriptionProvider.js +0 -348
  72. package/dist/esm/src/signInToTenant.d.ts +0 -6
  73. package/dist/esm/src/utils/getUnauthenticatedTenants.d.ts +0 -9
  74. package/dist/esm/src/utils/getUnauthenticatedTenants.js +0 -20
  75. package/dist/esm/src/utils/isGetSubscriptionsFilter.d.ts +0 -14
  76. package/dist/esm/src/utils/isGetSubscriptionsFilter.js +0 -23
  77. /package/dist/cjs/src/{AzureAuthentication.js → contracts/AzureAuthentication.js} +0 -0
  78. /package/dist/cjs/src/{AzureSubscription.js → contracts/AzureSubscription.js} +0 -0
  79. /package/dist/cjs/src/{AzureSubscriptionProvider.js → contracts/AzureSubscriptionProvider.js} +0 -0
  80. /package/dist/cjs/src/{AzureTenant.js → contracts/AzureTenant.js} +0 -0
  81. /package/dist/esm/src/{AzureAuthentication.js → contracts/AzureAuthentication.js} +0 -0
  82. /package/dist/esm/src/{AzureSubscription.js → contracts/AzureSubscription.js} +0 -0
  83. /package/dist/esm/src/{AzureSubscriptionProvider.js → contracts/AzureSubscriptionProvider.js} +0 -0
  84. /package/dist/esm/src/{AzureTenant.js → contracts/AzureTenant.js} +0 -0
  85. /package/dist/esm/src/{getSessionFromVSCode.d.ts → utils/getSessionFromVSCode.d.ts} +0 -0
@@ -1,210 +0,0 @@
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 { getConfiguredAzureEnv } from './utils/configuredAzureEnv';
6
- let azureDevOpsSubscriptionProvider;
7
- export function createAzureDevOpsSubscriptionProviderFactory(initializer) {
8
- return async () => {
9
- azureDevOpsSubscriptionProvider ??= new AzureDevOpsSubscriptionProvider(initializer);
10
- return azureDevOpsSubscriptionProvider;
11
- };
12
- }
13
- /**
14
- * AzureSubscriptionProvider implemented to authenticate via federated DevOps service connection, using workflow identity federation
15
- * To learn how to configure your DevOps environment to use this provider, refer to the README.md
16
- * NOTE: This provider is only available when running in an Azure DevOps pipeline
17
- * Reference: https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation
18
- */
19
- export class AzureDevOpsSubscriptionProvider {
20
- _tokenCredential;
21
- /**
22
- * The resource ID of the Azure DevOps federated service connection,
23
- * which can be found on the `resourceId` field of the URL at the address bar
24
- * when viewing the service connection in the Azure DevOps portal
25
- */
26
- _SERVICE_CONNECTION_ID;
27
- /**
28
- * The `Tenant ID` field of the service connection properties
29
- */
30
- _DOMAIN;
31
- /**
32
- * The `Service Principal Id` field of the service connection properties
33
- */
34
- _CLIENT_ID;
35
- constructor({ serviceConnectionId, domain, clientId }) {
36
- if (!serviceConnectionId || !domain || !clientId) {
37
- throw new Error(`Missing initializer values to identify Azure DevOps federated service connection\n
38
- Values provided:\n
39
- serviceConnectionId: ${serviceConnectionId ? "✅" : "❌"}\n
40
- domain: ${domain ? "✅" : "❌"}\n
41
- clientId: ${clientId ? "✅" : "❌"}\n
42
- `);
43
- }
44
- this._SERVICE_CONNECTION_ID = serviceConnectionId;
45
- this._DOMAIN = domain;
46
- this._CLIENT_ID = clientId;
47
- }
48
- async getSubscriptions(_filter) {
49
- // ignore the filter setting because not every consumer of this provider will use the Resources extension
50
- const results = [];
51
- for (const tenant of await this.getTenants()) {
52
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
53
- const tenantId = tenant.tenantId;
54
- results.push(...await this.getSubscriptionsForTenant(tenantId));
55
- }
56
- const sortSubscriptions = (subscriptions) => subscriptions.sort((a, b) => a.name.localeCompare(b.name));
57
- return sortSubscriptions(results);
58
- }
59
- async isSignedIn() {
60
- return !!this._tokenCredential;
61
- }
62
- async signIn() {
63
- this._tokenCredential = await getTokenCredential(this._SERVICE_CONNECTION_ID, this._DOMAIN, this._CLIENT_ID);
64
- return !!this._tokenCredential;
65
- }
66
- async signOut() {
67
- this._tokenCredential = undefined;
68
- }
69
- async getTenants() {
70
- return [{
71
- tenantId: this._tokenCredential?.tenantId,
72
- account: {
73
- id: "test-account-id",
74
- label: "test-account",
75
- }
76
- }];
77
- }
78
- /**
79
- * Gets the subscriptions for a given tenant.
80
- *
81
- * @param tenantId The tenant ID to get subscriptions for.
82
- *
83
- * @returns The list of subscriptions for the tenant.
84
- */
85
- async getSubscriptionsForTenant(tenantId) {
86
- const { client, credential, authentication } = await this.getSubscriptionClient(tenantId);
87
- const environment = getConfiguredAzureEnv();
88
- const subscriptions = [];
89
- for await (const subscription of client.subscriptions.list()) {
90
- subscriptions.push({
91
- authentication,
92
- environment: environment,
93
- credential: credential,
94
- isCustomCloud: environment.isCustomCloud,
95
- /* eslint-disable @typescript-eslint/no-non-null-assertion */
96
- name: subscription.displayName,
97
- subscriptionId: subscription.subscriptionId,
98
- /* eslint-enable @typescript-eslint/no-non-null-assertion */
99
- tenantId,
100
- account: {
101
- id: "test-account-id",
102
- label: "test-account",
103
- },
104
- });
105
- }
106
- return subscriptions;
107
- }
108
- /**
109
- * Gets a fully-configured subscription client for a given tenant ID
110
- *
111
- * @param tenantId (Optional) The tenant ID to get a client for
112
- *
113
- * @returns A client, the credential used by the client, and the authentication function
114
- */
115
- async getSubscriptionClient(_tenantId, scopes) {
116
- const armSubs = await import('@azure/arm-resources-subscriptions');
117
- if (!this._tokenCredential) {
118
- throw new Error('Not signed in');
119
- }
120
- const accessToken = (await this._tokenCredential?.getToken("https://management.azure.com/.default"))?.token || '';
121
- const getSession = () => {
122
- return {
123
- accessToken,
124
- id: this._tokenCredential?.tenantId || '',
125
- account: {
126
- id: this._tokenCredential?.tenantId || '',
127
- label: this._tokenCredential?.tenantId || '',
128
- },
129
- tenantId: this._tokenCredential?.tenantId || '',
130
- scopes: scopes || [],
131
- };
132
- };
133
- return {
134
- client: new armSubs.SubscriptionClient(this._tokenCredential),
135
- credential: this._tokenCredential,
136
- authentication: {
137
- getSession,
138
- getSessionWithScopes: getSession,
139
- }
140
- };
141
- }
142
- onDidSignIn = () => { return { dispose() { } }; };
143
- onDidSignOut = () => { return { dispose() { } }; };
144
- }
145
- /*
146
- * @param serviceConnectionId The resource ID of the Azure DevOps federated service connection,
147
- * which can be found on the `resourceId` field of the URL at the address bar when viewing the service connection in the Azure DevOps portal
148
- * @param domain The `Tenant ID` field of the service connection properties
149
- * @param clientId The `Service Principal Id` field of the service connection properties
150
- */
151
- async function getTokenCredential(serviceConnectionId, domain, clientId) {
152
- if (!process.env.AGENT_BUILDDIRECTORY) {
153
- // Assume that AGENT_BUILDDIRECTORY is set if running in an Azure DevOps pipeline.
154
- // So when not running in an Azure DevOps pipeline, throw an error since we cannot use the DevOps federated service connection credential.
155
- throw new Error(`Cannot create DevOps federated service connection credential outside of an Azure DevOps pipeline.`);
156
- }
157
- else {
158
- console.log(`Creating DevOps federated service connection credential for service connection..`);
159
- // Pre-defined DevOps variable reference: https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops
160
- const systemAccessToken = process.env.SYSTEM_ACCESSTOKEN;
161
- const teamFoundationCollectionUri = process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI;
162
- const teamProjectId = process.env.SYSTEM_TEAMPROJECTID;
163
- const planId = process.env.SYSTEM_PLANID;
164
- const jobId = process.env.SYSTEM_JOBID;
165
- if (!systemAccessToken || !teamFoundationCollectionUri || !teamProjectId || !planId || !jobId) {
166
- throw new Error(`Azure DevOps environment variables are not set.\n
167
- process.env.SYSTEM_ACCESSTOKEN: ${process.env.SYSTEM_ACCESSTOKEN ? "✅" : "❌"}\n
168
- process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI: ${process.env.SYSTEM_TEAMFOUNDATIONCOLLECTIONURI ? "✅" : "❌"}\n
169
- process.env.SYSTEM_TEAMPROJECTID: ${process.env.SYSTEM_TEAMPROJECTID ? "✅" : "❌"}\n
170
- process.env.SYSTEM_PLANID: ${process.env.SYSTEM_PLANID ? "✅" : "❌"}\n
171
- process.env.SYSTEM_JOBID: ${process.env.SYSTEM_JOBID ? "✅" : "❌"}\n
172
- REMEMBER: process.env.SYSTEM_ACCESSTOKEN must be explicitly mapped!\n
173
- https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml#systemaccesstoken
174
- `);
175
- }
176
- const oidcRequestUrl = `${teamFoundationCollectionUri}${teamProjectId}/_apis/distributedtask/hubs/build/plans/${planId}/jobs/${jobId}/oidctoken?api-version=7.1-preview.1&serviceConnectionId=${serviceConnectionId}`;
177
- const { ClientAssertionCredential } = await import("@azure/identity");
178
- return new ClientAssertionCredential(domain, clientId, async () => await requestOidcToken(oidcRequestUrl, systemAccessToken));
179
- }
180
- }
181
- /**
182
- * API reference: https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/oidctoken/create
183
- */
184
- async function requestOidcToken(oidcRequestUrl, systemAccessToken) {
185
- const { ServiceClient } = await import('@azure/core-client');
186
- const { createHttpHeaders, createPipelineRequest } = await import('@azure/core-rest-pipeline');
187
- const genericClient = new ServiceClient();
188
- const request = createPipelineRequest({
189
- url: oidcRequestUrl,
190
- method: "POST",
191
- headers: createHttpHeaders({
192
- "Content-Type": "application/json",
193
- "Authorization": `Bearer ${systemAccessToken}`
194
- })
195
- });
196
- const response = await genericClient.sendRequest(request);
197
- const body = response.bodyAsText?.toString() || "";
198
- if (response.status !== 200) {
199
- throw new Error(`Failed to get OIDC token:\n
200
- Response status: ${response.status}\n
201
- Response body: ${body}\n
202
- Response headers: ${JSON.stringify(response.headers.toJSON())}
203
- `);
204
- }
205
- else {
206
- console.log(`Successfully got OIDC token with status ${response.status}`);
207
- }
208
- return JSON.parse(body).oidcToken;
209
- }
210
- //# sourceMappingURL=AzureDevOpsSubscriptionProvider.js.map
@@ -1,82 +0,0 @@
1
- import type * as vscode from 'vscode';
2
- import type { AzureSubscription } from './AzureSubscription';
3
- import type { AzureTenant } from './AzureTenant';
4
- /**
5
- * A filter for {@link AzureSubscriptionProvider.getSubscriptions}
6
- */
7
- export type GetSubscriptionsFilter = {
8
- /**
9
- * The account to get subscriptions for. If not provided, all accounts the extension
10
- * currently has access to are used.
11
- */
12
- account?: vscode.AuthenticationSessionAccountInformation;
13
- /**
14
- * The tenant to get subscriptions for. If not provided, all tenants for each account
15
- * are used.
16
- */
17
- tenantId?: string;
18
- };
19
- /**
20
- * An interface for obtaining Azure subscription information
21
- */
22
- export interface AzureSubscriptionProvider {
23
- /**
24
- * Gets a list of tenants available to the user.
25
- * Use {@link isSignedIn} to check if the user is signed in to a particular tenant.
26
- *
27
- * @param account - Optionally pass in a specific account to get tenants for.
28
- *
29
- * @returns A list of tenants.
30
- */
31
- getTenants(account?: vscode.AuthenticationSessionAccountInformation): Promise<AzureTenant[]>;
32
- /**
33
- * Gets a list of Azure subscriptions available to the user.
34
- *
35
- * @param filter - Whether to filter the list returned. When:
36
- * - `true`: according to the list returned by `getTenantFilters()` and `getSubscriptionFilters()`.
37
- * - `false`: return all subscriptions.
38
- * - `GetSubscriptionsFilter`: according to the values in the filter.
39
- *
40
- * Optional, default true.
41
- *
42
- * @returns A list of Azure subscriptions.
43
- *
44
- * @throws A {@link NotSignedInError} If the user is not signed in to Azure.
45
- * Use {@link isSignedIn} and/or {@link signIn} before this method to ensure
46
- * the user is signed in.
47
- */
48
- getSubscriptions(filter: boolean | GetSubscriptionsFilter): Promise<AzureSubscription[]>;
49
- /**
50
- * Checks to see if a user is signed in.
51
- *
52
- * @param tenantId (Optional) Provide to check if a user is signed in to a specific tenant.
53
- *
54
- * @returns True if the user is signed in, false otherwise.
55
- */
56
- isSignedIn(tenantId?: string, account?: vscode.AuthenticationSessionAccountInformation): Promise<boolean>;
57
- /**
58
- * Asks the user to sign in or pick an account to use.
59
- *
60
- * @param tenantId (Optional) Provide to sign in to a specific tenant.
61
- * @param account (Optional) Provide to sign in to a specific account.
62
- *
63
- * @returns True if the user is signed in, false otherwise.
64
- */
65
- signIn(tenantId?: string, account?: vscode.AuthenticationSessionAccountInformation): Promise<boolean>;
66
- /**
67
- * An event that is fired when the user signs in. Debounced to fire at most once every 5 seconds.
68
- */
69
- onDidSignIn: vscode.Event<void>;
70
- /**
71
- * Signs the user out
72
- *
73
- * @deprecated Not currently supported by VS Code auth providers
74
- *
75
- * @throws Throws an {@link Error} every time
76
- */
77
- signOut(): Promise<void>;
78
- /**
79
- * An event that is fired when the user signs out. Debounced to fire at most once every 5 seconds.
80
- */
81
- onDidSignOut: vscode.Event<void>;
82
- }
@@ -1,5 +0,0 @@
1
- import type { TenantIdDescription } from "@azure/arm-resources-subscriptions";
2
- import type * as vscode from 'vscode';
3
- export interface AzureTenant extends TenantIdDescription {
4
- account: vscode.AuthenticationSessionAccountInformation;
5
- }
@@ -1,112 +0,0 @@
1
- import * as vscode from 'vscode';
2
- import { AzureSubscription, SubscriptionId, TenantId } from './AzureSubscription';
3
- import type { AzureSubscriptionProvider, GetSubscriptionsFilter } from './AzureSubscriptionProvider';
4
- import type { AzureTenant } from './AzureTenant';
5
- /**
6
- * A class for obtaining Azure subscription information using VSCode's built-in authentication
7
- * provider.
8
- */
9
- export declare class VSCodeAzureSubscriptionProvider implements AzureSubscriptionProvider, vscode.Disposable {
10
- private readonly logger?;
11
- private lastSignInEventFired;
12
- private suppressSignInEvents;
13
- private lastSignOutEventFired;
14
- private priorAccounts;
15
- constructor(logger?: vscode.LogOutputChannel | undefined);
16
- onDidSignIn(callback: () => any, thisArg?: any, disposables?: vscode.Disposable[]): vscode.Disposable;
17
- onDidSignOut(callback: () => any, thisArg?: any, disposables?: vscode.Disposable[]): vscode.Disposable;
18
- private onDidChangeSessions;
19
- dispose(): void;
20
- /**
21
- * Gets a list of tenants available to the user.
22
- * Use {@link isSignedIn} to check if the user is signed in to a particular tenant.
23
- *
24
- * @param account (Optional) A specific account to get tenants for. If not provided, all accounts will be used.
25
- *
26
- * @returns A list of tenants.
27
- */
28
- getTenants(account?: vscode.AuthenticationSessionAccountInformation): Promise<AzureTenant[]>;
29
- /**
30
- * Gets a list of Azure subscriptions available to the user.
31
- *
32
- * @param filter - Whether to filter the list returned. When:
33
- * - `true`: according to the list returned by `getTenantFilters()` and `getSubscriptionFilters()`.
34
- * - `false`: return all subscriptions.
35
- * - `GetSubscriptionsFilter`: according to the values in the filter.
36
- *
37
- * Optional, default true.
38
- *
39
- * @returns A list of Azure subscriptions. The list is sorted by subscription name.
40
- * The list can contain duplicate subscriptions if they come from different accounts.
41
- *
42
- * @throws A {@link NotSignedInError} If the user is not signed in to Azure.
43
- * Use {@link isSignedIn} and/or {@link signIn} before this method to ensure
44
- * the user is signed in.
45
- */
46
- getSubscriptions(filter?: boolean | GetSubscriptionsFilter): Promise<AzureSubscription[]>;
47
- /**
48
- * Checks to see if a user is signed in.
49
- *
50
- * @param tenantId (Optional) Provide to check if a user is signed in to a specific tenant.
51
- * @param account (Optional) Provide to check if a user is signed in to a specific account.
52
- *
53
- * @returns True if the user is signed in, false otherwise.
54
- *
55
- * If no tenant or account is provided, then
56
- * checks all accounts for a session.
57
- */
58
- isSignedIn(tenantId?: string, account?: vscode.AuthenticationSessionAccountInformation): Promise<boolean>;
59
- /**
60
- * Asks the user to sign in or pick an account to use.
61
- *
62
- * @param tenantId (Optional) Provide to sign in to a specific tenant.
63
- * @param account (Optional) Provide to sign in to a specific account.
64
- *
65
- * @returns True if the user is signed in, false otherwise.
66
- */
67
- signIn(tenantId?: string, account?: vscode.AuthenticationSessionAccountInformation): Promise<boolean>;
68
- /**
69
- * Signs the user out
70
- *
71
- * @deprecated Not currently supported by VS Code auth providers
72
- */
73
- signOut(): Promise<void>;
74
- /**
75
- * Gets the tenant filters that are configured in `azureResourceGroups.selectedSubscriptions`. To
76
- * override the settings with a custom filter, implement a child class with `getSubscriptionFilters()`
77
- * and/or `getTenantFilters()` overridden.
78
- *
79
- * If no values are returned by `getTenantFilters()`, then all tenants will be scanned for subscriptions.
80
- *
81
- * @returns A list of tenant IDs that are configured in `azureResourceGroups.selectedSubscriptions`.
82
- */
83
- protected getTenantFilters(): Promise<TenantId[]>;
84
- /**
85
- * Gets the subscription filters that are configured in `azureResourceGroups.selectedSubscriptions`. To
86
- * override the settings with a custom filter, implement a child class with `getSubscriptionFilters()`
87
- * and/or `getTenantFilters()` overridden.
88
- *
89
- * If no values are returned by `getSubscriptionFilters()`, then all subscriptions will be returned.
90
- *
91
- * @returns A list of subscription IDs that are configured in `azureResourceGroups.selectedSubscriptions`.
92
- */
93
- protected getSubscriptionFilters(): Promise<SubscriptionId[]>;
94
- /**
95
- * Gets the subscriptions for a given tenant.
96
- *
97
- * @param tenantId The tenant ID to get subscriptions for.
98
- * @param account The account to get the subscriptions for.
99
- *
100
- * @returns The list of subscriptions for the tenant.
101
- */
102
- private getSubscriptionsForTenant;
103
- /**
104
- * Gets a fully-configured subscription client for a given tenant ID
105
- *
106
- * @param tenantId (Optional) The tenant ID to get a client for
107
- * @param account The account that you would like to get the session for
108
- *
109
- * @returns A client, the credential used by the client, and the authentication function
110
- */
111
- private getSubscriptionClient;
112
- }