@microsoft/vscode-azext-azureauth 1.2.1 → 1.3.0
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.
- package/CHANGELOG.md +31 -0
- package/out/src/VSCodeAzureSubscriptionProvider.d.ts +0 -18
- package/out/src/VSCodeAzureSubscriptionProvider.js +7 -44
- package/out/src/getSessionFromVSCode.d.ts +12 -0
- package/out/src/getSessionFromVSCode.js +62 -0
- package/out/src/index.d.ts +2 -0
- package/out/src/index.js +2 -0
- package/out/src/signInToTenant.d.ts +6 -0
- package/out/src/signInToTenant.js +57 -0
- package/out/src/utils/getUnauthenticatedTenants.d.ts +6 -0
- package/out/src/utils/getUnauthenticatedTenants.js +58 -0
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## 1.3.0 - 2023-10-23
|
|
4
|
+
|
|
5
|
+
* [#1610](https://github.com/microsoft/vscode-azuretools/pull/1610) Add `signInToTenant` command which facilitates signing in to a specific tenant.
|
|
6
|
+
* [#1610](https://github.com/microsoft/vscode-azuretools/pull/1610) Add `getUnauthenticatedTenants` utility.
|
|
7
|
+
|
|
8
|
+
## 1.2.2 - 2023-10-19
|
|
9
|
+
|
|
10
|
+
* [#1608](https://github.com/microsoft/vscode-azuretools/pull/1608) Fix appending `.default` to tenant id scope which caused sign in to fail
|
|
11
|
+
|
|
12
|
+
## 1.2.1 - 2023-09-26
|
|
13
|
+
|
|
14
|
+
* [#1594](https://github.com/microsoft/vscode-azuretools/pull/1594) Fix getScopes always injecting the management scope, even if a scope for a different resource is specified
|
|
15
|
+
* [#1597](https://github.com/microsoft/vscode-azuretools/pull/1597) Make `authentication.getSession` use scopes argument
|
|
16
|
+
|
|
17
|
+
## 1.1.3 - 2023-09-14
|
|
18
|
+
|
|
19
|
+
* [#1585](https://github.com/microsoft/vscode-azuretools/pull/1585) Check if tenant is signed in before listing subscriptions
|
|
20
|
+
|
|
21
|
+
## 1.1.2 - 2023-07-26
|
|
22
|
+
|
|
23
|
+
* [#1542](https://github.com/microsoft/vscode-azuretools/pull/1542) Fix Azure subscriptions are not returned in alphabetical order
|
|
24
|
+
|
|
25
|
+
## 1.1.1 - 2023-07-26
|
|
26
|
+
|
|
27
|
+
* [#1540](https://github.com/microsoft/vscode-azuretools/pull/1540) Ignore .default if it is passed as a scope
|
|
28
|
+
|
|
29
|
+
## 1.0.0 - 2023-06-05
|
|
30
|
+
|
|
31
|
+
Initial release
|
|
@@ -100,22 +100,4 @@ export declare class VSCodeAzureSubscriptionProvider extends vscode.Disposable i
|
|
|
100
100
|
*/
|
|
101
101
|
private getSubscriptionClient;
|
|
102
102
|
private getToken;
|
|
103
|
-
/**
|
|
104
|
-
* Gets a normalized list of scopes. If no scopes are provided, the return value of {@link getDefaultScope} is used.
|
|
105
|
-
*
|
|
106
|
-
* Only supports top-level resource scopes (e.g. http://management.azure.com, http://storage.azure.com) or .default scopes.
|
|
107
|
-
*
|
|
108
|
-
* All resources/scopes will be normalized to the `.default` scope for each resource.
|
|
109
|
-
*
|
|
110
|
-
* @param scopes An input scope string, list, or undefined
|
|
111
|
-
* @param tenantId (Optional) The tenant ID, will be added to the scopes
|
|
112
|
-
*/
|
|
113
|
-
private getScopes;
|
|
114
|
-
/**
|
|
115
|
-
* Gets the default Azure scopes required for resource management,
|
|
116
|
-
* depending on the configured endpoint
|
|
117
|
-
*
|
|
118
|
-
* @returns The default Azure scopes required
|
|
119
|
-
*/
|
|
120
|
-
private getDefaultScope;
|
|
121
103
|
}
|
|
@@ -24,6 +24,7 @@ exports.VSCodeAzureSubscriptionProvider = void 0;
|
|
|
24
24
|
const cross_fetch_1 = require("cross-fetch");
|
|
25
25
|
const vscode = require("vscode");
|
|
26
26
|
const NotSignedInError_1 = require("./NotSignedInError");
|
|
27
|
+
const getSessionFromVSCode_1 = require("./getSessionFromVSCode");
|
|
27
28
|
const configuredAzureEnv_1 = require("./utils/configuredAzureEnv");
|
|
28
29
|
const EventDebounce = 5 * 1000; // 5 seconds
|
|
29
30
|
/**
|
|
@@ -141,7 +142,7 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
141
142
|
*/
|
|
142
143
|
isSignedIn(tenantId) {
|
|
143
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
const session = yield
|
|
145
|
+
const session = yield (0, getSessionFromVSCode_1.getSessionFromVSCode)([], tenantId, { createIfNone: false, silent: true });
|
|
145
146
|
return !!session;
|
|
146
147
|
});
|
|
147
148
|
}
|
|
@@ -154,7 +155,7 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
154
155
|
*/
|
|
155
156
|
signIn(tenantId) {
|
|
156
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
-
const session = yield
|
|
158
|
+
const session = yield (0, getSessionFromVSCode_1.getSessionFromVSCode)([], tenantId, { createIfNone: true, clearSessionPreference: true });
|
|
158
159
|
return !!session;
|
|
159
160
|
});
|
|
160
161
|
}
|
|
@@ -255,7 +256,7 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
255
256
|
return __awaiter(this, void 0, void 0, function* () {
|
|
256
257
|
const armSubs = yield Promise.resolve().then(() => require('@azure/arm-subscriptions'));
|
|
257
258
|
const getSession = (scopes) => __awaiter(this, void 0, void 0, function* () {
|
|
258
|
-
const session = yield
|
|
259
|
+
const session = yield (0, getSessionFromVSCode_1.getSessionFromVSCode)(scopes, tenantId, { createIfNone: false, silent: true });
|
|
259
260
|
if (!session) {
|
|
260
261
|
throw new NotSignedInError_1.NotSignedInError();
|
|
261
262
|
}
|
|
@@ -264,7 +265,7 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
264
265
|
const credential = {
|
|
265
266
|
getToken: (scopes) => __awaiter(this, void 0, void 0, function* () {
|
|
266
267
|
return {
|
|
267
|
-
token: (yield getSession(
|
|
268
|
+
token: (yield getSession(scopes)).accessToken,
|
|
268
269
|
expiresOnTimestamp: 0
|
|
269
270
|
};
|
|
270
271
|
})
|
|
@@ -273,58 +274,20 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
273
274
|
client: new armSubs.SubscriptionClient(credential),
|
|
274
275
|
credential: credential,
|
|
275
276
|
authentication: {
|
|
276
|
-
getSession
|
|
277
|
+
getSession,
|
|
277
278
|
}
|
|
278
279
|
};
|
|
279
280
|
});
|
|
280
281
|
}
|
|
281
282
|
getToken(tenantId) {
|
|
282
283
|
return __awaiter(this, void 0, void 0, function* () {
|
|
283
|
-
const session = yield
|
|
284
|
+
const session = yield (0, getSessionFromVSCode_1.getSessionFromVSCode)([], tenantId, { createIfNone: false, silent: true });
|
|
284
285
|
if (!session) {
|
|
285
286
|
throw new NotSignedInError_1.NotSignedInError();
|
|
286
287
|
}
|
|
287
288
|
return session.accessToken;
|
|
288
289
|
});
|
|
289
290
|
}
|
|
290
|
-
/**
|
|
291
|
-
* Gets a normalized list of scopes. If no scopes are provided, the return value of {@link getDefaultScope} is used.
|
|
292
|
-
*
|
|
293
|
-
* Only supports top-level resource scopes (e.g. http://management.azure.com, http://storage.azure.com) or .default scopes.
|
|
294
|
-
*
|
|
295
|
-
* All resources/scopes will be normalized to the `.default` scope for each resource.
|
|
296
|
-
*
|
|
297
|
-
* @param scopes An input scope string, list, or undefined
|
|
298
|
-
* @param tenantId (Optional) The tenant ID, will be added to the scopes
|
|
299
|
-
*/
|
|
300
|
-
getScopes(scopes, tenantId) {
|
|
301
|
-
if (scopes === undefined || scopes === "" || scopes.length === 0) {
|
|
302
|
-
scopes = this.getDefaultScope();
|
|
303
|
-
}
|
|
304
|
-
const arrScopes = (Array.isArray(scopes) ? scopes : [scopes])
|
|
305
|
-
.map((scope) => {
|
|
306
|
-
if (scope.endsWith('.default')) {
|
|
307
|
-
return scope;
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
return `${scope}.default`;
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
const scopeSet = new Set(arrScopes);
|
|
314
|
-
if (tenantId) {
|
|
315
|
-
scopeSet.add(`VSCODE_TENANT:${tenantId}`);
|
|
316
|
-
}
|
|
317
|
-
return Array.from(scopeSet);
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Gets the default Azure scopes required for resource management,
|
|
321
|
-
* depending on the configured endpoint
|
|
322
|
-
*
|
|
323
|
-
* @returns The default Azure scopes required
|
|
324
|
-
*/
|
|
325
|
-
getDefaultScope() {
|
|
326
|
-
return `${(0, configuredAzureEnv_1.getConfiguredAzureEnv)().resourceManagerEndpointUrl}.default`;
|
|
327
|
-
}
|
|
328
291
|
}
|
|
329
292
|
exports.VSCodeAzureSubscriptionProvider = VSCodeAzureSubscriptionProvider;
|
|
330
293
|
//# sourceMappingURL=VSCodeAzureSubscriptionProvider.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as vscode from "vscode";
|
|
2
|
+
/**
|
|
3
|
+
* Wraps {@link vscode.authentication.getSession} and handles:
|
|
4
|
+
* * Passing the configured auth provider id
|
|
5
|
+
* * Getting the list of scopes, adding the tenant id to the scope list if needed
|
|
6
|
+
*
|
|
7
|
+
* @param scopes - top-level resource scopes (e.g. http://management.azure.com, http://storage.azure.com) or .default scopes. All resources/scopes will be normalized to the `.default` scope for each resource.
|
|
8
|
+
* @param tenantId - (Optional) The tenant ID, will be added to the scopes
|
|
9
|
+
* @param options - see {@link vscode.AuthenticationGetSessionOptions}
|
|
10
|
+
* @returns An authentication session if available, or undefined if there are no sessions
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSessionFromVSCode(scopes?: string | string[], tenantId?: string, options?: vscode.AuthenticationGetSessionOptions): Promise<vscode.AuthenticationSession | undefined>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.getSessionFromVSCode = void 0;
|
|
17
|
+
const configuredAzureEnv_1 = require("./utils/configuredAzureEnv");
|
|
18
|
+
const vscode = require("vscode");
|
|
19
|
+
function getResourceScopes(scopes) {
|
|
20
|
+
if (scopes === undefined || scopes === "" || scopes.length === 0) {
|
|
21
|
+
scopes = `${(0, configuredAzureEnv_1.getConfiguredAzureEnv)().resourceManagerEndpointUrl}.default`;
|
|
22
|
+
}
|
|
23
|
+
const arrScopes = (Array.isArray(scopes) ? scopes : [scopes])
|
|
24
|
+
.map((scope) => {
|
|
25
|
+
if (scope.endsWith('.default')) {
|
|
26
|
+
return scope;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return `${scope}.default`;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return Array.from(new Set(arrScopes));
|
|
33
|
+
}
|
|
34
|
+
function addTenantIdScope(scopes, tenantId) {
|
|
35
|
+
const scopeSet = new Set(scopes);
|
|
36
|
+
scopeSet.add(`VSCODE_TENANT:${tenantId}`);
|
|
37
|
+
return Array.from(scopeSet);
|
|
38
|
+
}
|
|
39
|
+
function getScopes(scopes, tenantId) {
|
|
40
|
+
let scopeArr = getResourceScopes(scopes);
|
|
41
|
+
if (tenantId) {
|
|
42
|
+
scopeArr = addTenantIdScope(scopeArr, tenantId);
|
|
43
|
+
}
|
|
44
|
+
return scopeArr;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Wraps {@link vscode.authentication.getSession} and handles:
|
|
48
|
+
* * Passing the configured auth provider id
|
|
49
|
+
* * Getting the list of scopes, adding the tenant id to the scope list if needed
|
|
50
|
+
*
|
|
51
|
+
* @param scopes - top-level resource scopes (e.g. http://management.azure.com, http://storage.azure.com) or .default scopes. All resources/scopes will be normalized to the `.default` scope for each resource.
|
|
52
|
+
* @param tenantId - (Optional) The tenant ID, will be added to the scopes
|
|
53
|
+
* @param options - see {@link vscode.AuthenticationGetSessionOptions}
|
|
54
|
+
* @returns An authentication session if available, or undefined if there are no sessions
|
|
55
|
+
*/
|
|
56
|
+
function getSessionFromVSCode(scopes, tenantId, options) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return yield vscode.authentication.getSession((0, configuredAzureEnv_1.getConfiguredAuthProviderId)(), getScopes(scopes, tenantId), options);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
exports.getSessionFromVSCode = getSessionFromVSCode;
|
|
62
|
+
//# sourceMappingURL=getSessionFromVSCode.js.map
|
package/out/src/index.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ export * from './AzureSubscription';
|
|
|
3
3
|
export * from './AzureSubscriptionProvider';
|
|
4
4
|
export * from './NotSignedInError';
|
|
5
5
|
export * from './utils/configuredAzureEnv';
|
|
6
|
+
export * from './utils/getUnauthenticatedTenants';
|
|
6
7
|
export * from './VSCodeAzureSubscriptionProvider';
|
|
8
|
+
export * from './signInToTenant';
|
package/out/src/index.js
CHANGED
|
@@ -23,5 +23,7 @@ __exportStar(require("./AzureSubscription"), exports);
|
|
|
23
23
|
__exportStar(require("./AzureSubscriptionProvider"), exports);
|
|
24
24
|
__exportStar(require("./NotSignedInError"), exports);
|
|
25
25
|
__exportStar(require("./utils/configuredAzureEnv"), exports);
|
|
26
|
+
__exportStar(require("./utils/getUnauthenticatedTenants"), exports);
|
|
26
27
|
__exportStar(require("./VSCodeAzureSubscriptionProvider"), exports);
|
|
28
|
+
__exportStar(require("./signInToTenant"), exports);
|
|
27
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AzureSubscriptionProvider } from "./AzureSubscriptionProvider";
|
|
2
|
+
/**
|
|
3
|
+
* Prompts user to select from a list of unauthenticated tenants.
|
|
4
|
+
* Once selected, requests a new session from VS Code specifially for this tenant.
|
|
5
|
+
*/
|
|
6
|
+
export declare function signInToTenant(subscriptionProvider: AzureSubscriptionProvider): Promise<void>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.signInToTenant = void 0;
|
|
17
|
+
const vscode = require("vscode");
|
|
18
|
+
const getUnauthenticatedTenants_1 = require("./utils/getUnauthenticatedTenants");
|
|
19
|
+
/**
|
|
20
|
+
* Prompts user to select from a list of unauthenticated tenants.
|
|
21
|
+
* Once selected, requests a new session from VS Code specifially for this tenant.
|
|
22
|
+
*/
|
|
23
|
+
function signInToTenant(subscriptionProvider) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const tenantId = yield pickTenant(subscriptionProvider);
|
|
26
|
+
if (tenantId) {
|
|
27
|
+
yield subscriptionProvider.signIn(tenantId);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.signInToTenant = signInToTenant;
|
|
32
|
+
function pickTenant(subscriptionProvider) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const pick = yield vscode.window.showQuickPick(getPicks(subscriptionProvider), {
|
|
35
|
+
placeHolder: 'Select Directory to Sign In To',
|
|
36
|
+
matchOnDescription: true,
|
|
37
|
+
ignoreFocusOut: true,
|
|
38
|
+
});
|
|
39
|
+
return pick === null || pick === void 0 ? void 0 : pick.tenant.tenantId;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function getPicks(subscriptionProvider) {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const unauthenticatedTenants = yield (0, getUnauthenticatedTenants_1.getUnauthenticatedTenants)(subscriptionProvider);
|
|
45
|
+
const picks = unauthenticatedTenants.map(tenant => {
|
|
46
|
+
var _a, _b, _c;
|
|
47
|
+
return ({
|
|
48
|
+
label: (_a = tenant.displayName) !== null && _a !== void 0 ? _a : '',
|
|
49
|
+
description: (_b = tenant.tenantId) !== null && _b !== void 0 ? _b : '',
|
|
50
|
+
detail: (_c = tenant.defaultDomain) !== null && _c !== void 0 ? _c : '',
|
|
51
|
+
tenant,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
return picks;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=signInToTenant.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TenantIdDescription } from "@azure/arm-subscriptions";
|
|
2
|
+
import type { AzureSubscriptionProvider } from "../AzureSubscriptionProvider";
|
|
3
|
+
/**
|
|
4
|
+
* @returns list of tenants that VS Code doesn't have sessions for
|
|
5
|
+
*/
|
|
6
|
+
export declare function getUnauthenticatedTenants(subscriptionProvider: AzureSubscriptionProvider): Promise<TenantIdDescription[]>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
8
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
9
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
10
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
11
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
12
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
16
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
17
|
+
var m = o[Symbol.asyncIterator], i;
|
|
18
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
19
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
20
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.getUnauthenticatedTenants = void 0;
|
|
24
|
+
/**
|
|
25
|
+
* @returns list of tenants that VS Code doesn't have sessions for
|
|
26
|
+
*/
|
|
27
|
+
function getUnauthenticatedTenants(subscriptionProvider) {
|
|
28
|
+
var _a, e_1, _b, _c;
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const tenants = yield subscriptionProvider.getTenants();
|
|
31
|
+
const unauthenticatedTenants = [];
|
|
32
|
+
try {
|
|
33
|
+
for (var _d = true, tenants_1 = __asyncValues(tenants), tenants_1_1; tenants_1_1 = yield tenants_1.next(), _a = tenants_1_1.done, !_a;) {
|
|
34
|
+
_c = tenants_1_1.value;
|
|
35
|
+
_d = false;
|
|
36
|
+
try {
|
|
37
|
+
const tenant = _c;
|
|
38
|
+
if (!(yield subscriptionProvider.isSignedIn(tenant.tenantId))) {
|
|
39
|
+
unauthenticatedTenants.push(tenant);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
_d = true;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
48
|
+
finally {
|
|
49
|
+
try {
|
|
50
|
+
if (!_d && !_a && (_b = tenants_1.return)) yield _b.call(tenants_1);
|
|
51
|
+
}
|
|
52
|
+
finally { if (e_1) throw e_1.error; }
|
|
53
|
+
}
|
|
54
|
+
return unauthenticatedTenants;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
exports.getUnauthenticatedTenants = getUnauthenticatedTenants;
|
|
58
|
+
//# sourceMappingURL=getUnauthenticatedTenants.js.map
|