ソースを参照

Ensures that logout actually removes all sessions

main
Eric Amodio 2年前
コミット
26e69fc31d
2個のファイルの変更41行の追加0行の削除
  1. +36
    -0
      src/plus/subscription/authenticationProvider.ts
  2. +5
    -0
      src/plus/subscription/subscriptionService.ts

+ 36
- 0
src/plus/subscription/authenticationProvider.ts ファイルの表示

@ -138,6 +138,42 @@ export class SubscriptionAuthenticationProvider implements AuthenticationProvide
}
}
@debug()
public async removeSessionsByScopes(scopes?: string[]) {
const cc = Logger.getCorrelationContext();
try {
scopes = scopes?.sort();
const scopesKey = getScopesKey(scopes);
const removed: AuthenticationSession[] = [];
let index = 0;
const sessions = await this._sessionsPromise;
for (const session of sessions) {
if (getScopesKey(session.scopes) !== scopesKey) {
index++;
continue;
}
sessions.splice(index, 1);
removed.push(session);
}
if (removed.length === 0) return;
await this.storeSessions(sessions);
this._onDidChangeSessions.fire({ added: [], removed: removed, changed: [] });
} catch (ex) {
Logger.error(ex, cc);
void window.showErrorMessage(`Unable to sign out of GitLens+: ${ex}`);
throw ex;
}
}
private _migrated: boolean | undefined;
async tryMigrateSession(): Promise<AuthenticationSession | undefined> {
if (this._migrated == null) {

+ 5
- 0
src/plus/subscription/subscriptionService.ts ファイルの表示

@ -282,6 +282,11 @@ export class SubscriptionService implements Disposable {
if (this._session != null) {
void this.container.subscriptionAuthentication.removeSession(this._session.id);
this._session = undefined;
} else {
// Even if we don't have a session, make sure to remove any other matching sessions
void this.container.subscriptionAuthentication.removeSessionsByScopes(
SubscriptionService.authenticationScopes,
);
}
if (reset && this.container.debugging) {

読み込み中…
キャンセル
保存