mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 03:54:24 +01:00
Misc fixes for Sovereign Clouds (#228591)
* Misc fixes for Sovereign Clouds * For now, use the URL handler since the main flow doesn't work right now because the localhost redirect url needs to be in those environments * Includes the name of the cloud in the PCAs so that we have separation between the auth providers * extra logging for the URL Handler * fix tests
This commit is contained in:
committed by
GitHub
parent
3fd5eb3429
commit
6bd8e90fb7
@@ -5,7 +5,7 @@
|
||||
|
||||
import type { ILoopbackClient, ServerAuthorizationCodeResponse } from '@azure/msal-node';
|
||||
import type { UriEventHandler } from '../UriEventHandler';
|
||||
import { env, Uri } from 'vscode';
|
||||
import { env, LogOutputChannel, Uri } from 'vscode';
|
||||
import { toPromise } from './async';
|
||||
|
||||
export interface ILoopbackClientAndOpener extends ILoopbackClient {
|
||||
@@ -15,12 +15,13 @@ export interface ILoopbackClientAndOpener extends ILoopbackClient {
|
||||
export class UriHandlerLoopbackClient implements ILoopbackClientAndOpener {
|
||||
constructor(
|
||||
private readonly _uriHandler: UriEventHandler,
|
||||
private readonly _redirectUri: string
|
||||
private readonly _redirectUri: string,
|
||||
private readonly _logger: LogOutputChannel
|
||||
) { }
|
||||
|
||||
async listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<ServerAuthorizationCodeResponse> {
|
||||
console.log(successTemplate, errorTemplate);
|
||||
async listenForAuthCode(): Promise<ServerAuthorizationCodeResponse> {
|
||||
const url = await toPromise(this._uriHandler.event);
|
||||
this._logger.debug(`Received URL event. Authority: ${url.authority}`);
|
||||
const result = new URL(url.toString(true));
|
||||
|
||||
return {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { env, Uri } from 'vscode';
|
||||
import { env, Uri, window } from 'vscode';
|
||||
import * as sinon from 'sinon';
|
||||
import { UriHandlerLoopbackClient } from '../loopbackClientAndOpener';
|
||||
import { UriEventHandler } from '../../UriEventHandler';
|
||||
@@ -22,7 +22,7 @@ suite('UriHandlerLoopbackClient', () => {
|
||||
envStub.openExternal.resolves(true);
|
||||
envStub.asExternalUri.callThrough();
|
||||
uriHandler = new UriEventHandler();
|
||||
client = new UriHandlerLoopbackClient(uriHandler, redirectUri);
|
||||
client = new UriHandlerLoopbackClient(uriHandler, redirectUri, window.createOutputChannel('test', { log: true }));
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
|
||||
Reference in New Issue
Block a user