Enable Azure Active Directory MFA authentication (#3125)

This commit is contained in:
Matt Irvine
2018-11-27 11:13:47 -08:00
committed by GitHub
parent d646b4729b
commit cb72865dcc
33 changed files with 369 additions and 109 deletions

View File

@@ -89,12 +89,12 @@ export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
return Promise.all(promises).then(() => resultAccounts);
}
public $getSecurityToken(account: sqlops.Account): Thenable<{}> {
public $getSecurityToken(account: sqlops.Account, resource: sqlops.AzureResource): Thenable<{}> {
return this.$getAllAccounts().then(() => {
for (const handle in this._accounts) {
const providerHandle = parseInt(handle);
if (this._accounts[handle].findIndex((acct) => acct.key.accountId === account.key.accountId) !== -1) {
return this._withProvider(providerHandle, (provider: sqlops.AccountProvider) => provider.getSecurityToken(account));
return this._withProvider(providerHandle, (provider: sqlops.AccountProvider) => provider.getSecurityToken(account, resource));
}
}

View File

@@ -76,8 +76,8 @@ export class MainThreadAccountManagement implements MainThreadAccountManagementS
clear(accountKey: sqlops.AccountKey): Thenable<void> {
return self._proxy.$clear(handle, accountKey);
},
getSecurityToken(account: sqlops.Account): Thenable<{}> {
return self._proxy.$getSecurityToken(account);
getSecurityToken(account: sqlops.Account, resource: sqlops.AzureResource): Thenable<{}> {
return self._proxy.$getSecurityToken(account, resource);
},
initialize(restoredAccounts: sqlops.Account[]): Thenable<sqlops.Account[]> {
return self._proxy.$initialize(handle, restoredAccounts);

View File

@@ -97,8 +97,8 @@ export function createApiFactory(
getAllAccounts(): Thenable<sqlops.Account[]> {
return extHostAccountManagement.$getAllAccounts();
},
getSecurityToken(account: sqlops.Account): Thenable<{}> {
return extHostAccountManagement.$getSecurityToken(account);
getSecurityToken(account: sqlops.Account, resource: sqlops.AzureResource): Thenable<{}> {
return extHostAccountManagement.$getSecurityToken(account, resource);
},
onDidChangeAccounts(listener: (e: sqlops.DidChangeAccountsParams) => void, thisArgs?: any, disposables?: extHostTypes.Disposable[]) {
return extHostAccountManagement.onDidChangeAccounts(listener, thisArgs, disposables);
@@ -452,7 +452,8 @@ export function createApiFactory(
Orientation: sqlExtHostTypes.Orientation,
SqlThemeIcon: sqlExtHostTypes.SqlThemeIcon,
TreeComponentItem: sqlExtHostTypes.TreeComponentItem,
nb: nb
nb: nb,
AzureResource: sqlExtHostTypes.AzureResource
};
}
};

View File

@@ -27,7 +27,7 @@ import {
export abstract class ExtHostAccountManagementShape {
$autoOAuthCancelled(handle: number): Thenable<void> { throw ni(); }
$clear(handle: number, accountKey: sqlops.AccountKey): Thenable<void> { throw ni(); }
$getSecurityToken(account: sqlops.Account): Thenable<{}> { throw ni(); }
$getSecurityToken(account: sqlops.Account, resource?: sqlops.AzureResource): Thenable<{}> { throw ni(); }
$initialize(handle: number, restoredAccounts: sqlops.Account[]): Thenable<sqlops.Account[]> { throw ni(); }
$prompt(handle: number): Thenable<sqlops.Account> { throw ni(); }
$refresh(handle: number, account: sqlops.Account): Thenable<sqlops.Account> { throw ni(); }