Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/test/simulation/fixtures/edit/issue-release-142/testAuthProvider.ts
13405 views
1
import { AuthenticationForceNewSessionOptions, AuthenticationProvider, AuthenticationProviderAuthenticationSessionsChangeEvent, AuthenticationSession, Event, EventEmitter } from "vscode";
2
3
export class TestAuthProvider implements AuthenticationProvider {
4
private _onDidChangeSessions = new EventEmitter<AuthenticationProviderAuthenticationSessionsChangeEvent>();
5
onDidChangeSessions: Event<AuthenticationProviderAuthenticationSessionsChangeEvent> = this._onDidChangeSessions.event;
6
7
private _sessions: AuthenticationSession[] = [
8
{
9
id: "session1",
10
accessToken: "dummyToken1",
11
scopes: ["scope"],
12
account: { label: "Dummy Account 1", id: "dummyAccount1" }
13
},
14
{
15
id: "session2",
16
accessToken: "dummyToken2",
17
scopes: ["scope"],
18
account: { label: "Dummy Account 2", id: "dummyAccount2" }
19
}
20
];
21
22
getSessions(scopes?: readonly string[] | undefined): Thenable<readonly AuthenticationSession[]> {
23
return Promise.resolve(this._sessions.filter(session => !scopes || scopes.every(scope => session.scopes.indexOf(scope) !== -1)));
24
}
25
createSession(scopes: readonly string[], options?: AuthenticationForceNewSessionOptions): Thenable<AuthenticationSession> {
26
27
}
28
removeSession(sessionId: string): Thenable<void> {
29
30
}
31
}
32
33