@azure/identity 4.5.0-alpha.20240912.2 → 4.5.0-alpha.20240917.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +22 -13
- package/dist/index.js.map +1 -1
- package/dist-esm/src/credentials/clientAssertionCredentialOptions.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/imdsRetryPolicy.js +5 -9
- package/dist-esm/src/credentials/managedIdentityCredential/imdsRetryPolicy.js.map +1 -1
- package/dist-esm/src/msal/nodeFlows/msalClient.js +6 -6
- package/dist-esm/src/msal/nodeFlows/msalClient.js.map +1 -1
- package/dist-esm/src/msal/utils.js +14 -1
- package/dist-esm/src/msal/utils.js.map +1 -1
- package/package.json +4 -4
- package/types/identity.d.ts +1 -1
package/dist/index.js
CHANGED
@@ -1072,6 +1072,19 @@ function ensureValidMsalToken(scopes, msalToken, getTokenOptions) {
|
|
1072
1072
|
throw error(`Response had no "accessToken" property.`);
|
1073
1073
|
}
|
1074
1074
|
}
|
1075
|
+
/**
|
1076
|
+
* Returns the authority host from either the options bag or the AZURE_AUTHORITY_HOST environment variable.
|
1077
|
+
*
|
1078
|
+
* Defaults to {@link DefaultAuthorityHost}.
|
1079
|
+
* @internal
|
1080
|
+
*/
|
1081
|
+
function getAuthorityHost(options) {
|
1082
|
+
let authorityHost = options === null || options === void 0 ? void 0 : options.authorityHost;
|
1083
|
+
if (!authorityHost && coreUtil.isNodeLike) {
|
1084
|
+
authorityHost = process.env.AZURE_AUTHORITY_HOST;
|
1085
|
+
}
|
1086
|
+
return authorityHost !== null && authorityHost !== void 0 ? authorityHost : DefaultAuthorityHost;
|
1087
|
+
}
|
1075
1088
|
/**
|
1076
1089
|
* Generates a valid authority by combining a host with a tenantId.
|
1077
1090
|
* @internal
|
@@ -1397,14 +1410,10 @@ function imdsRetryPolicy(msiRetryConfig) {
|
|
1397
1410
|
if ((response === null || response === void 0 ? void 0 : response.status) !== 404) {
|
1398
1411
|
return { skipStrategy: true };
|
1399
1412
|
}
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
// Allow the final value to have some "jitter" (within 50% of the delay size) so
|
1405
|
-
// that retries across multiple clients don't occur simultaneously.
|
1406
|
-
const retryAfterInMs = clampedExponentialDelay / 2 + coreUtil.getRandomIntegerInclusive(0, clampedExponentialDelay / 2);
|
1407
|
-
return { retryAfterInMs };
|
1413
|
+
return coreUtil.calculateRetryDelay(retryCount, {
|
1414
|
+
retryDelayInMs: msiRetryConfig.startDelayInMs,
|
1415
|
+
maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL,
|
1416
|
+
});
|
1408
1417
|
},
|
1409
1418
|
},
|
1410
1419
|
], {
|
@@ -1574,10 +1583,10 @@ const interactiveBrowserMockable = {
|
|
1574
1583
|
* @returns The MSAL configuration object.
|
1575
1584
|
*/
|
1576
1585
|
function generateMsalConfiguration(clientId, tenantId, msalClientOptions = {}) {
|
1577
|
-
var _a, _b, _c
|
1586
|
+
var _a, _b, _c;
|
1578
1587
|
const resolvedTenant = resolveTenantId((_a = msalClientOptions.logger) !== null && _a !== void 0 ? _a : msalLogger, tenantId, clientId);
|
1579
1588
|
// TODO: move and reuse getIdentityClientAuthorityHost
|
1580
|
-
const authority = getAuthority(resolvedTenant, (
|
1589
|
+
const authority = getAuthority(resolvedTenant, getAuthorityHost(msalClientOptions));
|
1581
1590
|
const httpClient = new IdentityClient(Object.assign(Object.assign({}, msalClientOptions.tokenCredentialOptions), { authorityHost: authority, loggingOptions: msalClientOptions.loggingOptions }));
|
1582
1591
|
const msalConfig = {
|
1583
1592
|
auth: {
|
@@ -1588,9 +1597,9 @@ function generateMsalConfiguration(clientId, tenantId, msalClientOptions = {}) {
|
|
1588
1597
|
system: {
|
1589
1598
|
networkClient: httpClient,
|
1590
1599
|
loggerOptions: {
|
1591
|
-
loggerCallback: defaultLoggerCallback((
|
1600
|
+
loggerCallback: defaultLoggerCallback((_b = msalClientOptions.logger) !== null && _b !== void 0 ? _b : msalLogger),
|
1592
1601
|
logLevel: getMSALLogLevel(logger$m.getLogLevel()),
|
1593
|
-
piiLoggingEnabled: (
|
1602
|
+
piiLoggingEnabled: (_c = msalClientOptions.loggingOptions) === null || _c === void 0 ? void 0 : _c.enableUnsafeSupportLogging,
|
1594
1603
|
},
|
1595
1604
|
},
|
1596
1605
|
};
|
@@ -1695,7 +1704,7 @@ To work with multiple accounts for the same Client ID and Tenant ID, please prov
|
|
1695
1704
|
*/
|
1696
1705
|
function calculateRequestAuthority(options) {
|
1697
1706
|
if (options === null || options === void 0 ? void 0 : options.tenantId) {
|
1698
|
-
return getAuthority(options.tenantId, createMsalClientOptions
|
1707
|
+
return getAuthority(options.tenantId, getAuthorityHost(createMsalClientOptions));
|
1699
1708
|
}
|
1700
1709
|
return state.msalConfig.auth.authority;
|
1701
1710
|
}
|