mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
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:
@@ -171,6 +171,7 @@ export interface IConnectionManagementService {
|
||||
|
||||
isConnected(fileUri: string): boolean;
|
||||
|
||||
refreshAzureAccountTokenIfNecessary(uri: string): Promise<boolean>;
|
||||
/**
|
||||
* Returns true if the connection profile is connected
|
||||
*/
|
||||
|
||||
@@ -66,6 +66,10 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa
|
||||
if (model.options.registeredServerDescription) {
|
||||
this.registeredServerDescription = model.options.registeredServerDescription;
|
||||
}
|
||||
const expiry = model.options.expiresOn;
|
||||
if (typeof expiry === 'number' && !Number.isNaN(expiry)) {
|
||||
this.options.expiresOn = model.options.expiresOn;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//Default for a new connection
|
||||
|
||||
@@ -309,4 +309,8 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
||||
getConnection(uri: string): ConnectionProfile {
|
||||
return undefined!;
|
||||
}
|
||||
|
||||
refreshAzureAccountTokenIfNecessary(uri: string): Promise<boolean> {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user