Skip to content

Commit 371441b

Browse files
authored
Merge branch 'main' into revert-262877-robo/update_electron
2 parents 447d351 + 25401aa commit 371441b

File tree

9 files changed

+69
-51
lines changed

9 files changed

+69
-51
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-oss-dev",
33
"version": "1.104.0",
4-
"distro": "38dbd6aa712cf6d7433b54fec2db3a801046fe9f",
4+
"distro": "b802cc7157ee5cf0fa2a622a98abae8c6a4d749d",
55
"author": {
66
"name": "Microsoft Corporation"
77
},

src/vs/workbench/api/browser/mainThreadAuthentication.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import { Disposable, DisposableMap } from '../../../base/common/lifecycle.js';
77
import * as nls from '../../../nls.js';
88
import { extHostNamedCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js';
9-
import { AuthenticationSession, AuthenticationSessionsChangeEvent, IAuthenticationProvider, IAuthenticationService, IAuthenticationExtensionsService, AuthenticationSessionAccount, IAuthenticationProviderSessionOptions, isAuthenticationSessionRequest, IAuthenticationConstraint } from '../../services/authentication/common/authentication.js';
10-
import { AuthenticationSessionRequest, ExtHostAuthenticationShape, ExtHostContext, MainContext, MainThreadAuthenticationShape } from '../common/extHost.protocol.js';
9+
import { AuthenticationSession, AuthenticationSessionsChangeEvent, IAuthenticationProvider, IAuthenticationService, IAuthenticationExtensionsService, AuthenticationSessionAccount, IAuthenticationProviderSessionOptions, isAuthenticationWWWAuthenticateRequest, IAuthenticationConstraint } from '../../services/authentication/common/authentication.js';
10+
import { AuthenticationWWWAuthenticateRequest, ExtHostAuthenticationShape, ExtHostContext, MainContext, MainThreadAuthenticationShape } from '../common/extHost.protocol.js';
1111
import { IDialogService, IPromptButton } from '../../../platform/dialogs/common/dialogs.js';
1212
import Severity from '../../../base/common/severity.js';
1313
import { INotificationService } from '../../../platform/notification/common/notification.js';
@@ -345,7 +345,7 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
345345
return result.result === chosenAccountLabel;
346346
}
347347

