@microsoft/vscode-azext-azureauth 1.0.0 → 1.1.2
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/out/src/AzureAuthentication.d.ts +14 -14
- package/out/src/AzureAuthentication.js +6 -6
- package/out/src/AzureSubscription.d.ts +44 -44
- package/out/src/AzureSubscription.js +6 -6
- package/out/src/AzureSubscriptionProvider.d.ts +48 -48
- 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 +112 -112
- package/out/src/VSCodeAzureSubscriptionProvider.js +321 -320
- package/out/src/index.d.ts +6 -6
- package/out/src/index.js +26 -26
- package/out/src/utils/configuredAzureEnv.d.ts +24 -24
- package/out/src/utils/configuredAzureEnv.js +94 -89
- package/package.json +1 -1
package/out/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './AzureAuthentication';
|
|
2
|
-
export * from './AzureSubscription';
|
|
3
|
-
export * from './AzureSubscriptionProvider';
|
|
4
|
-
export * from './NotSignedInError';
|
|
5
|
-
export * from './utils/configuredAzureEnv';
|
|
6
|
-
export * from './VSCodeAzureSubscriptionProvider';
|
|
1
|
+
export * from './AzureAuthentication';
|
|
2
|
+
export * from './AzureSubscription';
|
|
3
|
+
export * from './AzureSubscriptionProvider';
|
|
4
|
+
export * from './NotSignedInError';
|
|
5
|
+
export * from './utils/configuredAzureEnv';
|
|
6
|
+
export * from './VSCodeAzureSubscriptionProvider';
|
package/out/src/index.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
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("./AzureSubscription"), exports);
|
|
23
|
-
__exportStar(require("./AzureSubscriptionProvider"), exports);
|
|
24
|
-
__exportStar(require("./NotSignedInError"), exports);
|
|
25
|
-
__exportStar(require("./utils/configuredAzureEnv"), exports);
|
|
26
|
-
__exportStar(require("./VSCodeAzureSubscriptionProvider"), exports);
|
|
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("./AzureSubscription"), exports);
|
|
23
|
+
__exportStar(require("./AzureSubscriptionProvider"), exports);
|
|
24
|
+
__exportStar(require("./NotSignedInError"), exports);
|
|
25
|
+
__exportStar(require("./utils/configuredAzureEnv"), exports);
|
|
26
|
+
__exportStar(require("./VSCodeAzureSubscriptionProvider"), exports);
|
|
27
27
|
//# sourceMappingURL=index.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
|
|
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'` for public Azure cloud, `'
|
|
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`
|
|
16
|
-
*
|
|
17
|
-
* @param target (Optional) The configuration target to use, by default {@link vscode.ConfigurationTarget.Global}.
|
|
18
|
-
*/
|
|
19
|
-
export declare function setConfiguredAzureEnv(cloud:
|
|
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,90 +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
|
-
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (typeof cloud === 'string' && cloud
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
yield
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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.get(azureEnv.Environment.ChinaCloud.name)), { isCustomCloud: false });
|
|
39
|
+
}
|
|
40
|
+
else if (environmentSettingValue === CloudEnvironmentSettingValue.USGovernment) {
|
|
41
|
+
return Object.assign(Object.assign({}, azureEnv.Environment.get(azureEnv.Environment.USGovernment.name)), { 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;
|
|
90
95
|
//# sourceMappingURL=configuredAzureEnv.js.map
|