@microsoft/vscode-azext-azureauth 2.1.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 -304
- 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
- package/out/src/Tenant.d.ts +0 -4
- package/out/src/Tenant.js +0 -7
- package/out/src/utils/signInToTenant.d.ts +0 -2
- package/out/src/utils/signInToTenant.js +0 -89
|
@@ -1,58 +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;
|
|
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
58
|
//# sourceMappingURL=getUnauthenticatedTenants.js.map
|
package/package.json
CHANGED
|
@@ -1,58 +1,61 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@microsoft/vscode-azext-azureauth",
|
|
3
|
-
"author": "Microsoft Corporation",
|
|
4
|
-
"version": "2.
|
|
5
|
-
"description": "Azure authentication helpers for Visual Studio Code",
|
|
6
|
-
"tags": [
|
|
7
|
-
"azure",
|
|
8
|
-
"vscode"
|
|
9
|
-
],
|
|
10
|
-
"keywords": [
|
|
11
|
-
"azure",
|
|
12
|
-
"vscode"
|
|
13
|
-
],
|
|
14
|
-
"main": "out/src/index.js",
|
|
15
|
-
"types": "out/src/index.d.ts",
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"repository": {
|
|
18
|
-
"type": "git",
|
|
19
|
-
"url": "https://github.com/Microsoft/vscode-azuretools"
|
|
20
|
-
},
|
|
21
|
-
"bugs": {
|
|
22
|
-
"url": "https://github.com/Microsoft/vscode-azuretools/issues"
|
|
23
|
-
},
|
|
24
|
-
"homepage": "https://github.com/Microsoft/vscode-azuretools/blob/main/auth/README.md",
|
|
25
|
-
"scripts": {
|
|
26
|
-
"build": "tsc -p ./",
|
|
27
|
-
"compile": "tsc -watch -p ./",
|
|
28
|
-
"lint": "eslint --ext .ts .",
|
|
29
|
-
"lint-fix": "eslint --ext .ts . --fix",
|
|
30
|
-
"test": "node ./out/test/runTest.js",
|
|
31
|
-
"package": "npm pack"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@azure/core-auth": "^1.4.0",
|
|
35
|
-
"@
|
|
36
|
-
"@
|
|
37
|
-
"@types/
|
|
38
|
-
"@types/
|
|
39
|
-
"@types/
|
|
40
|
-
"@types/node
|
|
41
|
-
"@types/
|
|
42
|
-
"@types/
|
|
43
|
-
"@types/
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"eslint
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"mocha
|
|
51
|
-
"mocha-
|
|
52
|
-
"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"@azure/
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@microsoft/vscode-azext-azureauth",
|
|
3
|
+
"author": "Microsoft Corporation",
|
|
4
|
+
"version": "2.4.0",
|
|
5
|
+
"description": "Azure authentication helpers for Visual Studio Code",
|
|
6
|
+
"tags": [
|
|
7
|
+
"azure",
|
|
8
|
+
"vscode"
|
|
9
|
+
],
|
|
10
|
+
"keywords": [
|
|
11
|
+
"azure",
|
|
12
|
+
"vscode"
|
|
13
|
+
],
|
|
14
|
+
"main": "out/src/index.js",
|
|
15
|
+
"types": "out/src/index.d.ts",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/Microsoft/vscode-azuretools"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/Microsoft/vscode-azuretools/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/Microsoft/vscode-azuretools/blob/main/auth/README.md",
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p ./",
|
|
27
|
+
"compile": "tsc -watch -p ./",
|
|
28
|
+
"lint": "eslint --ext .ts .",
|
|
29
|
+
"lint-fix": "eslint --ext .ts . --fix",
|
|
30
|
+
"test": "node ./out/test/runTest.js",
|
|
31
|
+
"package": "npm pack"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@azure/core-auth": "^1.4.0",
|
|
35
|
+
"@azure/identity": "^4.2.0",
|
|
36
|
+
"@microsoft/eslint-config-azuretools": "^0.2.1",
|
|
37
|
+
"@types/glob": "^8.1.0",
|
|
38
|
+
"@types/html-to-text": "^8.1.0",
|
|
39
|
+
"@types/mocha": "^7.0.2",
|
|
40
|
+
"@types/node": "^18.18.7",
|
|
41
|
+
"@types/node-fetch": "2.6.7",
|
|
42
|
+
"@types/semver": "^7.3.9",
|
|
43
|
+
"@types/uuid": "^9.0.1",
|
|
44
|
+
"@types/vscode": "1.76.0",
|
|
45
|
+
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
46
|
+
"@vscode/test-electron": "^2.3.8",
|
|
47
|
+
"eslint": "^8.34.0",
|
|
48
|
+
"eslint-plugin-import": "^2.22.1",
|
|
49
|
+
"glob": "^7.1.6",
|
|
50
|
+
"mocha": "^9.1.3",
|
|
51
|
+
"mocha-junit-reporter": "^2.0.2",
|
|
52
|
+
"mocha-multi-reporters": "^1.1.7",
|
|
53
|
+
"typescript": "^4.9.4"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@azure/arm-resources-subscriptions": "^2.1.0",
|
|
57
|
+
"@azure/core-client": "^1.9.2",
|
|
58
|
+
"@azure/core-rest-pipeline": "^1.16.0",
|
|
59
|
+
"@azure/ms-rest-azure-env": "^2.0.0"
|
|
60
|
+
}
|
|
61
|
+
}
|
package/out/src/Tenant.d.ts
DELETED
package/out/src/Tenant.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
//# sourceMappingURL=Tenant.js.map
|
|
@@ -1,89 +0,0 @@
|
|
|
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.signInToTenant = void 0;
|
|
24
|
-
const vscode = require("vscode");
|
|
25
|
-
function signInToTenant(subscriptionProvider) {
|
|
26
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
-
const tenantId = yield pickTenant(subscriptionProvider);
|
|
28
|
-
if (tenantId) {
|
|
29
|
-
yield subscriptionProvider.signIn(tenantId);
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
exports.signInToTenant = signInToTenant;
|
|
34
|
-
function pickTenant(subscriptionProvider) {
|
|
35
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const pick = yield vscode.window.showQuickPick(getPicks(subscriptionProvider), {
|
|
37
|
-
placeHolder: 'Select Directory to Sign In To',
|
|
38
|
-
matchOnDescription: true,
|
|
39
|
-
ignoreFocusOut: true,
|
|
40
|
-
});
|
|
41
|
-
return pick === null || pick === void 0 ? void 0 : pick.tenant.tenantId;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function getPicks(subscriptionProvider) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const unauthenticatedTenants = yield getUnauthenticatedTenants(subscriptionProvider);
|
|
47
|
-
const picks = unauthenticatedTenants.map(tenant => {
|
|
48
|
-
var _a, _b, _c;
|
|
49
|
-
return ({
|
|
50
|
-
label: (_a = tenant.displayName) !== null && _a !== void 0 ? _a : '',
|
|
51
|
-
description: (_b = tenant.tenantId) !== null && _b !== void 0 ? _b : '',
|
|
52
|
-
detail: (_c = tenant.defaultDomain) !== null && _c !== void 0 ? _c : '',
|
|
53
|
-
tenant,
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
return picks;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function getUnauthenticatedTenants(subscriptionProvider) {
|
|
60
|
-
var _a, e_1, _b, _c;
|
|
61
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
const tenants = yield subscriptionProvider.getTenants();
|
|
63
|
-
const unauthenticatedTenants = [];
|
|
64
|
-
try {
|
|
65
|
-
for (var _d = true, tenants_1 = __asyncValues(tenants), tenants_1_1; tenants_1_1 = yield tenants_1.next(), _a = tenants_1_1.done, !_a;) {
|
|
66
|
-
_c = tenants_1_1.value;
|
|
67
|
-
_d = false;
|
|
68
|
-
try {
|
|
69
|
-
const tenant = _c;
|
|
70
|
-
if (!(yield subscriptionProvider.isSignedIn(tenant.tenantId))) {
|
|
71
|
-
unauthenticatedTenants.push(tenant);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
finally {
|
|
75
|
-
_d = true;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
80
|
-
finally {
|
|
81
|
-
try {
|
|
82
|
-
if (!_d && !_a && (_b = tenants_1.return)) yield _b.call(tenants_1);
|
|
83
|
-
}
|
|
84
|
-
finally { if (e_1) throw e_1.error; }
|
|
85
|
-
}
|
|
86
|
-
return unauthenticatedTenants;
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
//# sourceMappingURL=signInToTenant.js.map
|