348-
private async doGetSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | AuthenticationSessionRequest, extensionId: string, extensionName: string, options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined> {
348+
private async doGetSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | AuthenticationWWWAuthenticateRequest, extensionId: string, extensionName: string, options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined> {
349349
const authorizationServer = URI.revive(options.authorizationServer);
350350
const sessions = await this.authenticationService.getSessions(providerId, scopeListOrRequest, { account: options.account, authorizationServer }, true);
351351
const provider = this.authenticationService.getProvider(providerId);
@@ -452,16 +452,16 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
452452
return undefined;
453453
}
454454

455-
async $getSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | AuthenticationSessionRequest, extensionId: string, extensionName: string, options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined> {
456-
const scopes = isAuthenticationSessionRequest(scopeListOrRequest) ? scopeListOrRequest.scopes : scopeListOrRequest;
455+
async $getSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | AuthenticationWWWAuthenticateRequest, extensionId: string, extensionName: string, options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined> {
456+
const scopes = isAuthenticationWWWAuthenticateRequest(scopeListOrRequest) ? scopeListOrRequest.scopes : scopeListOrRequest;
457457
if (scopes) {
458458
this.sendClientIdUsageTelemetry(extensionId, providerId, scopes);
459459
}
460460
const session = await this.doGetSession(providerId, scopeListOrRequest, extensionId, extensionName, options);
461461

462462
if (session) {
463463
this.sendProviderUsageTelemetry(extensionId, providerId);
464-
const scopes = isAuthenticationSessionRequest(scopeListOrRequest) ? scopeListOrRequest.scopes : scopeListOrRequest;
464+
const scopes = isAuthenticationWWWAuthenticateRequest(scopeListOrRequest) ? scopeListOrRequest.scopes : scopeListOrRequest;
465465
this.authenticationUsageService.addAccountUsage(providerId, session.account.label, scopes, extensionId, extensionName);
466466
}
467467

src/vs/workbench/api/common/extHost.api.impl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
301301
})();
302302

303303
const authentication: typeof vscode.authentication = {
304-
getSession(providerId: string, scopesOrChallenge: readonly string[] | vscode.AuthenticationSessionRequest, options?: vscode.AuthenticationGetSessionOptions) {
304+
getSession(providerId: string, scopesOrChallenge: readonly string[] | vscode.AuthenticationWWWAuthenticateRequest, options?: vscode.AuthenticationGetSessionOptions) {
305305
if (!Array.isArray(scopesOrChallenge)) {
306306
checkProposedApiEnabled(extension, 'authenticationChallenges');
307307
}

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ export interface AuthenticationChallenge {
188188
params: Record<string, string>;
189189
}
190190

191-
export interface AuthenticationSessionRequest {
192-
challenge: string;
191+
export interface AuthenticationWWWAuthenticateRequest {
192+
wwwAuthenticate: string;
193193
scopes?: readonly string[];
194194
}
195195

@@ -203,7 +203,7 @@ export interface MainThreadAuthenticationShape extends IDisposable {
203203
$registerAuthenticationProvider(id: string, label: string, supportsMultipleAccounts: boolean, supportedAuthorizationServers?: UriComponents[], supportsChallenges?: boolean): Promise<void>;
204204
$unregisterAuthenticationProvider(id: string): Promise<void>;
205205
$sendDidChangeSessions(providerId: string, event: AuthenticationSessionsChangeEvent): Promise<void>;
206-
$getSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | AuthenticationSessionRequest, extensionId: string, extensionName: string, options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined>;
206+
$getSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | AuthenticationWWWAuthenticateRequest, extensionId: string, extensionName: string, options: AuthenticationGetSessionOptions): Promise<AuthenticationSession | undefined>;
207207
$getAccounts(providerId: string): Promise<ReadonlyArray<AuthenticationSessionAccount>>;
208208
$removeSession(providerId: string, sessionId: string): Promise<void>;
209209
$waitForUriHandler(expectedUri: UriComponents): Promise<UriComponents>;

src/vs/workbench/api/common/extHostAuthentication.ts

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Emitter, Event } from '../../../base/common/event.js';
99
import { MainContext, MainThreadAuthenticationShape, ExtHostAuthenticationShape } from './extHost.protocol.js';
1010
import { Disposable, ProgressLocation } from './extHostTypes.js';
1111
import { IExtensionDescription, ExtensionIdentifier } from '../../../platform/extensions/common/extensions.js';
12-
import { INTERNAL_AUTH_PROVIDER_PREFIX, isAuthenticationSessionRequest } from '../../services/authentication/common/authentication.js';
12+
import { INTERNAL_AUTH_PROVIDER_PREFIX, isAuthenticationWWWAuthenticateRequest } from '../../services/authentication/common/authentication.js';
1313
import { createDecorator } from '../../../platform/instantiation/common/instantiation.js';
1414
import { IExtHostRpcService } from './extHostRpcService.js';
1515
import { URI, UriComponents } from '../../../base/common/uri.js';
@@ -79,19 +79,31 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
7979
);
8080
}
8181

82-
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationSessionRequest, options: vscode.AuthenticationGetSessionOptions & ({ createIfNone: true } | { forceNewSession: true } | { forceNewSession: vscode.AuthenticationForceNewSessionOptions })): Promise<vscode.AuthenticationSession>;
83-
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationSessionRequest, options: vscode.AuthenticationGetSessionOptions & { forceNewSession: true }): Promise<vscode.AuthenticationSession>;
84-
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationSessionRequest, options: vscode.AuthenticationGetSessionOptions & { forceNewSession: vscode.AuthenticationForceNewSessionOptions }): Promise<vscode.AuthenticationSession>;
85-
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationSessionRequest, options: vscode.AuthenticationGetSessionOptions): Promise<vscode.AuthenticationSession | undefined>;
86-
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationSessionRequest, options: vscode.AuthenticationGetSessionOptions = {}): Promise<vscode.AuthenticationSession | undefined> {
82+
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationWWWAuthenticateRequest, options: vscode.AuthenticationGetSessionOptions & ({ createIfNone: true } | { forceNewSession: true } | { forceNewSession: vscode.AuthenticationForceNewSessionOptions })): Promise<vscode.AuthenticationSession>;
83+
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationWWWAuthenticateRequest, options: vscode.AuthenticationGetSessionOptions & { forceNewSession: true }): Promise<vscode.AuthenticationSession>;
84+
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationWWWAuthenticateRequest, options: vscode.AuthenticationGetSessionOptions & { forceNewSession: vscode.AuthenticationForceNewSessionOptions }): Promise<vscode.AuthenticationSession>;
85+
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationWWWAuthenticateRequest, options: vscode.AuthenticationGetSessionOptions): Promise<vscode.AuthenticationSession | undefined>;
86+
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopesOrRequest: readonly string[] | vscode.AuthenticationWWWAuthenticateRequest, options: vscode.AuthenticationGetSessionOptions = {}): Promise<vscode.AuthenticationSession | undefined> {
8787
const extensionId = ExtensionIdentifier.toKey(requestingExtension.identifier);
8888
const keys: (keyof vscode.AuthenticationGetSessionOptions)[] = Object.keys(options) as (keyof vscode.AuthenticationGetSessionOptions)[];
8989
const optionsStr = keys.sort().map(key => `${key}:${!!options[key]}`).join(', ');
9090

91+
// old shape, remove next milestone
92+
if (
93+
'challenge' in scopesOrRequest
94+
&& typeof scopesOrRequest.challenge === 'string'
95+
&& !scopesOrRequest.wwwAuthenticate
96+
) {
97+
scopesOrRequest = {
98+
wwwAuthenticate: scopesOrRequest.challenge,
99+
scopes: scopesOrRequest.scopes
100+
};
101+
}
102+
91103
let singlerKey: string;
92-
if (isAuthenticationSessionRequest(scopesOrRequest)) {
93-
const challenge = scopesOrRequest as vscode.AuthenticationSessionRequest;
94-
const challengeStr = challenge.challenge;
104+
if (isAuthenticationWWWAuthenticateRequest(scopesOrRequest)) {
105+
const challenge = scopesOrRequest as vscode.AuthenticationWWWAuthenticateRequest;
106+
const challengeStr = challenge.wwwAuthenticate;
95107
const scopesStr = challenge.scopes ? [...challenge.scopes].sort().join(' ') : '';
96108
singlerKey = `${extensionId} ${providerId} challenge:${challengeStr} ${scopesStr} ${optionsStr}`;
97109
} else {

src/vs/workbench/services/authentication/browser/authenticationExtensionsService.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { IStorageService, StorageScope, StorageTarget } from '../../../../platfo
1616
import { IActivityService, NumberBadge } from '../../activity/common/activity.js';
1717
import { IAuthenticationAccessService } from './authenticationAccessService.js';
1818
import { IAuthenticationUsageService } from './authenticationUsageService.js';
19-
import { AuthenticationSession, IAuthenticationProvider, IAuthenticationService, IAuthenticationExtensionsService, AuthenticationSessionAccount, IAuthenticationSessionRequest, isAuthenticationSessionRequest } from '../common/authentication.js';
19+
import { AuthenticationSession, IAuthenticationProvider, IAuthenticationService, IAuthenticationExtensionsService, AuthenticationSessionAccount, IAuthenticationWWWAuthenticateRequest, isAuthenticationWWWAuthenticateRequest } from '../common/authentication.js';
2020
import { Emitter } from '../../../../base/common/event.js';
2121
import { IProductService } from '../../../../platform/product/common/productService.js';
2222
import { ExtensionIdentifier } from '../../../../platform/extensions/common/extensions.js';
@@ -287,7 +287,7 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth
287287
/**
288288
* This function should be used only when there are sessions to disambiguate.
289289
*/
290-
async selectSession(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationSessionRequest, availableSessions: AuthenticationSession[]): Promise<AuthenticationSession> {
290+
async selectSession(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWWWAuthenticateRequest, availableSessions: AuthenticationSession[]): Promise<AuthenticationSession> {
291291
const allAccounts = await this._authenticationService.getAccounts(providerId);
292292
if (!allAccounts.length) {
293293
throw new Error('No accounts available');
@@ -359,7 +359,7 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth
359359
});
360360
}
361361

362-
private async completeSessionAccessRequest(provider: IAuthenticationProvider, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationSessionRequest): Promise<void> {
362+
private async completeSessionAccessRequest(provider: IAuthenticationProvider, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWWWAuthenticateRequest): Promise<void> {
363363
const providerRequests = this._sessionAccessRequestItems.get(provider.id) || {};
364364
const existingRequest = providerRequests[extensionId];
365365
if (!existingRequest) {
@@ -390,7 +390,7 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth
390390
}
391391
}
392392

393-
requestSessionAccess(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationSessionRequest, possibleSessions: AuthenticationSession[]): void {
393+
requestSessionAccess(providerId: string, extensionId: string, extensionName: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWWWAuthenticateRequest, possibleSessions: AuthenticationSession[]): void {
394394
const providerRequests = this._sessionAccessRequestItems.get(providerId) || {};
395395
const hasExistingRequest = providerRequests[extensionId];
396396
if (hasExistingRequest) {
@@ -424,7 +424,7 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth
424424
this.updateBadgeCount();
425425
}
426426

427-
async requestNewSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationSessionRequest, extensionId: string, extensionName: string): Promise<void> {
427+
async requestNewSession(providerId: string, scopeListOrRequest: ReadonlyArray<string> | IAuthenticationWWWAuthenticateRequest, extensionId: string, extensionName: string): Promise<void> {
428428
if (!this._authenticationService.isAuthenticationProviderRegistered(providerId)) {
429429
// Activate has already been called for the authentication provider, but it cannot block on registering itself
430430
// since this is sync and returns a disposable. So, wait for registration event to fire that indicates the
@@ -447,8 +447,8 @@ export class AuthenticationExtensionsService extends Disposable implements IAuth
447447
}
448448

449449
const providerRequests = this._signInRequestItems.get(providerId);
450-
const signInRequestKey = isAuthenticationSessionRequest(scopeListOrRequest)
451-
? `${scopeListOrRequest.challenge}:${scopeListOrRequest.scopes?.join(SCOPESLIST_SEPARATOR) ?? ''}`
450+
const signInRequestKey = isAuthenticationWWWAuthenticateRequest(scopeListOrRequest)
451+
? `${scopeListOrRequest.wwwAuthenticate}:${scopeListOrRequest.scopes?.join(SCOPESLIST_SEPARATOR) ?? ''}`
452452
: `${scopeListOrRequest.join(SCOPESLIST_SEPARATOR)}`;
453453
const extensionHasExistingRequest = providerRequests
454454
&& providerRequests[signInRequestKey]

0 commit comments

Comments
 (0)