@microsoft/vscode-azext-azureauth 1.1.2 → 1.1.3
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/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://dev.azure.com/ms-azuretools/AzCode/_build/latest?definitionId=17)
|
|
4
4
|
|
|
5
|
-
This package provides a simple way to authenticate to Azure and receive Azure subscription information.
|
|
5
|
+
This package provides a simple way to authenticate to Azure and receive Azure subscription information. It uses the [built-in Microsoft Authentication extension](https://github.com/microsoft/vscode/tree/main/extensions/microsoft-authentication) and does not rely on the [Azure Account extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.azure-account) in any way.
|
|
6
6
|
|
|
7
7
|
## Azure Subscription Provider
|
|
8
8
|
|
|
@@ -28,9 +28,11 @@ export declare class VSCodeAzureSubscriptionProvider extends vscode.Disposable i
|
|
|
28
28
|
/**
|
|
29
29
|
* Checks to see if a user is signed in.
|
|
30
30
|
*
|
|
31
|
+
* @param tenantId (Optional) Provide to check if a user is signed in to a specific tenant.
|
|
32
|
+
*
|
|
31
33
|
* @returns True if the user is signed in, false otherwise.
|
|
32
34
|
*/
|
|
33
|
-
isSignedIn(): Promise<boolean>;
|
|
35
|
+
isSignedIn(tenantId?: string): Promise<boolean>;
|
|
34
36
|
/**
|
|
35
37
|
* Asks the user to sign in or pick an account to use.
|
|
36
38
|
*
|
|
@@ -95,6 +95,10 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
95
95
|
if (shouldFilterTenants && !tenantIds.includes(tenantId)) {
|
|
96
96
|
continue;
|
|
97
97
|
}
|
|
98
|
+
// If the user is not signed in to this tenant, then skip it
|
|
99
|
+
if (!(yield this.isSignedIn(tenantId))) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
98
102
|
// For each tenant, get the list of subscriptions
|
|
99
103
|
for (const subscription of yield this.getSubscriptionsForTenant(tenantId)) {
|
|
100
104
|
// If filtering is enabled, and the current subscription is not in that list, then skip it
|
|
@@ -114,11 +118,13 @@ class VSCodeAzureSubscriptionProvider extends vscode.Disposable {
|
|
|
114
118
|
/**
|
|
115
119
|
* Checks to see if a user is signed in.
|
|
116
120
|
*
|
|
121
|
+
* @param tenantId (Optional) Provide to check if a user is signed in to a specific tenant.
|
|
122
|
+
*
|
|
117
123
|
* @returns True if the user is signed in, false otherwise.
|
|
118
124
|
*/
|
|
119
|
-
isSignedIn() {
|
|
125
|
+
isSignedIn(tenantId) {
|
|
120
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
-
const session = yield vscode.authentication.getSession((0, configuredAzureEnv_1.getConfiguredAuthProviderId)(), this.
|
|
127
|
+
const session = yield vscode.authentication.getSession((0, configuredAzureEnv_1.getConfiguredAuthProviderId)(), this.getScopes([], tenantId), { createIfNone: false, silent: true });
|
|
122
128
|
return !!session;
|
|
123
129
|
});
|
|
124
130
|
}
|