@microsoft/vscode-azext-azureauth 1.2.2 → 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/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
|
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
|