mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Support sovereign/custom clouds in microsoft authentication provider (#178725)
This commit is contained in:
committed by
GitHub
parent
d74f53ef2a
commit
f9d14d68fb
@@ -81,11 +81,13 @@ export class BetterTokenStorage<T> {
|
||||
return tokens.get(key);
|
||||
}
|
||||
|
||||
async getAll(): Promise<T[]> {
|
||||
async getAll(predicate?: (item: T) => boolean): Promise<T[]> {
|
||||
const tokens = await this.getTokens();
|
||||
const values = new Array<T>();
|
||||
for (const [_, value] of tokens) {
|
||||
values.push(value);
|
||||
if (!predicate || predicate(value)) {
|
||||
values.push(value);
|
||||
}
|
||||
}
|
||||
return values;
|
||||
}
|
||||
@@ -141,11 +143,13 @@ export class BetterTokenStorage<T> {
|
||||
this._operationInProgress = false;
|
||||
}
|
||||
|
||||
async deleteAll(): Promise<void> {
|
||||
async deleteAll(predicate?: (item: T) => boolean): Promise<void> {
|
||||
const tokens = await this.getTokens();
|
||||
const promises = [];
|
||||
for (const [key] of tokens) {
|
||||
promises.push(this.delete(key));
|
||||
for (const [key, value] of tokens) {
|
||||
if (!predicate || predicate(value)) {
|
||||
promises.push(this.delete(key));
|
||||
}
|
||||
}
|
||||
await Promise.all(promises);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user