@microsoft/vscode-azext-azureauth 1.3.0 → 1.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.
|
@@ -21,7 +21,6 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.VSCodeAzureSubscriptionProvider = void 0;
|
|
24
|
-
const cross_fetch_1 = require("cross-fetch");
|
|
25
24
|
const vscode = require("vscode");
|
|
26
25
|
const NotSignedInError_1 = require("./NotSignedInError");
|
|
27
26
|
const getSessionFromVSCode_1 = require("./getSessionFromVSCode");
|
|
@@ -76,7 +75,7 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
76
75
|
*/
|
|
77
76
|
getTenants() {
|
|
78
77
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
const listTenantsResponse = yield (
|
|
78
|
+
const listTenantsResponse = yield fetch('https://management.azure.com/tenants?api-version=2022-12-01', {
|
|
80
79
|
headers: {
|
|
81
80
|
Authorization: `Bearer ${yield this.getToken()}`,
|
|
82
81
|
}
|
|
@@ -252,20 +251,17 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
252
251
|
*
|
|
253
252
|
* @returns A client, the credential used by the client, and the authentication function
|
|
254
253
|
*/
|
|
255
|
-
getSubscriptionClient(tenantId) {
|
|
254
|
+
getSubscriptionClient(tenantId, scopes) {
|
|
256
255
|
return __awaiter(this, void 0, void 0, function* () {
|
|
257
256
|
const armSubs = yield Promise.resolve().then(() => require('@azure/arm-subscriptions'));
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
263
|
-
return session;
|
|
264
|
-
});
|
|
257
|
+
const session = yield (0, getSessionFromVSCode_1.getSessionFromVSCode)(scopes, tenantId, { createIfNone: false, silent: true });
|
|
258
|
+
if (!session) {
|
|
259
|
+
throw new NotSignedInError_1.NotSignedInError();
|
|
260
|
+
}
|
|
265
261
|
const credential = {
|
|
266
|
-
getToken: (
|
|
262
|
+
getToken: () => __awaiter(this, void 0, void 0, function* () {
|
|
267
263
|
return {
|
|
268
|
-
token:
|
|
264
|
+
token: session.accessToken,
|
|
269
265
|
expiresOnTimestamp: 0
|
|
270
266
|
};
|
|
271
267
|
})
|
|
@@ -274,7 +270,7 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
274
270
|
client: new armSubs.SubscriptionClient(credential),
|
|
275
271
|
credential: credential,
|
|
276
272
|
authentication: {
|
|
277
|
-
getSession
|
|
273
|
+
getSession: () => session
|
|
278
274
|
}
|
|
279
275
|
};
|
|
280
276
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/vscode-azext-azureauth",
|
|
3
3
|
"author": "Microsoft Corporation",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.4.0",
|
|
5
5
|
"description": "Azure authentication helpers for Visual Studio Code",
|
|
6
6
|
"tags": [
|
|
7
7
|
"azure",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"@types/glob": "^8.1.0",
|
|
37
37
|
"@types/html-to-text": "^8.1.0",
|
|
38
38
|
"@types/mocha": "^7.0.2",
|
|
39
|
-
"@types/node": "^
|
|
39
|
+
"@types/node": "^18.18.7",
|
|
40
|
+
"@types/node-fetch": "2.6.7",
|
|
40
41
|
"@types/semver": "^7.3.9",
|
|
41
42
|
"@types/uuid": "^9.0.1",
|
|
42
43
|
"@types/vscode": "1.76.0",
|
|
@@ -52,7 +53,6 @@
|
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
55
|
"@azure/arm-subscriptions": "^5.1.0",
|
|
55
|
-
"@azure/ms-rest-azure-env": "^2.0.0"
|
|
56
|
-
"cross-fetch": "^4.0.0"
|
|
56
|
+
"@azure/ms-rest-azure-env": "^2.0.0"
|
|
57
57
|
}
|
|
58
58
|
}
|