@azure/identity 3.2.0-alpha.20230413.2 → 3.2.0-alpha.20230418.1
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 +6 -37
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/identityClient.js +1 -2
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js +1 -2
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2017.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js +1 -2
- package/dist-esm/src/credentials/managedIdentityCredential/appServiceMsi2019.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js +1 -2
- package/dist-esm/src/credentials/managedIdentityCredential/arcMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +1 -2
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js +1 -2
- package/dist-esm/src/credentials/managedIdentityCredential/fabricMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js +1 -2
- package/dist-esm/src/credentials/managedIdentityCredential/imdsMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +0 -5
- package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/models.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js +0 -19
- package/dist-esm/src/credentials/managedIdentityCredential/utils.js.map +1 -1
- package/package.json +2 -2
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
});
|