Address feedback on auth provider API

This commit is contained in:
Rachel Macfarlane
2020-07-16 16:03:17 -07:00
parent 0d1933a322
commit a155fcf762
6 changed files with 14 additions and 47 deletions

View File

@@ -205,9 +205,6 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
get providers(): ReadonlyArray<vscode.AuthenticationProviderInformation> {
return extHostAuthentication.providers;
},
hasSessions(providerId: string, scopes: string[]): Thenable<boolean> {
return extHostAuthentication.hasSessions(providerId, scopes);
},
getSession(providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions) {
return extHostAuthentication.getSession(extension, providerId, scopes, options as any);
},
@@ -1103,8 +1100,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
TimelineItem: extHostTypes.TimelineItem,
CellKind: extHostTypes.CellKind,
CellOutputKind: extHostTypes.CellOutputKind,
NotebookCellRunState: extHostTypes.NotebookCellRunState,
AuthenticationSession: extHostTypes.AuthenticationSession
NotebookCellRunState: extHostTypes.NotebookCellRunState
};
};
}

View File

@@ -40,25 +40,6 @@ export class ExtHostAuthentication implements ExtHostAuthenticationShape {
return Object.freeze(this._providers);
}
private async resolveSessions(providerId: string): Promise<ReadonlyArray<modes.AuthenticationSession>> {
const provider = this._authenticationProviders.get(providerId);
let sessions;
if (!provider) {
sessions = await this._proxy.$getSessions(providerId);
} else {
sessions = await provider.getSessions();
}
return sessions;
}
async hasSessions(providerId: string, scopes: string[]): Promise<boolean> {
const orderedScopes = scopes.sort().join(' ');
const sessions = await this.resolveSessions(providerId);
return !!(sessions.filter(session => session.scopes.slice().sort().join(' ') === orderedScopes).length);
}
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions & { createIfNone: true }): Promise<vscode.AuthenticationSession>;
async getSession(requestingExtension: IExtensionDescription, providerId: string, scopes: string[], options: vscode.AuthenticationGetSessionOptions): Promise<vscode.AuthenticationSession | undefined> {
const provider = this._authenticationProviders.get(providerId);

View File

@@ -2774,13 +2774,6 @@ export enum ExtensionMode {
//#endregion ExtensionContext
//#region Authentication
export class AuthenticationSession implements vscode.AuthenticationSession {
constructor(public id: string, public accessToken: string, public account: { label: string, id: string }, public scopes: string[]) { }
}
//#endregion Authentication
export enum StandardTokenType {
Other = 0,
Comment = 1,