mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fix azure account tree subscription check (#16822)
* Fix azure account tree subscription check * comment
This commit is contained in:
16
src/sql/azdata.d.ts
vendored
16
src/sql/azdata.d.ts
vendored
@@ -2175,6 +2175,20 @@ declare module 'azdata' {
|
||||
*/
|
||||
export function getSecurityToken(account: Account, resource?: AzureResource): Thenable<{ [key: string]: any }>;
|
||||
|
||||
/**
|
||||
* The token used to authenticate an account.
|
||||
*/
|
||||
export interface AccountSecurityToken {
|
||||
/**
|
||||
* The token to use
|
||||
*/
|
||||
token: string,
|
||||
/**
|
||||
* What type of token this is (such as Bearer)
|
||||
*/
|
||||
tokenType?: string | undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a security token by asking the account's provider
|
||||
* @param account The account to retrieve the security token for
|
||||
@@ -2182,7 +2196,7 @@ declare module 'azdata' {
|
||||
* @param resource Type of resource to get the security token for (defaults to
|
||||
* AzureResource.ResourceManagement if not given)
|
||||
*/
|
||||
export function getAccountSecurityToken(account: Account, tenantId: string, resource: AzureResource): Thenable<{ token: string, tokenType?: string | undefined } | undefined>;
|
||||
export function getAccountSecurityToken(account: Account, tenantId: string, resource: AzureResource): Thenable<AccountSecurityToken | undefined>;
|
||||
|
||||
/**
|
||||
* An [event](#Event) which fires when the accounts have changed.
|
||||
|
||||
2
src/sql/azdata.proposed.d.ts
vendored
2
src/sql/azdata.proposed.d.ts
vendored
@@ -836,7 +836,7 @@ declare module 'azdata' {
|
||||
* @param resource The resource to get the token for
|
||||
* @return Promise to return a security token object
|
||||
*/
|
||||
getAccountSecurityToken(account: Account, tenant: string, resource: AzureResource): Thenable<{ token: string } | undefined>;
|
||||
getAccountSecurityToken(account: Account, tenant: string, resource: AzureResource): Thenable<accounts.AccountSecurityToken | undefined>;
|
||||
}
|
||||
|
||||
export interface AccountKey {
|
||||
|
||||
@@ -25,7 +25,7 @@ export interface IAccountManagementService {
|
||||
* @deprecated
|
||||
*/
|
||||
getSecurityToken(account: azdata.Account, resource: azdata.AzureResource): Promise<{ [key: string]: { token: string } } | undefined>;
|
||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Promise<{ token: string } | undefined>;
|
||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Promise<azdata.accounts.AccountSecurityToken | undefined>;
|
||||
removeAccount(accountKey: azdata.AccountKey): Promise<boolean>;
|
||||
removeAccounts(): Promise<boolean>;
|
||||
refreshAccount(account: azdata.Account): Promise<azdata.Account>;
|
||||
|
||||
@@ -55,7 +55,7 @@ export class TestAccountManagementService implements IAccountManagementService {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Promise<{ token: string }> {
|
||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Promise<azdata.accounts.AccountSecurityToken> {
|
||||
return Promise.resolve(undefined!);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ export class MainThreadAccountManagement extends Disposable implements MainThrea
|
||||
getSecurityToken(account: azdata.Account, resource: azdata.AzureResource): Thenable<{}> {
|
||||
return self._proxy.$getSecurityToken(account, resource);
|
||||
},
|
||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Thenable<{ token: string }> {
|
||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Thenable<azdata.accounts.AccountSecurityToken> {
|
||||
return self._proxy.$getAccountSecurityToken(account, tenant, resource);
|
||||
},
|
||||
initialize(restoredAccounts: azdata.Account[]): Thenable<azdata.Account[]> {
|
||||
|
||||
@@ -104,7 +104,7 @@ export class ExtHostAccountManagement extends ExtHostAccountManagementShape {
|
||||
});
|
||||
}
|
||||
|
||||
public override $getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource = AzureResource.ResourceManagement): Thenable<{ token: string }> {
|
||||
public override $getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource = AzureResource.ResourceManagement): Thenable<azdata.accounts.AccountSecurityToken> {
|
||||
return this.getAllProvidersAndAccounts().then(providerAndAccounts => {
|
||||
const providerAndAccount = providerAndAccounts.find(providerAndAccount => providerAndAccount.account.key.accountId === account.key.accountId);
|
||||
if (providerAndAccount) {
|
||||
|
||||
@@ -165,7 +165,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
||||
getSecurityToken(account: azdata.Account, resource?: azdata.AzureResource): Thenable<{}> {
|
||||
return extHostAccountManagement.$getSecurityToken(account, resource);
|
||||
},
|
||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource?: azdata.AzureResource): Thenable<{ token: string }> {
|
||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource?: azdata.AzureResource): Thenable<azdata.accounts.AccountSecurityToken> {
|
||||
return extHostAccountManagement.$getAccountSecurityToken(account, tenant, resource);
|
||||
},
|
||||
onDidChangeAccounts(listener: (e: azdata.DidChangeAccountsParams) => void, thisArgs?: any, disposables?: extHostTypes.Disposable[]) {
|
||||
|
||||
@@ -32,7 +32,7 @@ export abstract class ExtHostAccountManagementShape {
|
||||
$autoOAuthCancelled(handle: number): Thenable<void> { throw ni(); }
|
||||
$clear(handle: number, accountKey: azdata.AccountKey): Thenable<void> { throw ni(); }
|
||||
$getSecurityToken(account: azdata.Account, resource?: azdata.AzureResource): Thenable<{}> { throw ni(); }
|
||||
$getAccountSecurityToken(account: azdata.Account, tenant: string, resource?: azdata.AzureResource): Thenable<{ token: string }> { throw ni(); }
|
||||
$getAccountSecurityToken(account: azdata.Account, tenant: string, resource?: azdata.AzureResource): Thenable<azdata.accounts.AccountSecurityToken> { throw ni(); }
|
||||
$initialize(handle: number, restoredAccounts: azdata.Account[]): Thenable<azdata.Account[]> { throw ni(); }
|
||||
$prompt(handle: number): Thenable<azdata.Account | azdata.PromptFailedResult> { throw ni(); }
|
||||
$refresh(handle: number, account: azdata.Account): Thenable<azdata.Account | azdata.PromptFailedResult> { throw ni(); }
|
||||
|
||||
@@ -246,7 +246,7 @@ export class AccountManagementService implements IAccountManagementService {
|
||||
* @param resource The resource to get the security token for
|
||||
* @return Promise to return the security token
|
||||
*/
|
||||
public getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Promise<{ token: string } | undefined> {
|
||||
public getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Promise<azdata.accounts.AccountSecurityToken | undefined> {
|
||||
return this.doWithProvider(account.key.providerId, provider => {
|
||||
return Promise.resolve(provider.provider.getAccountSecurityToken(account, tenant, resource));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user