Add token expiration handling for AzureMFA auth (#16936)

* refresh azure account token if it's expired before sending query/list requests

* fix several connection checks && add more logging

* fix async UI glitch during token refreshing

* cleanup

* minor fix

* add test for refreshAzureAccountTokenIfNecessary

* address comments

* comments

* comments

* comments

* error handling
This commit is contained in:
Hai Cao
2021-09-02 17:24:45 -07:00
committed by GitHub
parent 73c20345e9
commit 0bc2a50d78
9 changed files with 171 additions and 4 deletions

View File

@@ -206,6 +206,7 @@ export class RunQueryAction extends QueryTaskbarAction {
public override async run(): Promise<void> {
if (!this.editor.isSelectionEmpty()) {
await this.connectionManagementService.refreshAzureAccountTokenIfNecessary(this.editor.input.uri);
if (this.isConnected(this.editor)) {
// If we are already connected, run the query
this.runQuery(this.editor);
@@ -220,6 +221,7 @@ export class RunQueryAction extends QueryTaskbarAction {
public async runCurrent(): Promise<void> {
if (!this.editor.isSelectionEmpty()) {
await this.connectionManagementService.refreshAzureAccountTokenIfNecessary(this.editor.input.uri);
if (this.isConnected(this.editor)) {
// If we are already connected, run the query
this.runQuery(this.editor, true);
@@ -307,6 +309,7 @@ export class EstimatedQueryPlanAction extends QueryTaskbarAction {
public override async run(): Promise<void> {
if (!this.editor.isSelectionEmpty()) {
await this.connectionManagementService.refreshAzureAccountTokenIfNecessary(this.editor.input.uri);
if (this.isConnected(this.editor)) {
// If we are already connected, run the query
this.runQuery(this.editor);
@@ -346,6 +349,7 @@ export class ActualQueryPlanAction extends QueryTaskbarAction {
public override async run(): Promise<void> {
if (!this.editor.isSelectionEmpty()) {
await this.connectionManagementService.refreshAzureAccountTokenIfNecessary(this.editor.input.uri);
if (this.isConnected(this.editor)) {
// If we are already connected, run the query
this.runQuery(this.editor);