@microsoft/vscode-azext-azureauth 6.1.0-alpha.1 → 6.1.0-alpha.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 6.1.0-alpha.2 - 2026-06-02
|
|
4
|
+
|
|
5
|
+
* Add an optional `options` parameter to `getSessionWithScopes`. Passing `{ createIfNone: true }` allows an interactive consent prompt when a session for the requested scopes has not yet been granted, instead of failing silently. This enables callers to eagerly obtain consent for a non-management audience (e.g. the App Service audience used for Kudu/SCM deployments) before it is first needed. See [microsoft/vscode-azurefunctions#5073](https://github.com/microsoft/vscode-azurefunctions/issues/5073)
|
|
6
|
+
|
|
3
7
|
## 6.0.0-alpha.8 - 2026-03-27
|
|
4
8
|
|
|
5
9
|
* [#2248](https://github.com/microsoft/vscode-azuretools/pull/2248) Watch sovereign cloud config and fire `onRefreshSuggested`
|
|
@@ -373,12 +373,25 @@ class AzureSubscriptionProviderBase {
|
|
|
373
373
|
}
|
|
374
374
|
return session;
|
|
375
375
|
},
|
|
376
|
-
getSessionWithScopes: async (scopeListOrRequest) => {
|
|
377
|
-
|
|
378
|
-
//
|
|
379
|
-
//
|
|
380
|
-
//
|
|
381
|
-
|
|
376
|
+
getSessionWithScopes: async (scopeListOrRequest, options) => {
|
|
377
|
+
// A challenge (e.g. an MFA step-up) must always be able to prompt so the user can
|
|
378
|
+
// satisfy it. For a plain scope list we stay silent by default, but allow callers to
|
|
379
|
+
// opt in to an interactive consent prompt via `options.createIfNone` (used, for example,
|
|
380
|
+
// to consent to the App Service audience before a deployment).
|
|
381
|
+
// See https://github.com/microsoft/vscode-azurefunctions/issues/5073
|
|
382
|
+
const createIfNone = (0, isAuthenticationWwwAuthenticateRequest_1.isAuthenticationWwwAuthenticateRequest)(scopeListOrRequest) || !!options?.createIfNone;
|
|
383
|
+
if (createIfNone) {
|
|
384
|
+
// Interactive consent can take a while, so suppress without timeout until it is
|
|
385
|
+
// done, then silence for a bit longer afterwards (same pattern as `signIn`).
|
|
386
|
+
this.suppressRefreshSuggestedEvents = true;
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
this.silenceRefreshEvents();
|
|
390
|
+
}
|
|
391
|
+
const session = await (0, getSessionFromVSCode_1.getSessionFromVSCode)(scopeListOrRequest, tenant.tenantId, { ...(createIfNone ? { createIfNone: true } : { silent: true }), account: tenant.account });
|
|
392
|
+
if (createIfNone) {
|
|
393
|
+
this.silenceRefreshEvents();
|
|
394
|
+
}
|
|
382
395
|
if (!session) {
|
|
383
396
|
throw new NotSignedInError_1.NotSignedInError();
|
|
384
397
|
}
|
|
@@ -14,8 +14,21 @@ export interface AzureAuthentication {
|
|
|
14
14
|
* Gets a VS Code authentication session for an Azure subscription.
|
|
15
15
|
*
|
|
16
16
|
* @param scopeListOrRequest - The scopes or request for which the authentication is needed.
|
|
17
|
+
* @param options - (Optional) Options controlling how the session is acquired. By default a plain
|
|
18
|
+
* scope list is acquired silently; set `createIfNone` to allow an interactive consent prompt when
|
|
19
|
+
* no session for the requested scopes has been granted yet. Challenge requests always allow prompting.
|
|
17
20
|
*
|
|
18
21
|
* @returns A VS Code authentication session or undefined, if none could be obtained.
|
|
19
22
|
*/
|
|
20
|
-
getSessionWithScopes(scopeListOrRequest: string[] | vscode.AuthenticationWwwAuthenticateRequest): vscode.ProviderResult<vscode.AuthenticationSession>;
|
|
23
|
+
getSessionWithScopes(scopeListOrRequest: string[] | vscode.AuthenticationWwwAuthenticateRequest, options?: GetSessionWithScopesOptions): vscode.ProviderResult<vscode.AuthenticationSession>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Options for {@link AzureAuthentication.getSessionWithScopes}.
|
|
27
|
+
*/
|
|
28
|
+
export interface GetSessionWithScopesOptions {
|
|
29
|
+
/**
|
|
30
|
+
* Whether to allow an interactive prompt (sign in / consent) if no session for the requested
|
|
31
|
+
* scopes is already available. Defaults to `false`, in which case the session is acquired silently.
|
|
32
|
+
*/
|
|
33
|
+
createIfNone?: boolean;
|
|
21
34
|
}
|
|
@@ -337,12 +337,25 @@ export class AzureSubscriptionProviderBase {
|
|
|
337
337
|
}
|
|
338
338
|
return session;
|
|
339
339
|
},
|
|
340
|
-
getSessionWithScopes: async (scopeListOrRequest) => {
|
|
341
|
-
|
|
342
|
-
//
|
|
343
|
-
//
|
|
344
|
-
//
|
|
345
|
-
|
|
340
|
+
getSessionWithScopes: async (scopeListOrRequest, options) => {
|
|
341
|
+
// A challenge (e.g. an MFA step-up) must always be able to prompt so the user can
|
|
342
|
+
// satisfy it. For a plain scope list we stay silent by default, but allow callers to
|
|
343
|
+
// opt in to an interactive consent prompt via `options.createIfNone` (used, for example,
|
|
344
|
+
// to consent to the App Service audience before a deployment).
|
|
345
|
+
// See https://github.com/microsoft/vscode-azurefunctions/issues/5073
|
|
346
|
+
const createIfNone = isAuthenticationWwwAuthenticateRequest(scopeListOrRequest) || !!options?.createIfNone;
|
|
347
|
+
if (createIfNone) {
|
|
348
|
+
// Interactive consent can take a while, so suppress without timeout until it is
|
|
349
|
+
// done, then silence for a bit longer afterwards (same pattern as `signIn`).
|
|
350
|
+
this.suppressRefreshSuggestedEvents = true;
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
this.silenceRefreshEvents();
|
|
354
|
+
}
|
|
355
|
+
const session = await getSessionFromVSCode(scopeListOrRequest, tenant.tenantId, { ...(createIfNone ? { createIfNone: true } : { silent: true }), account: tenant.account });
|
|
356
|
+
if (createIfNone) {
|
|
357
|
+
this.silenceRefreshEvents();
|
|
358
|
+
}
|
|
346
359
|
if (!session) {
|
|
347
360
|
throw new NotSignedInError();
|
|
348
361
|
}
|
package/package.json
CHANGED