Skip to content

Commit

Permalink
PR feedback to live that lazy load life
Browse files Browse the repository at this point in the history
  • Loading branch information
nturinski committed May 6, 2024
1 parent 41cea33 commit b9d5e6f
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 31 deletions.
104 changes: 75 additions & 29 deletions auth/package-lock.json

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

1 change: 1 addition & 0 deletions auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"dependencies": {
"@azure/arm-resources-subscriptions": "^2.1.0",
"@azure/core-client": "^1.9.2",
"@azure/core-rest-pipeline": "^1.16.0",
"@azure/ms-rest-azure-env": "^2.0.0"
}
}
5 changes: 3 additions & 2 deletions auth/src/AzureDevOpsSubscriptionProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@

import type { SubscriptionClient, TenantIdDescription } from '@azure/arm-resources-subscriptions';
import type { TokenCredential } from '@azure/core-auth'; // Keep this as `import type` to avoid actually loading the package (at all, this one is dev-only)
import { ServiceClient } from '@azure/core-client';
import { createHttpHeaders, createPipelineRequest, type PipelineRequest } from '@azure/core-rest-pipeline';
import { Disposable, Event } from 'vscode';
import { AzureAuthentication } from './AzureAuthentication';
import { AzureSubscription } from './AzureSubscription';
import { AzureSubscriptionProvider } from './AzureSubscriptionProvider';
import { getConfiguredAzureEnv } from './utils/configuredAzureEnv';
import type { PipelineRequest } from '@azure/core-rest-pipeline';

let azureDevOpsSubscriptionProvider: AzureDevOpsSubscriptionProvider | undefined;
export function createAzureDevOpsSubscriptionProviderFactory(): () => Promise<AzureDevOpsSubscriptionProvider> {
Expand Down Expand Up @@ -208,6 +207,8 @@ async function getTokenCredential(serviceConnectionId: string, domain: string, c
* API reference: https://learn.microsoft.com/en-us/rest/api/azure/devops/distributedtask/oidctoken/create
*/
async function requestOidcToken(oidcRequestUrl: string, systemAccessToken: string): Promise<string> {
const { ServiceClient } = await import('@azure/core-client');
const { createHttpHeaders, createPipelineRequest } = await import('@azure/core-rest-pipeline');
const genericClient = new ServiceClient();
const request: PipelineRequest = createPipelineRequest({
url: oidcRequestUrl,
Expand Down

0 comments on commit b9d5e6f

Please sign in to comment.