@azure/identity 2.0.2-alpha.20220131.1 → 2.0.3
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/CHANGELOG.md +13 -3
- package/dist/index.js +24 -6
- package/dist/index.js.map +1 -1
- package/dist-esm/src/client/identityClient.js +4 -2
- package/dist-esm/src/client/identityClient.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js +5 -1
- package/dist-esm/src/credentials/managedIdentityCredential/cloudShellMsi.js.map +1 -1
- package/dist-esm/src/credentials/managedIdentityCredential/index.js +8 -3
- package/dist-esm/src/credentials/managedIdentityCredential/index.js.map +1 -1
- package/dist-esm/src/errors.js +1 -1
- package/dist-esm/src/errors.js.map +1 -1
- package/dist-esm/src/msal/utils.js +3 -0
- package/dist-esm/src/msal/utils.js.map +1 -1
- package/dist-esm/src/util/logging.js +4 -0
- package/dist-esm/src/util/logging.js.map +1 -1
- package/package.json +4 -4
- package/types/identity.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
-
## 2.0.
|
|
3
|
+
## 2.0.3 (2022-02-16)
|
|
4
4
|
|
|
5
5
|
### Features Added
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- Added log warning for non-support of user assigned identity in Managed Identity credentials in Cloud Shell environments.
|
|
8
8
|
|
|
9
|
-
###
|
|
9
|
+
### Bugs Fixed
|
|
10
|
+
|
|
11
|
+
- Fixed bug that duplicated the tenant Id on the URI of outgoing requests when passing an `authorityHost` ending with a tenant Id.
|
|
12
|
+
- `ManagedIdentityCredential` now won't retry when it tries to ping the IMDS endpoint.
|
|
13
|
+
- Now we are specifying the maximum number of retries to 3 to ensure that maximum retries won't change without notice.
|
|
14
|
+
|
|
15
|
+
## 2.0.2 (2022-02-03)
|
|
16
|
+
|
|
17
|
+
### Features Added
|
|
18
|
+
|
|
19
|
+
- Improved the error message when `InteractiveBrowserCredential` is used with an unavailable port (such as when no `redirectUri` is provided, and the port `80` is busy) and when no browser is available.
|
|
10
20
|
|
|
11
21
|
### Bugs Fixed
|
|
12
22
|
|
package/dist/index.js
CHANGED
|
@@ -123,7 +123,7 @@ class AuthenticationError extends Error {
|
|
|
123
123
|
errorDescription: "An unknown error occurred and no additional details are available.",
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
|
-
super(`${errorResponse.error}
|
|
126
|
+
super(`${errorResponse.error} Status code: ${statusCode}\nMore details:\n${errorResponse.errorDescription}`);
|
|
127
127
|
this.statusCode = statusCode;
|
|
128
128
|
this.errorResponse = errorResponse;
|
|
129
129
|
// Ensure that this type reports the correct name
|
|
@@ -318,10 +318,14 @@ function credentialLoggerInstance(title, parent, log = logger$j) {
|
|
|
318
318
|
function info(message) {
|
|
319
319
|
log.info(`${fullTitle} =>`, message);
|
|
320
320
|
}
|
|
321
|
+
function warning(message) {
|
|
322
|
+
log.warning(`${fullTitle} =>`, message);
|
|
323
|
+
}
|
|
321
324
|
return {
|
|
322
325
|
title,
|
|
323
326
|
fullTitle,
|
|
324
327
|
info,
|
|
328
|
+
warning,
|
|
325
329
|
};
|
|
326
330
|
}
|
|
327
331
|
/**
|
|
@@ -364,7 +368,7 @@ function getIdentityClientAuthorityHost(options) {
|
|
|
364
368
|
class IdentityClient extends coreClient.ServiceClient {
|
|
365
369
|
constructor(options) {
|
|
366
370
|
var _a;
|
|
367
|
-
const packageDetails = `azsdk-js-identity/2.0.
|
|
371
|
+
const packageDetails = `azsdk-js-identity/2.0.3`;
|
|
368
372
|
const userAgentPrefix = ((_a = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix)
|
|
369
373
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
370
374
|
: `${packageDetails}`;
|
|
@@ -372,7 +376,9 @@ class IdentityClient extends coreClient.ServiceClient {
|
|
|
372
376
|
if (!baseUri.startsWith("https:")) {
|
|
373
377
|
throw new Error("The authorityHost address must use the 'https' protocol.");
|
|
374
378
|
}
|
|
375
|
-
super(Object.assign(Object.assign({ requestContentType: "application/json; charset=utf-8"
|
|
379
|
+
super(Object.assign(Object.assign({ requestContentType: "application/json; charset=utf-8", retryOptions: {
|
|
380
|
+
maxRetries: 3,
|
|
381
|
+
} }, options), { userAgentOptions: {
|
|
376
382
|
userAgentPrefix,
|
|
377
383
|
}, baseUri }));
|
|
378
384
|
this.authorityHost = baseUri;
|
|
@@ -597,6 +603,9 @@ function getAuthority(tenantId, host) {
|
|
|
597
603
|
if (!host) {
|
|
598
604
|
host = DefaultAuthorityHost;
|
|
599
605
|
}
|
|
606
|
+
if (new RegExp(`${tenantId}/?$`).test(host)) {
|
|
607
|
+
return host;
|
|
608
|
+
}
|
|
600
609
|
if (host.endsWith("/")) {
|
|
601
610
|
return host + tenantId;
|
|
602
611
|
}
|
|
@@ -2292,6 +2301,7 @@ function prepareRequestOptions$4(scopes, clientId) {
|
|
|
2292
2301
|
}
|
|
2293
2302
|
/**
|
|
2294
2303
|
* Defines how to determine whether the Azure Cloud Shell MSI is available, and also how to retrieve a token from the Azure Cloud Shell MSI.
|
|
2304
|
+
* Since Azure Managed Identities aren't available in the Azure Cloud Shell, we log a warning for users that try to access cloud shell using user assigned identity.
|
|
2295
2305
|
*/
|
|
2296
2306
|
const cloudShellMsi = {
|
|
2297
2307
|
async isAvailable(scopes) {
|
|
@@ -2308,6 +2318,9 @@ const cloudShellMsi = {
|
|
|
2308
2318
|
},
|
|
2309
2319
|
async getToken(configuration, getTokenOptions = {}) {
|
|
2310
2320
|
const { identityClient, scopes, clientId } = configuration;
|
|
2321
|
+
if (clientId) {
|
|
2322
|
+
logger$9.warning(`${msiName$4}: does not support user-assigned identities in the Cloud Shell environment. Argument clientId will be ignored.`);
|
|
2323
|
+
}
|
|
2311
2324
|
logger$9.info(`${msiName$4}: Using the endpoint coming form the environment variable MSI_ENDPOINT = ${process.env.MSI_ENDPOINT}.`);
|
|
2312
2325
|
const request = coreRestPipeline.createPipelineRequest(Object.assign(Object.assign({ abortSignal: getTokenOptions.abortSignal }, prepareRequestOptions$4(scopes, clientId)), {
|
|
2313
2326
|
// Generally, MSI endpoints use the HTTP protocol, without transport layer security (TLS).
|
|
@@ -2761,15 +2774,20 @@ class ManagedIdentityCredential {
|
|
|
2761
2774
|
*/
|
|
2762
2775
|
constructor(clientIdOrOptions, options) {
|
|
2763
2776
|
this.isEndpointUnavailable = null;
|
|
2777
|
+
let _options;
|
|
2764
2778
|
if (typeof clientIdOrOptions === "string") {
|
|
2765
2779
|
// clientId, options constructor
|
|
2766
2780
|
this.clientId = clientIdOrOptions;
|
|
2767
|
-
|
|
2781
|
+
_options = options;
|
|
2768
2782
|
}
|
|
2769
2783
|
else {
|
|
2770
2784
|
// options only constructor
|
|
2771
|
-
|
|
2785
|
+
_options = options;
|
|
2772
2786
|
}
|
|
2787
|
+
this.identityClient = new IdentityClient(_options);
|
|
2788
|
+
this.isAvailableIdentityClient = new IdentityClient(Object.assign(Object.assign({}, _options), { retryOptions: {
|
|
2789
|
+
maxRetries: 0,
|
|
2790
|
+
} }));
|
|
2773
2791
|
}
|
|
2774
2792
|
async cachedAvailableMSI(scopes, clientId, getTokenOptions) {
|
|
2775
2793
|
if (this.cachedMSI) {
|
|
@@ -2777,7 +2795,7 @@ class ManagedIdentityCredential {
|
|
|
2777
2795
|
}
|
|
2778
2796
|
const MSIs = [fabricMsi, appServiceMsi2017, cloudShellMsi, arcMsi, tokenExchangeMsi(), imdsMsi];
|
|
2779
2797
|
for (const msi of MSIs) {
|
|
2780
|
-
if (await msi.isAvailable(scopes, this.
|
|
2798
|
+
if (await msi.isAvailable(scopes, this.isAvailableIdentityClient, clientId, getTokenOptions)) {
|
|
2781
2799
|
this.cachedMSI = msi;
|
|
2782
2800
|
return msi;
|
|
2783
2801
|
}
|