Pass scopes through to authentication providers

This commit is contained in:
Rachel Macfarlane
2021-02-11 12:28:17 -08:00
parent a7758e4328
commit 650906c369
14 changed files with 82 additions and 39 deletions

View File

@@ -8,6 +8,7 @@ import { v4 as uuid } from 'uuid';
import { Keychain } from './common/keychain';
import { GitHubServer, NETWORK_ERROR } from './githubServer';
import Logger from './common/logger';
import { arrayEquals } from './common/utils';
export const onDidChangeSessions = new vscode.EventEmitter<vscode.AuthenticationProviderAuthenticationSessionsChangeEvent>();
@@ -43,6 +44,10 @@ export class GitHubAuthenticationProvider {
context.subscriptions.push(context.secrets.onDidChange(() => this.checkForUpdates()));
}
async getSessions(scopes: string[]): Promise<vscode.AuthenticationSession[]> {
return this._sessions.filter(session => arrayEquals(session.scopes, scopes));
}
private async verifySessions(): Promise<void> {
const verifiedSessions: vscode.AuthenticationSession[] = [];
const verificationPromises = this._sessions.map(async session => {