Skip to content

Commit

Permalink
Fix dependabot-vscode-azext-utils-2.5.4 (#859)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tatsinnit authored Aug 15, 2024
1 parent 87830d7 commit 108bfc9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
20 changes: 11 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@
"@azure/ms-rest-azure-env": "^2.0.0",
"@azure/storage-blob": "^12.24.0",
"@microsoft/microsoft-graph-client": "^3.0.7",
"@microsoft/vscode-azext-utils": "^2.5.1",
"@microsoft/vscode-azext-utils": "^2.5.4",
"@octokit/rest": "^21.0.1",
"@vscode/extension-telemetry": "^0.9.7",
"decompress": "^4.2.1",
Expand Down
13 changes: 13 additions & 0 deletions src/tree/azureAccountTreeItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { getCredential, getEnvironment } from "../auth/azureAuth";
import { SelectionType, getSubscriptions } from "../commands/utils/subscriptions";
import { Subscription } from "@azure/arm-resources-subscriptions";
import { AzureSessionProvider, ReadyAzureSessionProvider, isReady } from "../auth/types";
import { TokenCredential } from "@azure/identity";

export function createAzureAccountTreeItem(
sessionProvider: AzureSessionProvider,
Expand Down Expand Up @@ -200,5 +201,17 @@ function getSubscriptionContext(
userId: session.account.id,
environment,
isCustomCloud: environment.name === "AzureCustomCloud",
createCredentialsForScopes: async (scopes: string[]): Promise<TokenCredential> => {
const authSession = await sessionProvider.getAuthSession({ scopes });
if (failed(authSession)) {
throw new Error(`No Microsoft authentication session found: ${authSession.error}`);
}

return {
getToken: async () => {
return { token: authSession.result.accessToken, expiresOnTimestamp: 0 };
},
};
}
};
}

0 comments on commit 108bfc9

Please sign in to comment.