Add codeExchangeProxyEndpoints to web api

This commit is contained in:
Rachel Macfarlane 2020-07-24 12:38:43 -07:00
parent b2d1932f68
commit 33659eda9f
3 changed files with 15 additions and 1 deletions

View file

@ -471,7 +471,10 @@ export class AzureActiveDirectoryService {
redirect_uri: redirectUrl
});
const result = await fetch(`${loginEndpointUrl}${tenant}/oauth2/v2.0/token`, {
const proxyEndpoints: { [providerId: string]: string } | undefined = await vscode.commands.executeCommand('workbench.getCodeExchangeProxyEndpoints');
const endpoint = proxyEndpoints && proxyEndpoints['microsoft'] || `${loginEndpointUrl}${tenant}/oauth2/v2.0/token`;
const result = await fetch(endpoint, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',

View file

@ -15,6 +15,7 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IActivityService, NumberBadge } from 'vs/workbench/services/activity/common/activity';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
export function getAuthenticationProviderActivationEvent(id: string): string { return `onAuthenticationRequest${id}`; }
@ -70,6 +71,11 @@ export interface SessionRequestInfo {
[scopes: string]: SessionRequest;
}
CommandsRegistry.registerCommand('workbench.getCodeExchangeProxyEndpoints', function (accessor, _) {
const environmentService = accessor.get(IWorkbenchEnvironmentService);
return environmentService.options?.codeExchangeProxyEndpoints;
});
export class AuthenticationService extends Disposable implements IAuthenticationService {
declare readonly _serviceBrand: undefined;
private _placeholderMenuItem: IDisposable | undefined;

View file

@ -345,6 +345,11 @@ interface IWorkbenchConstructionOptions {
*/
readonly driver?: boolean;
/**
* Endpoints to be used for proxying authentication code exchange calls in the browser.
*/
readonly codeExchangeProxyEndpoints?: { [providerId: string]: string }
//#endregion
}