Add versioning for accounts (#11497)

* Add versioning for accounts

* deletion value
This commit is contained in:
Amir Omidi
2020-07-23 19:13:44 -07:00
committed by GitHub
parent 83211d6e2d
commit 5b8039379e
3 changed files with 53 additions and 38 deletions

View File

@@ -29,6 +29,7 @@ const localize = nls.loadMessageBundle();
export abstract class AzureAuth implements vscode.Disposable {
public static ACCOUNT_VERSION = '2.0';
protected readonly memdb = new MemoryDatabase<string>();
protected readonly WorkSchoolAccountType: string = 'work_school';
@@ -110,6 +111,11 @@ export abstract class AzureAuth implements vscode.Disposable {
}
public async refreshAccess(account: AzureAccount): Promise<AzureAccount> {
// Deprecated account - delete it.
if (account.key.accountVersion !== AzureAuth.ACCOUNT_VERSION) {
account.delete = true;
return account;
}
try {
const tenant = this.getHomeTenant(account);
const tokenResult = await this.getAccountSecurityToken(account, tenant.id, azdata.AzureResource.MicrosoftResourceManagement);
@@ -505,7 +511,8 @@ export abstract class AzureAuth implements vscode.Disposable {
const account = {
key: {
providerId: this.metadata.id,
accountId: key
accountId: key,
accountVersion: AzureAuth.ACCOUNT_VERSION,
},
name: displayName,
displayInfo: {