@azure/identity 3.2.0-alpha.20230413.2 → 3.2.0-beta.2

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.

Files changed (22) hide show
  1. package/dist/index.js +6 -37
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/client/identityClient.js +1 -2
  4. package/dist-esm/src/client/identityClient.js.map +1 -1
  5. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +1 -2
  6. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
  7. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js +1 -2
  8. package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js.map +1 -1
  9. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +1 -2
  10. package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
  11. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +1 -2
  12. package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
  13. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +1 -2
  14. package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
  15. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +1 -2
  16. package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
  17. package/dist-esm/src/credentials/managedIdentityCredential/index.js +0 -5
  18. package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
  19. package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -1
  20. package/dist-esm/src/credentials/managedIdentityCredential/utils.js +0 -19
  21. package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
  22. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -686,25 +686,6 @@ function parseExpirationTimestamp(body) {
686
686
  }
687
687
  throw new Error(`Failed to parse token expiration from body. expires_in="${body.expires_in}", expires_on="${body.expires_on}"`);
688
688
  }
689
- /**
690
- * Given a token response, return the timestamp for refreshing token as the number of milliseconds from the Unix epoch.
691
- * @param body - A parsed response body from the authentication endpoint.
692
- */
693
- function parseRefreshTimestamp(body) {
694
- if (typeof body.refresh_in === "number") {
695
- return Date.now() + body.refresh_in * 1000;
696
- }
697
- else {
698
- const durationInMilliseconds = parseExpirationTimestamp(body) - Date.now();
699
- const durationInHours = Math.floor(durationInMilliseconds / 1000 / 60 / 60);
700
- if (durationInHours >= 2) {
701
- return Date.now() + durationInMilliseconds / 2;
702
- }
703
- else {
704
- return Date.now() + durationInMilliseconds;
705
- }
706
- }
707
- }
708
689
 
709
690
  // Copyright (c) Microsoft Corporation.
710
691
  const noCorrelationId = "noCorrelationId";
@@ -764,7 +745,6 @@ class IdentityClient extends coreClient.ServiceClient {
764
745
  token: parsedBody.access_token,
765
746
  expiresOnTimestamp: parseExpirationTimestamp(parsedBody),
766
747
  },
767
- refreshesIn: parseRefreshTimestamp(parsedBody),
768
748
  refreshToken: parsedBody.refresh_token,
769
749
  };
770
750
  logger$n.info(`IdentityClient: [${request.url}] token acquired, expires on ${token.accessToken.expiresOnTimestamp}`);
@@ -1575,8 +1555,7 @@ const appServiceMsi2017 = {
1575
1555
  // Generally, MSI endpoints use the HTTP protocol, without transport layer security (TLS).
1576
1556
  allowInsecureConnection: true }));
1577
1557
  const tokenResponse = await identityClient.sendTokenRequest(request);
1578
- return ((tokenResponse && Object.assign(Object.assign({}, tokenResponse.accessToken), { refreshesOn: tokenResponse.refreshesIn })) ||
1579
- null);
1558
+ return (tokenResponse && tokenResponse.accessToken) || null;
1580
1559
  },
1581
1560
  };
1582
1561
 
@@ -1647,8 +1626,7 @@ const cloudShellMsi = {
1647
1626
  // Generally, MSI endpoints use the HTTP protocol, without transport layer security (TLS).
1648
1627
  allowInsecureConnection: true }));
1649
1628
  const tokenResponse = await identityClient.sendTokenRequest(request);
1650
- return ((tokenResponse && Object.assign(Object.assign({}, tokenResponse.accessToken), { refreshesOn: tokenResponse.refreshesIn })) ||
1651
- null);
1629
+ return (tokenResponse && tokenResponse.accessToken) || null;
1652
1630
  },
1653
1631
  };
1654
1632
 
@@ -1769,8 +1747,7 @@ const imdsMsi = {
1769
1747
  try {
1770
1748
  const request = coreRestPipeline.createPipelineRequest(Object.assign(Object.assign({ abortSignal: getTokenOptions.abortSignal }, prepareRequestOptions$3(scopes, clientId, resourceId)), { allowInsecureConnection: true }));
1771
1749
  const tokenResponse = await identityClient.sendTokenRequest(request);
1772
- return ((tokenResponse && Object.assign(Object.assign({}, tokenResponse.accessToken), { refreshesOn: tokenResponse.refreshesIn })) ||
1773
- null);
1750
+ return (tokenResponse && tokenResponse.accessToken) || null;
1774
1751
  }
1775
1752
  catch (error) {
1776
1753
  if (error.statusCode === 404) {
@@ -1891,8 +1868,7 @@ const arcMsi = {
1891
1868
  // Generally, MSI endpoints use the HTTP protocol, without transport layer security (TLS).
1892
1869
  allowInsecureConnection: true }));
1893
1870
  const tokenResponse = await identityClient.sendTokenRequest(request);
1894
- return ((tokenResponse && Object.assign(Object.assign({}, tokenResponse.accessToken), { refreshesOn: tokenResponse.refreshesIn })) ||
1895
- null);
1871
+ return (tokenResponse && tokenResponse.accessToken) || null;
1896
1872
  },
1897
1873
  };
1898
1874
 
@@ -2182,8 +2158,7 @@ const fabricMsi = {
2182
2158
  rejectUnauthorized: false,
2183
2159
  });
2184
2160
  const tokenResponse = await identityClient.sendTokenRequest(request);
2185
- return ((tokenResponse && Object.assign(Object.assign({}, tokenResponse.accessToken), { refreshesOn: tokenResponse.refreshesIn })) ||
2186
- null);
2161
+ return (tokenResponse && tokenResponse.accessToken) || null;
2187
2162
  },
2188
2163
  };
2189
2164
 
@@ -2250,8 +2225,7 @@ const appServiceMsi2019 = {
2250
2225
  // Generally, MSI endpoints use the HTTP protocol, without transport layer security (TLS).
2251
2226
  allowInsecureConnection: true }));
2252
2227
  const tokenResponse = await identityClient.sendTokenRequest(request);
2253
- return ((tokenResponse && Object.assign(Object.assign({}, tokenResponse.accessToken), { refreshesOn: tokenResponse.refreshesIn })) ||
2254
- null);
2228
+ return (tokenResponse && tokenResponse.accessToken) || null;
2255
2229
  },
2256
2230
  };
2257
2231
 
@@ -2393,13 +2367,9 @@ class ManagedIdentityCredential {
2393
2367
  const expiresInSeconds = (resultToken === null || resultToken === void 0 ? void 0 : resultToken.expiresOnTimestamp)
2394
2368
  ? Math.floor((resultToken.expiresOnTimestamp - Date.now()) / 1000)
2395
2369
  : 0;
2396
- const refreshInSeconds = (resultToken === null || resultToken === void 0 ? void 0 : resultToken.refreshesOn)
2397
- ? Math.floor((resultToken.refreshesOn - Date.now()) / 1000)
2398
- : 0;
2399
2370
  return {
2400
2371
  accessToken: resultToken === null || resultToken === void 0 ? void 0 : resultToken.token,
2401
2372
  expiresInSeconds,
2402
- refreshInSeconds,
2403
2373
  };
2404
2374
  }
2405
2375
  else {
@@ -2407,7 +2377,6 @@ class ManagedIdentityCredential {
2407
2377
  return {
2408
2378
  accessToken: "no_access_token_returned",
2409
2379
  expiresInSeconds: 0,
2410
- refreshInSeconds: 0,
2411
2380
  };
2412
2381
  }
2413
2382
  });