@microsoft/vscode-azext-azureauth 6.0.0-alpha.8 → 6.1.0-alpha.1
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 -2
- package/dist/cjs/src/providers/AzureDevOpsSubscriptionProvider.js +3 -4
- package/dist/cjs/src/providers/AzureSubscriptionProviderBase.js +17 -15
- package/dist/cjs/src/utils/tryGetTokenExpiration.js +1 -1
- package/dist/esm/src/contracts/AzureTenant.d.ts +1 -1
- package/dist/esm/src/providers/AzureDevOpsSubscriptionProvider.d.ts +4 -4
- package/dist/esm/src/providers/AzureDevOpsSubscriptionProvider.js +3 -4
- package/dist/esm/src/providers/AzureSubscriptionProviderBase.d.ts +7 -7
- package/dist/esm/src/providers/AzureSubscriptionProviderBase.js +17 -15
- package/dist/esm/src/utils/tryGetTokenExpiration.js +1 -1
- package/package.json +12 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,39 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 6.0.0-alpha.8 - 2026-03-27
|
|
4
|
+
|
|
5
|
+
* [#2248](https://github.com/microsoft/vscode-azuretools/pull/2248) Watch sovereign cloud config and fire `onRefreshSuggested`
|
|
6
|
+
|
|
7
|
+
## 6.0.0-alpha.7 - 2026-03-27
|
|
8
|
+
|
|
9
|
+
* [#2246](https://github.com/microsoft/vscode-azuretools/pull/2246) Reduce auth event debounce from 5s to 2s
|
|
10
|
+
* [#2245](https://github.com/microsoft/vscode-azuretools/pull/2245) Ensure `subscriptionFilterChange` events are not suppressed during debounce
|
|
11
|
+
* [#2235](https://github.com/microsoft/vscode-azuretools/pull/2235) npm audit fix in all package subfolders
|
|
12
|
+
|
|
13
|
+
## 6.0.0-alpha.6 - 2026-03-20
|
|
14
|
+
|
|
15
|
+
* [#2231](https://github.com/microsoft/vscode-azuretools/pull/2231) Add BearerChallengePolicy for MFA step-up challenges during subscription listing
|
|
16
|
+
|
|
17
|
+
## 6.0.0-alpha.5 - 2026-03-11
|
|
18
|
+
|
|
19
|
+
* [#2215](https://github.com/microsoft/vscode-azuretools/pull/2215) Improve error message for `platform_broker_error`
|
|
20
|
+
* [#2214](https://github.com/microsoft/vscode-azuretools/pull/2214) Switch debug logs to info
|
|
21
|
+
|
|
22
|
+
## 6.0.0-alpha.4 - 2026-03-11
|
|
23
|
+
|
|
24
|
+
* [#2208](https://github.com/microsoft/vscode-azuretools/pull/2208) Skip failing tenants instead of aborting subscription listing
|
|
25
|
+
|
|
26
|
+
## 6.0.0-alpha.3 - 2026-03-11
|
|
27
|
+
|
|
28
|
+
* [#2198](https://github.com/microsoft/vscode-azuretools/pull/2198) Go back to overriding the sdk scopes
|
|
29
|
+
* [#2200](https://github.com/microsoft/vscode-azuretools/pull/2200) Attach environment to account
|
|
30
|
+
* [#2190](https://github.com/microsoft/vscode-azuretools/pull/2190) Updating dependencies
|
|
31
|
+
|
|
3
32
|
## 6.0.0-alpha.2 - 2026-02-09
|
|
4
33
|
|
|
5
|
-
* Fix copy all optional properties in `ExtendedEnvironment` constructor
|
|
34
|
+
* [#2186](https://github.com/microsoft/vscode-azuretools/pull/2186) Fix copy all optional properties in `ExtendedEnvironment` constructor
|
|
6
35
|
|
|
7
|
-
## 6.0.0 - 2025-12-
|
|
36
|
+
## 6.0.0-alpha.1 - 2025-12-05
|
|
8
37
|
|
|
9
38
|
* [#2119](https://github.com/microsoft/vscode-azuretools/pull/2119) Complete rewrite of the auth package. Adds caching, parallelization, and smarter filtering.
|
|
10
39
|
|
|
@@ -39,6 +39,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.AzureDevOpsSubscriptionProvider = void 0;
|
|
41
41
|
exports.createAzureDevOpsSubscriptionProviderFactory = createAzureDevOpsSubscriptionProviderFactory;
|
|
42
|
+
const api_1 = require("@azure/arm-resources-subscriptions/api");
|
|
42
43
|
const azureEnv = __importStar(require("@azure/ms-rest-azure-env")); // This package is so small that it's not worth lazy loading
|
|
43
44
|
const crypto = __importStar(require("crypto"));
|
|
44
45
|
const configuredAzureEnv_1 = require("../utils/configuredAzureEnv");
|
|
@@ -52,7 +53,6 @@ function createAzureDevOpsSubscriptionProviderFactory(initializer) {
|
|
|
52
53
|
return Promise.resolve(azureDevOpsSubscriptionProvider);
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
|
-
let armSubs;
|
|
56
56
|
let azIdentity;
|
|
57
57
|
/**
|
|
58
58
|
* AzureSubscriptionProvider implemented to authenticate via federated DevOps service connection, using workflow identity federation
|
|
@@ -121,7 +121,7 @@ class AzureDevOpsSubscriptionProvider extends AzureSubscriptionProviderBase_1.Az
|
|
|
121
121
|
/**
|
|
122
122
|
* @inheritdoc
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
getSubscriptionContext(tenant) {
|
|
125
125
|
if (!this._tokenCredential) {
|
|
126
126
|
throw new NotSignedInError_1.NotSignedInError();
|
|
127
127
|
}
|
|
@@ -140,9 +140,8 @@ class AzureDevOpsSubscriptionProvider extends AzureSubscriptionProviderBase_1.Az
|
|
|
140
140
|
scopes: scopes,
|
|
141
141
|
};
|
|
142
142
|
};
|
|
143
|
-
armSubs ??= await import('@azure/arm-resources-subscriptions');
|
|
144
143
|
return {
|
|
145
|
-
|
|
144
|
+
context: (0, api_1.createSubscription)(this._tokenCredential),
|
|
146
145
|
credential: this._tokenCredential,
|
|
147
146
|
authentication: {
|
|
148
147
|
getSession: () => {
|
|
@@ -38,10 +38,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
})();
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.AzureSubscriptionProviderBase = void 0;
|
|
41
|
-
const
|
|
41
|
+
const api_1 = require("@azure/arm-resources-subscriptions/api");
|
|
42
|
+
const subscriptions_1 = require("@azure/arm-resources-subscriptions/api/subscriptions");
|
|
43
|
+
const tenants_1 = require("@azure/arm-resources-subscriptions/api/tenants");
|
|
42
44
|
const util_1 = require("util");
|
|
43
45
|
const vscode = __importStar(require("vscode"));
|
|
44
46
|
const AzureSubscriptionProviderRequestOptions_1 = require("../contracts/AzureSubscriptionProviderRequestOptions");
|
|
47
|
+
const BearerChallengePolicy_1 = require("../utils/BearerChallengePolicy");
|
|
45
48
|
const configuredAzureEnv_1 = require("../utils/configuredAzureEnv");
|
|
46
49
|
const dedupeSubscriptions_1 = require("../utils/dedupeSubscriptions");
|
|
47
50
|
const getSessionFromVSCode_1 = require("../utils/getSessionFromVSCode");
|
|
@@ -55,7 +58,6 @@ const EventDebounce = 2 * 1000; // 2 seconds minimum between `onRefreshSuggested
|
|
|
55
58
|
const EventSilenceTime = 5 * 1000; // 5 seconds after sign-in to silence `onRefreshSuggested` events
|
|
56
59
|
const TenantListConcurrency = 3; // We will try to list tenants for at most 3 accounts in parallel
|
|
57
60
|
const SubscriptionListConcurrency = 5; // We will try to list subscriptions for at most 5 account+tenants in parallel
|
|
58
|
-
let armSubs;
|
|
59
61
|
/**
|
|
60
62
|
* Base class for Azure subscription providers that use VS Code authentication.
|
|
61
63
|
* Handles actual communication with Azure via the Azure SDK, as well as
|
|
@@ -275,9 +277,9 @@ class AzureSubscriptionProviderBase {
|
|
|
275
277
|
try {
|
|
276
278
|
const startTime = Date.now();
|
|
277
279
|
this.logForAccount(account, 'Fetching tenants for account...');
|
|
278
|
-
const {
|
|
280
|
+
const { context } = this.getSubscriptionContext({ account: account, tenantId: undefined });
|
|
279
281
|
const allTenants = [];
|
|
280
|
-
for await (const tenant of
|
|
282
|
+
for await (const tenant of (0, tenants_1.list)(context, { abortSignal: (0, getSignalForToken_1.getSignalForToken)(options.token) })) {
|
|
281
283
|
allTenants.push({
|
|
282
284
|
...tenant,
|
|
283
285
|
tenantId: tenant.tenantId, // eslint-disable-line @typescript-eslint/no-non-null-assertion -- This is never null in practice
|
|
@@ -301,10 +303,10 @@ class AzureSubscriptionProviderBase {
|
|
|
301
303
|
try {
|
|
302
304
|
const startTime = Date.now();
|
|
303
305
|
this.logForTenant(tenant, 'Fetching subscriptions for account+tenant...');
|
|
304
|
-
const {
|
|
306
|
+
const { context, credential, authentication } = this.getSubscriptionContext(tenant);
|
|
305
307
|
const environment = (0, configuredAzureEnv_1.getConfiguredAzureEnv)();
|
|
306
308
|
const allSubs = [];
|
|
307
|
-
for await (const subscription of
|
|
309
|
+
for await (const subscription of (0, subscriptions_1.list)(context, { abortSignal: (0, getSignalForToken_1.getSignalForToken)(options.token) })) {
|
|
308
310
|
allSubs.push({
|
|
309
311
|
authentication: authentication,
|
|
310
312
|
environment: environment,
|
|
@@ -329,12 +331,12 @@ class AzureSubscriptionProviderBase {
|
|
|
329
331
|
}
|
|
330
332
|
}
|
|
331
333
|
/**
|
|
332
|
-
* Gets a {@link
|
|
333
|
-
* @param tenant (Optional) The account+tenant to get a subscription
|
|
334
|
+
* Gets a {@link SubscriptionContext} plus extras for the given account+tenant.
|
|
335
|
+
* @param tenant (Optional) The account+tenant to get a subscription context for. If not specified, the default account and home tenant
|
|
334
336
|
* will be used.
|
|
335
|
-
* @returns A {@link
|
|
337
|
+
* @returns A {@link SubscriptionContext}, {@link TokenCredential}, and {@link AzureAuthentication} for the given account+tenant.
|
|
336
338
|
*/
|
|
337
|
-
|
|
339
|
+
getSubscriptionContext(tenant) {
|
|
338
340
|
// Credential ignores requested scopes and always uses default scopes (managementEndpointUrl),
|
|
339
341
|
// matching the scope used during signIn(). This avoids a refresh token round-trip that can
|
|
340
342
|
// fail when MSAL has stale cache entries for a different scope.
|
|
@@ -351,16 +353,16 @@ class AzureSubscriptionProviderBase {
|
|
|
351
353
|
};
|
|
352
354
|
}
|
|
353
355
|
};
|
|
354
|
-
|
|
355
|
-
const endpoint =
|
|
356
|
-
const
|
|
357
|
-
|
|
356
|
+
const rawEndpoint = (0, configuredAzureEnv_1.getConfiguredAzureEnv)().resourceManagerEndpointUrl;
|
|
357
|
+
const endpoint = rawEndpoint.endsWith('/') ? rawEndpoint : `${rawEndpoint}/`;
|
|
358
|
+
const context = (0, api_1.createSubscription)(credential, { endpoint });
|
|
359
|
+
context.pipeline.addPolicy(new BearerChallengePolicy_1.BearerChallengePolicy(async (challenge) => {
|
|
358
360
|
this.silenceRefreshEvents();
|
|
359
361
|
const session = await (0, getSessionFromVSCode_1.getSessionFromVSCode)(challenge, tenant.tenantId, { createIfNone: true, account: tenant.account });
|
|
360
362
|
return session?.accessToken;
|
|
361
363
|
}, endpoint), { phase: 'Sign', afterPolicies: ['bearerTokenAuthenticationPolicy'] });
|
|
362
364
|
return {
|
|
363
|
-
|
|
365
|
+
context: context,
|
|
364
366
|
credential: credential,
|
|
365
367
|
authentication: {
|
|
366
368
|
getSession: async () => {
|
|
@@ -10,7 +10,7 @@ function tryGetTokenExpiration(session) {
|
|
|
10
10
|
if (!!session?.idToken) {
|
|
11
11
|
const idTokenParts = session.idToken.split('.');
|
|
12
12
|
if (idTokenParts.length === 3) {
|
|
13
|
-
const payload = JSON.parse(Buffer.from(idTokenParts[1], '
|
|
13
|
+
const payload = JSON.parse(Buffer.from(idTokenParts[1], 'base64url').toString());
|
|
14
14
|
if (payload.exp !== undefined && Number.isInteger(payload.exp)) {
|
|
15
15
|
return payload.exp * 1000; // Convert to milliseconds
|
|
16
16
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TenantIdDescription } from "@azure/arm-resources-subscriptions";
|
|
1
|
+
import type { TenantIdDescription } from "@azure/arm-resources-subscriptions/models";
|
|
2
2
|
import type { AzureAccount } from "./AzureAccount";
|
|
3
3
|
/**
|
|
4
4
|
* An Azure tenant associated with a specific account
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SubscriptionContext } from '@azure/arm-resources-subscriptions/api';
|
|
2
2
|
import type { TokenCredential } from '@azure/core-auth';
|
|
3
3
|
import type * as vscode from 'vscode';
|
|
4
4
|
import type { AzureAccount } from '../contracts/AzureAccount';
|
|
@@ -60,9 +60,9 @@ export declare class AzureDevOpsSubscriptionProvider extends AzureSubscriptionPr
|
|
|
60
60
|
/**
|
|
61
61
|
* @inheritdoc
|
|
62
62
|
*/
|
|
63
|
-
protected
|
|
64
|
-
|
|
63
|
+
protected getSubscriptionContext(tenant: TenantIdAndAccount): {
|
|
64
|
+
context: SubscriptionContext;
|
|
65
65
|
credential: TokenCredential;
|
|
66
66
|
authentication: AzureAuthentication;
|
|
67
|
-
}
|
|
67
|
+
};
|
|
68
68
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { createSubscription } from '@azure/arm-resources-subscriptions/api';
|
|
5
6
|
import * as azureEnv from '@azure/ms-rest-azure-env'; // This package is so small that it's not worth lazy loading
|
|
6
7
|
import * as crypto from 'crypto';
|
|
7
8
|
import { ExtendedEnvironment } from '../utils/configuredAzureEnv';
|
|
@@ -15,7 +16,6 @@ export function createAzureDevOpsSubscriptionProviderFactory(initializer) {
|
|
|
15
16
|
return Promise.resolve(azureDevOpsSubscriptionProvider);
|
|
16
17
|
};
|
|
17
18
|
}
|
|
18
|
-
let armSubs;
|
|
19
19
|
let azIdentity;
|
|
20
20
|
/**
|
|
21
21
|
* AzureSubscriptionProvider implemented to authenticate via federated DevOps service connection, using workflow identity federation
|
|
@@ -84,7 +84,7 @@ export class AzureDevOpsSubscriptionProvider extends AzureSubscriptionProviderBa
|
|
|
84
84
|
/**
|
|
85
85
|
* @inheritdoc
|
|
86
86
|
*/
|
|
87
|
-
|
|
87
|
+
getSubscriptionContext(tenant) {
|
|
88
88
|
if (!this._tokenCredential) {
|
|
89
89
|
throw new NotSignedInError();
|
|
90
90
|
}
|
|
@@ -103,9 +103,8 @@ export class AzureDevOpsSubscriptionProvider extends AzureSubscriptionProviderBa
|
|
|
103
103
|
scopes: scopes,
|
|
104
104
|
};
|
|
105
105
|
};
|
|
106
|
-
armSubs ??= await import('@azure/arm-resources-subscriptions');
|
|
107
106
|
return {
|
|
108
|
-
|
|
107
|
+
context: createSubscription(this._tokenCredential),
|
|
109
108
|
credential: this._tokenCredential,
|
|
110
109
|
authentication: {
|
|
111
110
|
getSession: () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SubscriptionContext } from '@azure/arm-resources-subscriptions/api';
|
|
2
2
|
import type { TokenCredential } from '@azure/core-auth';
|
|
3
3
|
import * as vscode from 'vscode';
|
|
4
4
|
import type { AzureAccount } from '../contracts/AzureAccount';
|
|
@@ -54,16 +54,16 @@ export declare abstract class AzureSubscriptionProviderBase implements AzureSubs
|
|
|
54
54
|
*/
|
|
55
55
|
getSubscriptionsForTenant(tenant: TenantIdAndAccount, options?: GetSubscriptionsForTenantOptions): Promise<AzureSubscription[]>;
|
|
56
56
|
/**
|
|
57
|
-
* Gets a {@link
|
|
58
|
-
* @param tenant (Optional) The account+tenant to get a subscription
|
|
57
|
+
* Gets a {@link SubscriptionContext} plus extras for the given account+tenant.
|
|
58
|
+
* @param tenant (Optional) The account+tenant to get a subscription context for. If not specified, the default account and home tenant
|
|
59
59
|
* will be used.
|
|
60
|
-
* @returns A {@link
|
|
60
|
+
* @returns A {@link SubscriptionContext}, {@link TokenCredential}, and {@link AzureAuthentication} for the given account+tenant.
|
|
61
61
|
*/
|
|
62
|
-
protected
|
|
63
|
-
|
|
62
|
+
protected getSubscriptionContext(tenant: Partial<TenantIdAndAccount>): {
|
|
63
|
+
context: SubscriptionContext;
|
|
64
64
|
credential: TokenCredential;
|
|
65
65
|
authentication: AzureAuthentication;
|
|
66
|
-
}
|
|
66
|
+
};
|
|
67
67
|
protected log(message: string): void;
|
|
68
68
|
protected logForAccount(account: AzureAccount, message: string): void;
|
|
69
69
|
protected logForTenant(tenant: TenantIdAndAccount, message: string): void;
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import {
|
|
5
|
+
import { createSubscription } from '@azure/arm-resources-subscriptions/api';
|
|
6
|
+
import { list as listSubscriptions } from '@azure/arm-resources-subscriptions/api/subscriptions';
|
|
7
|
+
import { list as listTenants } from '@azure/arm-resources-subscriptions/api/tenants';
|
|
6
8
|
import { inspect } from 'util';
|
|
7
9
|
import * as vscode from 'vscode';
|
|
8
10
|
import { DefaultOptions, DefaultSignInOptions } from '../contracts/AzureSubscriptionProviderRequestOptions';
|
|
11
|
+
import { BearerChallengePolicy } from '../utils/BearerChallengePolicy';
|
|
9
12
|
import { getConfiguredAuthProviderId, getConfiguredAzureEnv } from '../utils/configuredAzureEnv';
|
|
10
13
|
import { dedupeSubscriptions } from '../utils/dedupeSubscriptions';
|
|
11
14
|
import { getSessionFromVSCode } from '../utils/getSessionFromVSCode';
|
|
@@ -19,7 +22,6 @@ const EventDebounce = 2 * 1000; // 2 seconds minimum between `onRefreshSuggested
|
|
|
19
22
|
const EventSilenceTime = 5 * 1000; // 5 seconds after sign-in to silence `onRefreshSuggested` events
|
|
20
23
|
const TenantListConcurrency = 3; // We will try to list tenants for at most 3 accounts in parallel
|
|
21
24
|
const SubscriptionListConcurrency = 5; // We will try to list subscriptions for at most 5 account+tenants in parallel
|
|
22
|
-
let armSubs;
|
|
23
25
|
/**
|
|
24
26
|
* Base class for Azure subscription providers that use VS Code authentication.
|
|
25
27
|
* Handles actual communication with Azure via the Azure SDK, as well as
|
|
@@ -239,9 +241,9 @@ export class AzureSubscriptionProviderBase {
|
|
|
239
241
|
try {
|
|
240
242
|
const startTime = Date.now();
|
|
241
243
|
this.logForAccount(account, 'Fetching tenants for account...');
|
|
242
|
-
const {
|
|
244
|
+
const { context } = this.getSubscriptionContext({ account: account, tenantId: undefined });
|
|
243
245
|
const allTenants = [];
|
|
244
|
-
for await (const tenant of
|
|
246
|
+
for await (const tenant of listTenants(context, { abortSignal: getSignalForToken(options.token) })) {
|
|
245
247
|
allTenants.push({
|
|
246
248
|
...tenant,
|
|
247
249
|
tenantId: tenant.tenantId, // eslint-disable-line @typescript-eslint/no-non-null-assertion -- This is never null in practice
|
|
@@ -265,10 +267,10 @@ export class AzureSubscriptionProviderBase {
|
|
|
265
267
|
try {
|
|
266
268
|
const startTime = Date.now();
|
|
267
269
|
this.logForTenant(tenant, 'Fetching subscriptions for account+tenant...');
|
|
268
|
-
const {
|
|
270
|
+
const { context, credential, authentication } = this.getSubscriptionContext(tenant);
|
|
269
271
|
const environment = getConfiguredAzureEnv();
|
|
270
272
|
const allSubs = [];
|
|
271
|
-
for await (const subscription of
|
|
273
|
+
for await (const subscription of listSubscriptions(context, { abortSignal: getSignalForToken(options.token) })) {
|
|
272
274
|
allSubs.push({
|
|
273
275
|
authentication: authentication,
|
|
274
276
|
environment: environment,
|
|
@@ -293,12 +295,12 @@ export class AzureSubscriptionProviderBase {
|
|
|
293
295
|
}
|
|
294
296
|
}
|
|
295
297
|
/**
|
|
296
|
-
* Gets a {@link
|
|
297
|
-
* @param tenant (Optional) The account+tenant to get a subscription
|
|
298
|
+
* Gets a {@link SubscriptionContext} plus extras for the given account+tenant.
|
|
299
|
+
* @param tenant (Optional) The account+tenant to get a subscription context for. If not specified, the default account and home tenant
|
|
298
300
|
* will be used.
|
|
299
|
-
* @returns A {@link
|
|
301
|
+
* @returns A {@link SubscriptionContext}, {@link TokenCredential}, and {@link AzureAuthentication} for the given account+tenant.
|
|
300
302
|
*/
|
|
301
|
-
|
|
303
|
+
getSubscriptionContext(tenant) {
|
|
302
304
|
// Credential ignores requested scopes and always uses default scopes (managementEndpointUrl),
|
|
303
305
|
// matching the scope used during signIn(). This avoids a refresh token round-trip that can
|
|
304
306
|
// fail when MSAL has stale cache entries for a different scope.
|
|
@@ -315,16 +317,16 @@ export class AzureSubscriptionProviderBase {
|
|
|
315
317
|
};
|
|
316
318
|
}
|
|
317
319
|
};
|
|
318
|
-
|
|
319
|
-
const endpoint =
|
|
320
|
-
const
|
|
321
|
-
|
|
320
|
+
const rawEndpoint = getConfiguredAzureEnv().resourceManagerEndpointUrl;
|
|
321
|
+
const endpoint = rawEndpoint.endsWith('/') ? rawEndpoint : `${rawEndpoint}/`;
|
|
322
|
+
const context = createSubscription(credential, { endpoint });
|
|
323
|
+
context.pipeline.addPolicy(new BearerChallengePolicy(async (challenge) => {
|
|
322
324
|
this.silenceRefreshEvents();
|
|
323
325
|
const session = await getSessionFromVSCode(challenge, tenant.tenantId, { createIfNone: true, account: tenant.account });
|
|
324
326
|
return session?.accessToken;
|
|
325
327
|
}, endpoint), { phase: 'Sign', afterPolicies: ['bearerTokenAuthenticationPolicy'] });
|
|
326
328
|
return {
|
|
327
|
-
|
|
329
|
+
context: context,
|
|
328
330
|
credential: credential,
|
|
329
331
|
authentication: {
|
|
330
332
|
getSession: async () => {
|
|
@@ -7,7 +7,7 @@ export function tryGetTokenExpiration(session) {
|
|
|
7
7
|
if (!!session?.idToken) {
|
|
8
8
|
const idTokenParts = session.idToken.split('.');
|
|
9
9
|
if (idTokenParts.length === 3) {
|
|
10
|
-
const payload = JSON.parse(Buffer.from(idTokenParts[1], '
|
|
10
|
+
const payload = JSON.parse(Buffer.from(idTokenParts[1], 'base64url').toString());
|
|
11
11
|
if (payload.exp !== undefined && Number.isInteger(payload.exp)) {
|
|
12
12
|
return payload.exp * 1000; // Convert to milliseconds
|
|
13
13
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/vscode-azext-azureauth",
|
|
3
3
|
"author": "Microsoft Corporation",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.1.0-alpha.1",
|
|
5
5
|
"description": "Azure authentication helpers for Visual Studio Code",
|
|
6
6
|
"tags": [
|
|
7
7
|
"azure",
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
"vscode": "^1.106.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@microsoft/vscode-azext-eng": "1.0.0-alpha.13",
|
|
51
|
+
"@microsoft/vscode-azext-eng": "^1.1.0-alpha.1",
|
|
53
52
|
"@types/node": "22.x",
|
|
54
53
|
"@types/vscode": "1.106.0"
|
|
55
54
|
},
|
|
56
55
|
"dependencies": {
|
|
57
|
-
"@azure/arm-resources-subscriptions": "^
|
|
58
|
-
"@azure/core-
|
|
59
|
-
"@azure/
|
|
56
|
+
"@azure/arm-resources-subscriptions": "^3.0.0-beta.1",
|
|
57
|
+
"@azure/core-auth": "^1.10.1",
|
|
58
|
+
"@azure/core-rest-pipeline": "^1.23.0",
|
|
59
|
+
"@azure/identity": "^4.13.1",
|
|
60
60
|
"@azure/ms-rest-azure-env": "^2.0.0"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
@@ -65,10 +65,15 @@
|
|
|
65
65
|
"mocha": {
|
|
66
66
|
"ui": "tdd",
|
|
67
67
|
"node-option": [
|
|
68
|
-
"
|
|
68
|
+
"experimental-transform-types",
|
|
69
|
+
"disable-warning=ExperimentalWarning",
|
|
70
|
+
"import=@microsoft/vscode-azext-eng/mocha"
|
|
69
71
|
],
|
|
70
72
|
"spec": [
|
|
71
73
|
"test/**/*.test.ts"
|
|
72
74
|
]
|
|
75
|
+
},
|
|
76
|
+
"overrides": {
|
|
77
|
+
"serialize-javascript": "^7.0.5"
|
|
73
78
|
}
|
|
74
79
|
}
|