@microsoft/vscode-azext-azureauth 2.3.0 → 2.4.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 +34 -34
- package/LICENSE.md +21 -21
- package/README.md +111 -111
- package/out/src/AzureAuthentication.d.ts +14 -14
- package/out/src/AzureAuthentication.js +6 -6
- package/out/src/AzureDevOpsSubscriptionProvider.d.ts +52 -0
- package/out/src/AzureDevOpsSubscriptionProvider.js +249 -0
- package/out/src/AzureSubscription.d.ts +44 -44
- package/out/src/AzureSubscription.js +6 -6
- package/out/src/AzureSubscriptionProvider.d.ts +60 -60
- package/out/src/AzureSubscriptionProvider.js +6 -6
- package/out/src/NotSignedInError.d.ts +15 -15
- package/out/src/NotSignedInError.js +29 -29
- package/out/src/VSCodeAzureSubscriptionProvider.d.ts +102 -102
- package/out/src/VSCodeAzureSubscriptionProvider.js +296 -296
- package/out/src/getSessionFromVSCode.d.ts +12 -12
- package/out/src/getSessionFromVSCode.js +64 -64
- package/out/src/index.d.ts +9 -8
- package/out/src/index.js +29 -28
- package/out/src/signInToTenant.d.ts +6 -6
- package/out/src/signInToTenant.js +56 -56
- package/out/src/utils/configuredAzureEnv.d.ts +24 -24
- package/out/src/utils/configuredAzureEnv.js +94 -94
- package/out/src/utils/getUnauthenticatedTenants.d.ts +6 -6
- package/out/src/utils/getUnauthenticatedTenants.js +57 -57
- package/package.json +61 -58
|
@@ -1,65 +1,65 @@
|
|
|
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 ensureEndingSlash(value) {
|
|
20
|
-
return value.endsWith('/') ? value : `${value}/`;
|
|
21
|
-
}
|
|
22
|
-
function getResourceScopes(scopes) {
|
|
23
|
-
if (scopes === undefined || scopes === "" || scopes.length === 0) {
|
|
24
|
-
scopes = ensureEndingSlash((0, configuredAzureEnv_1.getConfiguredAzureEnv)().managementEndpointUrl);
|
|
25
|
-
}
|
|
26
|
-
const arrScopes = (Array.isArray(scopes) ? scopes : [scopes])
|
|
27
|
-
.map((scope) => {
|
|
28
|
-
if (scope.endsWith('.default')) {
|
|
29
|
-
return scope;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
return `${scope}.default`;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
return Array.from(new Set(arrScopes));
|
|
36
|
-
}
|
|
37
|
-
function addTenantIdScope(scopes, tenantId) {
|
|
38
|
-
const scopeSet = new Set(scopes);
|
|
39
|
-
scopeSet.add(`VSCODE_TENANT:${tenantId}`);
|
|
40
|
-
return Array.from(scopeSet);
|
|
41
|
-
}
|
|
42
|
-
function getScopes(scopes, tenantId) {
|
|
43
|
-
let scopeArr = getResourceScopes(scopes);
|
|
44
|
-
if (tenantId) {
|
|
45
|
-
scopeArr = addTenantIdScope(scopeArr, tenantId);
|
|
46
|
-
}
|
|
47
|
-
return scopeArr;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Wraps {@link vscode.authentication.getSession} and handles:
|
|
51
|
-
* * Passing the configured auth provider id
|
|
52
|
-
* * Getting the list of scopes, adding the tenant id to the scope list if needed
|
|
53
|
-
*
|
|
54
|
-
* @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.
|
|
55
|
-
* @param tenantId - (Optional) The tenant ID, will be added to the scopes
|
|
56
|
-
* @param options - see {@link vscode.AuthenticationGetSessionOptions}
|
|
57
|
-
* @returns An authentication session if available, or undefined if there are no sessions
|
|
58
|
-
*/
|
|
59
|
-
function getSessionFromVSCode(scopes, tenantId, options) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
return yield vscode.authentication.getSession((0, configuredAzureEnv_1.getConfiguredAuthProviderId)(), getScopes(scopes, tenantId), options);
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
exports.getSessionFromVSCode = getSessionFromVSCode;
|
|
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 ensureEndingSlash(value) {
|
|
20
|
+
return value.endsWith('/') ? value : `${value}/`;
|
|
21
|
+
}
|
|
22
|
+
function getResourceScopes(scopes) {
|
|
23
|
+
if (scopes === undefined || scopes === "" || scopes.length === 0) {
|
|
24
|
+
scopes = ensureEndingSlash((0, configuredAzureEnv_1.getConfiguredAzureEnv)().managementEndpointUrl);
|
|
25
|
+
}
|
|
26
|
+
const arrScopes = (Array.isArray(scopes) ? scopes : [scopes])
|
|
27
|
+
.map((scope) => {
|
|
28
|
+
if (scope.endsWith('.default')) {
|
|
29
|
+
return scope;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return `${scope}.default`;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return Array.from(new Set(arrScopes));
|
|
36
|
+
}
|
|
37
|
+
function addTenantIdScope(scopes, tenantId) {
|
|
38
|
+
const scopeSet = new Set(scopes);
|
|
39
|
+
scopeSet.add(`VSCODE_TENANT:${tenantId}`);
|
|
40
|
+
return Array.from(scopeSet);
|
|
41
|
+
}
|
|
42
|
+
function getScopes(scopes, tenantId) {
|
|
43
|
+
let scopeArr = getResourceScopes(scopes);
|
|
44
|
+
if (tenantId) {
|
|
45
|
+
scopeArr = addTenantIdScope(scopeArr, tenantId);
|
|
46
|
+
}
|
|
47
|
+
return scopeArr;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Wraps {@link vscode.authentication.getSession} and handles:
|
|
51
|
+
* * Passing the configured auth provider id
|
|
52
|
+
* * Getting the list of scopes, adding the tenant id to the scope list if needed
|
|
53
|
+
*
|
|
54
|
+
* @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.
|
|
55
|
+
* @param tenantId - (Optional) The tenant ID, will be added to the scopes
|
|
56
|
+
* @param options - see {@link vscode.AuthenticationGetSessionOptions}
|
|
57
|
+
* @returns An authentication session if available, or undefined if there are no sessions
|
|
58
|
+
*/
|
|
59
|
+
function getSessionFromVSCode(scopes, tenantId, options) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
return yield vscode.authentication.getSession((0, configuredAzureEnv_1.getConfiguredAuthProviderId)(), getScopes(scopes, tenantId), options);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
exports.getSessionFromVSCode = getSessionFromVSCode;
|
|
65
65
|
//# sourceMappingURL=getSessionFromVSCode.js.map
|
package/out/src/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export * from './AzureAuthentication';
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
1
|
+
export * from './AzureAuthentication';
|
|
2
|
+
export * from './AzureDevOpsSubscriptionProvider';
|
|
3
|
+
export * from './AzureSubscription';
|
|
4
|
+
export * from './AzureSubscriptionProvider';
|
|
5
|
+
export * from './NotSignedInError';
|
|
6
|
+
export * from './signInToTenant';
|
|
7
|
+
export * from './utils/configuredAzureEnv';
|
|
8
|
+
export * from './utils/getUnauthenticatedTenants';
|
|
9
|
+
export * from './VSCodeAzureSubscriptionProvider';
|
package/out/src/index.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
__exportStar(require("./AzureAuthentication"), exports);
|
|
22
|
-
__exportStar(require("./
|
|
23
|
-
__exportStar(require("./
|
|
24
|
-
__exportStar(require("./
|
|
25
|
-
__exportStar(require("./
|
|
26
|
-
__exportStar(require("./
|
|
27
|
-
__exportStar(require("./
|
|
28
|
-
__exportStar(require("./
|
|
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
__exportStar(require("./AzureAuthentication"), exports);
|
|
22
|
+
__exportStar(require("./AzureDevOpsSubscriptionProvider"), exports);
|
|
23
|
+
__exportStar(require("./AzureSubscription"), exports);
|
|
24
|
+
__exportStar(require("./AzureSubscriptionProvider"), exports);
|
|
25
|
+
__exportStar(require("./NotSignedInError"), exports);
|
|
26
|
+
__exportStar(require("./signInToTenant"), exports);
|
|
27
|
+
__exportStar(require("./utils/configuredAzureEnv"), exports);
|
|
28
|
+
__exportStar(require("./utils/getUnauthenticatedTenants"), exports);
|
|
29
|
+
__exportStar(require("./VSCodeAzureSubscriptionProvider"), exports);
|
|
29
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +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>;
|
|
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>;
|
|
@@ -1,57 +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
|
-
}
|
|
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
57
|
//# sourceMappingURL=signInToTenant.js.map
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import * as azureEnv from '@azure/ms-rest-azure-env';
|
|
2
|
-
import * as vscode from 'vscode';
|
|
3
|
-
/**
|
|
4
|
-
* Gets the configured Azure environment.
|
|
5
|
-
*
|
|
6
|
-
* @returns The configured Azure environment from the settings in the built-in authentication provider extension
|
|
7
|
-
*/
|
|
8
|
-
export declare function getConfiguredAzureEnv(): azureEnv.Environment & {
|
|
9
|
-
isCustomCloud: boolean;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Sets the configured Azure cloud.
|
|
13
|
-
*
|
|
14
|
-
* @param cloud Use `'AzureCloud'` or `undefined` for public Azure cloud, `'ChinaCloud'` for Azure China, or `'USGovernment'` for Azure US Government.
|
|
15
|
-
* These are the same values as the cloud names in `@azure/ms-rest-azure-env`. For a custom cloud, use an instance of the `@azure/ms-rest-azure-env` {@link azureEnv.EnvironmentParameters}.
|
|
16
|
-
*
|
|
17
|
-
* @param target (Optional) The configuration target to use, by default {@link vscode.ConfigurationTarget.Global}.
|
|
18
|
-
*/
|
|
19
|
-
export declare function setConfiguredAzureEnv(cloud: 'AzureCloud' | 'ChinaCloud' | 'USGovernment' | undefined | azureEnv.EnvironmentParameters, target?: vscode.ConfigurationTarget): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Gets the ID of the authentication provider configured to be used
|
|
22
|
-
* @returns The provider ID to use, either `'microsoft'` or `'microsoft-sovereign-cloud'`
|
|
23
|
-
*/
|
|
24
|
-
export declare function getConfiguredAuthProviderId(): string;
|
|
1
|
+
import * as azureEnv from '@azure/ms-rest-azure-env';
|
|
2
|
+
import * as vscode from 'vscode';
|
|
3
|
+
/**
|
|
4
|
+
* Gets the configured Azure environment.
|
|
5
|
+
*
|
|
6
|
+
* @returns The configured Azure environment from the settings in the built-in authentication provider extension
|
|
7
|
+
*/
|
|
8
|
+
export declare function getConfiguredAzureEnv(): azureEnv.Environment & {
|
|
9
|
+
isCustomCloud: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Sets the configured Azure cloud.
|
|
13
|
+
*
|
|
14
|
+
* @param cloud Use `'AzureCloud'` or `undefined` for public Azure cloud, `'ChinaCloud'` for Azure China, or `'USGovernment'` for Azure US Government.
|
|
15
|
+
* These are the same values as the cloud names in `@azure/ms-rest-azure-env`. For a custom cloud, use an instance of the `@azure/ms-rest-azure-env` {@link azureEnv.EnvironmentParameters}.
|
|
16
|
+
*
|
|
17
|
+
* @param target (Optional) The configuration target to use, by default {@link vscode.ConfigurationTarget.Global}.
|
|
18
|
+
*/
|
|
19
|
+
export declare function setConfiguredAzureEnv(cloud: 'AzureCloud' | 'ChinaCloud' | 'USGovernment' | undefined | azureEnv.EnvironmentParameters, target?: vscode.ConfigurationTarget): Promise<void>;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the ID of the authentication provider configured to be used
|
|
22
|
+
* @returns The provider ID to use, either `'microsoft'` or `'microsoft-sovereign-cloud'`
|
|
23
|
+
*/
|
|
24
|
+
export declare function getConfiguredAuthProviderId(): string;
|
|
@@ -1,95 +1,95 @@
|
|
|
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.getConfiguredAuthProviderId = exports.setConfiguredAzureEnv = exports.getConfiguredAzureEnv = void 0;
|
|
17
|
-
const azureEnv = require("@azure/ms-rest-azure-env"); // This package is so small that it's not worth lazy loading
|
|
18
|
-
const vscode = require("vscode");
|
|
19
|
-
// These strings come from https://github.com/microsoft/vscode/blob/eac16e9b63a11885b538db3e0b533a02a2fb8143/extensions/microsoft-authentication/package.json#L40-L99
|
|
20
|
-
const CustomCloudConfigurationSection = 'microsoft-sovereign-cloud';
|
|
21
|
-
const CloudEnvironmentSettingName = 'environment';
|
|
22
|
-
const CustomEnvironmentSettingName = 'customEnvironment';
|
|
23
|
-
var CloudEnvironmentSettingValue;
|
|
24
|
-
(function (CloudEnvironmentSettingValue) {
|
|
25
|
-
CloudEnvironmentSettingValue["ChinaCloud"] = "ChinaCloud";
|
|
26
|
-
CloudEnvironmentSettingValue["USGovernment"] = "USGovernment";
|
|
27
|
-
CloudEnvironmentSettingValue["Custom"] = "custom";
|
|
28
|
-
})(CloudEnvironmentSettingValue || (CloudEnvironmentSettingValue = {}));
|
|
29
|
-
/**
|
|
30
|
-
* Gets the configured Azure environment.
|
|
31
|
-
*
|
|
32
|
-
* @returns The configured Azure environment from the settings in the built-in authentication provider extension
|
|
33
|
-
*/
|
|
34
|
-
function getConfiguredAzureEnv() {
|
|
35
|
-
const authProviderConfig = vscode.workspace.getConfiguration(CustomCloudConfigurationSection);
|
|
36
|
-
const environmentSettingValue = authProviderConfig.get(CloudEnvironmentSettingName);
|
|
37
|
-
if (environmentSettingValue === CloudEnvironmentSettingValue.ChinaCloud) {
|
|
38
|
-
return Object.assign(Object.assign({}, azureEnv.Environment.ChinaCloud), { isCustomCloud: false });
|
|
39
|
-
}
|
|
40
|
-
else if (environmentSettingValue === CloudEnvironmentSettingValue.USGovernment) {
|
|
41
|
-
return Object.assign(Object.assign({}, azureEnv.Environment.USGovernment), { isCustomCloud: false });
|
|
42
|
-
}
|
|
43
|
-
else if (environmentSettingValue === CloudEnvironmentSettingValue.Custom) {
|
|
44
|
-
const customCloud = authProviderConfig.get(CustomEnvironmentSettingName);
|
|
45
|
-
if (customCloud) {
|
|
46
|
-
return Object.assign(Object.assign({}, new azureEnv.Environment(customCloud)), { isCustomCloud: true });
|
|
47
|
-
}
|
|
48
|
-
throw new Error(vscode.l10n.t('The custom cloud choice is not configured. Please configure the setting `{0}.{1}`.', CustomCloudConfigurationSection, CustomEnvironmentSettingName));
|
|
49
|
-
}
|
|
50
|
-
return Object.assign(Object.assign({}, azureEnv.Environment.get(azureEnv.Environment.AzureCloud.name)), { isCustomCloud: false });
|
|
51
|
-
}
|
|
52
|
-
exports.getConfiguredAzureEnv = getConfiguredAzureEnv;
|
|
53
|
-
/**
|
|
54
|
-
* Sets the configured Azure cloud.
|
|
55
|
-
*
|
|
56
|
-
* @param cloud Use `'AzureCloud'` or `undefined` for public Azure cloud, `'ChinaCloud'` for Azure China, or `'USGovernment'` for Azure US Government.
|
|
57
|
-
* These are the same values as the cloud names in `@azure/ms-rest-azure-env`. For a custom cloud, use an instance of the `@azure/ms-rest-azure-env` {@link azureEnv.EnvironmentParameters}.
|
|
58
|
-
*
|
|
59
|
-
* @param target (Optional) The configuration target to use, by default {@link vscode.ConfigurationTarget.Global}.
|
|
60
|
-
*/
|
|
61
|
-
function setConfiguredAzureEnv(cloud, target = vscode.ConfigurationTarget.Global) {
|
|
62
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
-
const authProviderConfig = vscode.workspace.getConfiguration(CustomCloudConfigurationSection);
|
|
64
|
-
if (typeof cloud === 'undefined' || !cloud) {
|
|
65
|
-
// Use public cloud implicitly--set `environment` setting to `undefined`
|
|
66
|
-
yield authProviderConfig.update(CloudEnvironmentSettingName, undefined, target);
|
|
67
|
-
}
|
|
68
|
-
else if (typeof cloud === 'string' && cloud === 'AzureCloud') {
|
|
69
|
-
// Use public cloud explicitly--set `environment` setting to `undefined`
|
|
70
|
-
yield authProviderConfig.update(CloudEnvironmentSettingName, undefined, target);
|
|
71
|
-
}
|
|
72
|
-
else if (typeof cloud === 'string') {
|
|
73
|
-
// Use a sovereign cloud--set the `environment` setting to the specified value
|
|
74
|
-
yield authProviderConfig.update(CloudEnvironmentSettingName, cloud, target);
|
|
75
|
-
}
|
|
76
|
-
else if (typeof cloud === 'object') {
|
|
77
|
-
// use a custom cloud--set the `environment` setting to `custom` and the `customEnvironment` setting to the specified value
|
|
78
|
-
yield authProviderConfig.update(CloudEnvironmentSettingName, CloudEnvironmentSettingValue.Custom, target);
|
|
79
|
-
yield authProviderConfig.update(CustomEnvironmentSettingName, cloud, target);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
throw new Error(`Invalid cloud value: ${JSON.stringify(cloud)}`);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
exports.setConfiguredAzureEnv = setConfiguredAzureEnv;
|
|
87
|
-
/**
|
|
88
|
-
* Gets the ID of the authentication provider configured to be used
|
|
89
|
-
* @returns The provider ID to use, either `'microsoft'` or `'microsoft-sovereign-cloud'`
|
|
90
|
-
*/
|
|
91
|
-
function getConfiguredAuthProviderId() {
|
|
92
|
-
return getConfiguredAzureEnv().name === azureEnv.Environment.AzureCloud.name ? 'microsoft' : 'microsoft-sovereign-cloud';
|
|
93
|
-
}
|
|
94
|
-
exports.getConfiguredAuthProviderId = getConfiguredAuthProviderId;
|
|
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.getConfiguredAuthProviderId = exports.setConfiguredAzureEnv = exports.getConfiguredAzureEnv = void 0;
|
|
17
|
+
const azureEnv = require("@azure/ms-rest-azure-env"); // This package is so small that it's not worth lazy loading
|
|
18
|
+
const vscode = require("vscode");
|
|
19
|
+
// These strings come from https://github.com/microsoft/vscode/blob/eac16e9b63a11885b538db3e0b533a02a2fb8143/extensions/microsoft-authentication/package.json#L40-L99
|
|
20
|
+
const CustomCloudConfigurationSection = 'microsoft-sovereign-cloud';
|
|
21
|
+
const CloudEnvironmentSettingName = 'environment';
|
|
22
|
+
const CustomEnvironmentSettingName = 'customEnvironment';
|
|
23
|
+
var CloudEnvironmentSettingValue;
|
|
24
|
+
(function (CloudEnvironmentSettingValue) {
|
|
25
|
+
CloudEnvironmentSettingValue["ChinaCloud"] = "ChinaCloud";
|
|
26
|
+
CloudEnvironmentSettingValue["USGovernment"] = "USGovernment";
|
|
27
|
+
CloudEnvironmentSettingValue["Custom"] = "custom";
|
|
28
|
+
})(CloudEnvironmentSettingValue || (CloudEnvironmentSettingValue = {}));
|
|
29
|
+
/**
|
|
30
|
+
* Gets the configured Azure environment.
|
|
31
|
+
*
|
|
32
|
+
* @returns The configured Azure environment from the settings in the built-in authentication provider extension
|
|
33
|
+
*/
|
|
34
|
+
function getConfiguredAzureEnv() {
|
|
35
|
+
const authProviderConfig = vscode.workspace.getConfiguration(CustomCloudConfigurationSection);
|
|
36
|
+
const environmentSettingValue = authProviderConfig.get(CloudEnvironmentSettingName);
|
|
37
|
+
if (environmentSettingValue === CloudEnvironmentSettingValue.ChinaCloud) {
|
|
38
|
+
return Object.assign(Object.assign({}, azureEnv.Environment.ChinaCloud), { isCustomCloud: false });
|
|
39
|
+
}
|
|
40
|
+
else if (environmentSettingValue === CloudEnvironmentSettingValue.USGovernment) {
|
|
41
|
+
return Object.assign(Object.assign({}, azureEnv.Environment.USGovernment), { isCustomCloud: false });
|
|
42
|
+
}
|
|
43
|
+
else if (environmentSettingValue === CloudEnvironmentSettingValue.Custom) {
|
|
44
|
+
const customCloud = authProviderConfig.get(CustomEnvironmentSettingName);
|
|
45
|
+
if (customCloud) {
|
|
46
|
+
return Object.assign(Object.assign({}, new azureEnv.Environment(customCloud)), { isCustomCloud: true });
|
|
47
|
+
}
|
|
48
|
+
throw new Error(vscode.l10n.t('The custom cloud choice is not configured. Please configure the setting `{0}.{1}`.', CustomCloudConfigurationSection, CustomEnvironmentSettingName));
|
|
49
|
+
}
|
|
50
|
+
return Object.assign(Object.assign({}, azureEnv.Environment.get(azureEnv.Environment.AzureCloud.name)), { isCustomCloud: false });
|
|
51
|
+
}
|
|
52
|
+
exports.getConfiguredAzureEnv = getConfiguredAzureEnv;
|
|
53
|
+
/**
|
|
54
|
+
* Sets the configured Azure cloud.
|
|
55
|
+
*
|
|
56
|
+
* @param cloud Use `'AzureCloud'` or `undefined` for public Azure cloud, `'ChinaCloud'` for Azure China, or `'USGovernment'` for Azure US Government.
|
|
57
|
+
* These are the same values as the cloud names in `@azure/ms-rest-azure-env`. For a custom cloud, use an instance of the `@azure/ms-rest-azure-env` {@link azureEnv.EnvironmentParameters}.
|
|
58
|
+
*
|
|
59
|
+
* @param target (Optional) The configuration target to use, by default {@link vscode.ConfigurationTarget.Global}.
|
|
60
|
+
*/
|
|
61
|
+
function setConfiguredAzureEnv(cloud, target = vscode.ConfigurationTarget.Global) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
const authProviderConfig = vscode.workspace.getConfiguration(CustomCloudConfigurationSection);
|
|
64
|
+
if (typeof cloud === 'undefined' || !cloud) {
|
|
65
|
+
// Use public cloud implicitly--set `environment` setting to `undefined`
|
|
66
|
+
yield authProviderConfig.update(CloudEnvironmentSettingName, undefined, target);
|
|
67
|
+
}
|
|
68
|
+
else if (typeof cloud === 'string' && cloud === 'AzureCloud') {
|
|
69
|
+
// Use public cloud explicitly--set `environment` setting to `undefined`
|
|
70
|
+
yield authProviderConfig.update(CloudEnvironmentSettingName, undefined, target);
|
|
71
|
+
}
|
|
72
|
+
else if (typeof cloud === 'string') {
|
|
73
|
+
// Use a sovereign cloud--set the `environment` setting to the specified value
|
|
74
|
+
yield authProviderConfig.update(CloudEnvironmentSettingName, cloud, target);
|
|
75
|
+
}
|
|
76
|
+
else if (typeof cloud === 'object') {
|
|
77
|
+
// use a custom cloud--set the `environment` setting to `custom` and the `customEnvironment` setting to the specified value
|
|
78
|
+
yield authProviderConfig.update(CloudEnvironmentSettingName, CloudEnvironmentSettingValue.Custom, target);
|
|
79
|
+
yield authProviderConfig.update(CustomEnvironmentSettingName, cloud, target);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
throw new Error(`Invalid cloud value: ${JSON.stringify(cloud)}`);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
exports.setConfiguredAzureEnv = setConfiguredAzureEnv;
|
|
87
|
+
/**
|
|
88
|
+
* Gets the ID of the authentication provider configured to be used
|
|
89
|
+
* @returns The provider ID to use, either `'microsoft'` or `'microsoft-sovereign-cloud'`
|
|
90
|
+
*/
|
|
91
|
+
function getConfiguredAuthProviderId() {
|
|
92
|
+
return getConfiguredAzureEnv().name === azureEnv.Environment.AzureCloud.name ? 'microsoft' : 'microsoft-sovereign-cloud';
|
|
93
|
+
}
|
|
94
|
+
exports.getConfiguredAuthProviderId = getConfiguredAuthProviderId;
|
|
95
95
|
//# sourceMappingURL=configuredAzureEnv.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { TenantIdDescription } from "@azure/arm-resources-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[]>;
|
|
1
|
+
import type { TenantIdDescription } from "@azure/arm-resources-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[]>;
|