@azure/identity 3.2.3-alpha.20230620.4 → 3.2.3-alpha.20230721.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @azure/identity might be problematic. Click here for more details.

package/dist/index.js CHANGED
@@ -2282,6 +2282,11 @@ class ManagedIdentityCredential {
2282
2282
  cloudDiscoveryMetadata: '{"tenant_discovery_endpoint":"https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration","api-version":"1.1","metadata":[{"preferred_network":"login.microsoftonline.com","preferred_cache":"login.windows.net","aliases":["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{"preferred_network":"login.partner.microsoftonline.cn","preferred_cache":"login.partner.microsoftonline.cn","aliases":["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{"preferred_network":"login.microsoftonline.de","preferred_cache":"login.microsoftonline.de","aliases":["login.microsoftonline.de"]},{"preferred_network":"login.microsoftonline.us","preferred_cache":"login.microsoftonline.us","aliases":["login.microsoftonline.us","login.usgovcloudapi.net"]},{"preferred_network":"login-us.microsoftonline.com","preferred_cache":"login-us.microsoftonline.com","aliases":["login-us.microsoftonline.com"]}]}',
2283
2283
  authorityMetadata: '{"token_endpoint":"https://login.microsoftonline.com/common/oauth2/v2.0/token","token_endpoint_auth_methods_supported":["client_secret_post","private_key_jwt","client_secret_basic"],"jwks_uri":"https://login.microsoftonline.com/common/discovery/v2.0/keys","response_modes_supported":["query","fragment","form_post"],"subject_types_supported":["pairwise"],"id_token_signing_alg_values_supported":["RS256"],"response_types_supported":["code","id_token","code id_token","id_token token"],"scopes_supported":["openid","profile","email","offline_access"],"issuer":"https://login.microsoftonline.com/{tenantid}/v2.0","request_uri_parameter_supported":false,"userinfo_endpoint":"https://graph.microsoft.com/oidc/userinfo","authorization_endpoint":"https://login.microsoftonline.com/common/oauth2/v2.0/authorize","device_authorization_endpoint":"https://login.microsoftonline.com/common/oauth2/v2.0/devicecode","http_logout_supported":true,"frontchannel_logout_supported":true,"end_session_endpoint":"https://login.microsoftonline.com/common/oauth2/v2.0/logout","claims_supported":["sub","iss","cloud_instance_name","cloud_instance_host_name","cloud_graph_host_name","msgraph_host","aud","exp","iat","auth_time","acr","nonce","preferred_username","name","tid","ver","at_hash","c_hash","email"],"kerberos_endpoint":"https://login.microsoftonline.com/common/kerberos","tenant_region_scope":null,"cloud_instance_name":"microsoftonline.com","cloud_graph_host_name":"graph.windows.net","msgraph_host":"graph.microsoft.com","rbac_url":"https://pas.windows.net"}',
2284
2284
  },
2285
+ system: {
2286
+ loggerOptions: {
2287
+ logLevel: getMSALLogLevel(logger$o.getLogLevel()),
2288
+ },
2289
+ },
2285
2290
  });
2286
2291
  }
2287
2292
  async cachedAvailableMSI(scopes, getTokenOptions) {
@@ -2363,31 +2368,7 @@ class ManagedIdentityCredential {
2363
2368
  claims: options === null || options === void 0 ? void 0 : options.claims,
2364
2369
  };
2365
2370
  // Added a check to see if SetAppTokenProvider was already defined.
2366
- // Don't redefine it if it's already defined, since it should be static method.
2367
- if (!this.isAppTokenProviderInitialized) {
2368
- this.confidentialApp.SetAppTokenProvider(async (appTokenProviderParameters = appTokenParameters) => {
2369
- logger$c.info(`SetAppTokenProvider invoked with parameters- ${JSON.stringify(appTokenProviderParameters)}`);
2370
- const resultToken = await this.authenticateManagedIdentity(scopes, Object.assign(Object.assign({}, updatedOptions), appTokenProviderParameters));
2371
- if (resultToken) {
2372
- logger$c.info(`SetAppTokenProvider has saved the token in cache`);
2373
- const expiresInSeconds = (resultToken === null || resultToken === void 0 ? void 0 : resultToken.expiresOnTimestamp)
2374
- ? Math.floor((resultToken.expiresOnTimestamp - Date.now()) / 1000)
2375
- : 0;
2376
- return {
2377
- accessToken: resultToken === null || resultToken === void 0 ? void 0 : resultToken.token,
2378
- expiresInSeconds,
2379
- };
2380
- }
2381
- else {
2382
- logger$c.info(`SetAppTokenProvider token has "no_access_token_returned" as the saved token`);
2383
- return {
2384
- accessToken: "no_access_token_returned",
2385
- expiresInSeconds: 0,
2386
- };
2387
- }
2388
- });
2389
- this.isAppTokenProviderInitialized = true;
2390
- }
2371
+ this.initializeSetAppTokenProvider();
2391
2372
  const authenticationResult = await this.confidentialApp.acquireTokenByClientCredential(Object.assign({}, appTokenParameters));
2392
2373
  result = this.handleResult(scopes, authenticationResult || undefined);
2393
2374
  }
@@ -2503,6 +2484,34 @@ class ManagedIdentityCredential {
2503
2484
  throw error(`Response had no "accessToken" property.`);
2504
2485
  }
2505
2486
  }
2487
+ initializeSetAppTokenProvider() {
2488
+ if (!this.isAppTokenProviderInitialized) {
2489
+ this.confidentialApp.SetAppTokenProvider(async (appTokenProviderParameters) => {
2490
+ logger$c.info(`SetAppTokenProvider invoked with parameters- ${JSON.stringify(appTokenProviderParameters)}`);
2491
+ const getTokenOptions = Object.assign({}, appTokenProviderParameters);
2492
+ logger$c.info(`authenticateManagedIdentity invoked with scopes- ${JSON.stringify(appTokenProviderParameters.scopes)} and getTokenOptions - ${JSON.stringify(getTokenOptions)}`);
2493
+ const resultToken = await this.authenticateManagedIdentity(appTokenProviderParameters.scopes, getTokenOptions);
2494
+ if (resultToken) {
2495
+ logger$c.info(`SetAppTokenProvider will save the token in cache`);
2496
+ const expiresInSeconds = (resultToken === null || resultToken === void 0 ? void 0 : resultToken.expiresOnTimestamp)
2497
+ ? Math.floor((resultToken.expiresOnTimestamp - Date.now()) / 1000)
2498
+ : 0;
2499
+ return {
2500
+ accessToken: resultToken === null || resultToken === void 0 ? void 0 : resultToken.token,
2501
+ expiresInSeconds,
2502
+ };
2503
+ }
2504
+ else {
2505
+ logger$c.info(`SetAppTokenProvider token has "no_access_token_returned" as the saved token`);
2506
+ return {
2507
+ accessToken: "no_access_token_returned",
2508
+ expiresInSeconds: 0,
2509
+ };
2510
+ }
2511
+ });
2512
+ this.isAppTokenProviderInitialized = true;
2513
+ }
2514
+ }
2506
2515
  }
2507
2516
 
2508
2517
  // Copyright (c) Microsoft Corporation.