@azure/identity 2.0.3-alpha.20220211.2 → 2.0.5-alpha.20220221.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/CHANGELOG.md +12 -8
- package/dist/index.js +16 -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/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/package.json +1 -1
- package/types/identity.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
-
## 2.
|
|
3
|
+
## 2.0.5 (Unreleased)
|
|
4
4
|
|
|
5
5
|
### Features Added
|
|
6
6
|
|
|
7
|
-
- Added log warning for non-support of user assigned identity in Managed Identity credentials in Cloud Shell environments
|
|
8
|
-
|
|
9
7
|
### Breaking Changes
|
|
10
8
|
|
|
11
9
|
### Bugs Fixed
|
|
12
10
|
|
|
13
11
|
### Other Changes
|
|
14
12
|
|
|
15
|
-
## 2.0.
|
|
13
|
+
## 2.0.4 (2022-02-18)
|
|
16
14
|
|
|
17
|
-
###
|
|
15
|
+
### Bugs Fixed
|
|
18
16
|
|
|
19
|
-
-
|
|
17
|
+
- Fixed a regression in version 2.0.3 in which providing an options bag, but _not_ a client ID, to the `ManagedIdentityCredential` constructor would discard the `options` parameter.
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
## 2.0.3 (2022-02-16)
|
|
20
|
+
|
|
21
|
+
### Features Added
|
|
22
|
+
|
|
23
|
+
- Added log warning for non-support of user assigned identity in Managed Identity credentials in Cloud Shell environments.
|
|
22
24
|
|
|
23
25
|
### Bugs Fixed
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
- Fixed bug that duplicated the tenant Id on the URI of outgoing requests when passing an `authorityHost` ending with a tenant Id.
|
|
28
|
+
- `ManagedIdentityCredential` now won't retry when it tries to ping the IMDS endpoint.
|
|
29
|
+
- Now we are specifying the maximum number of retries to 3 to ensure that maximum retries won't change without notice.
|
|
26
30
|
|
|
27
31
|
## 2.0.2 (2022-02-03)
|
|
28
32
|
|
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
|
|
@@ -368,7 +368,7 @@ function getIdentityClientAuthorityHost(options) {
|
|
|
368
368
|
class IdentityClient extends coreClient.ServiceClient {
|
|
369
369
|
constructor(options) {
|
|
370
370
|
var _a;
|
|
371
|
-
const packageDetails = `azsdk-js-identity/2.0.
|
|
371
|
+
const packageDetails = `azsdk-js-identity/2.0.5`;
|
|
372
372
|
const userAgentPrefix = ((_a = options === null || options === void 0 ? void 0 : options.userAgentOptions) === null || _a === void 0 ? void 0 : _a.userAgentPrefix)
|
|
373
373
|
? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
|
|
374
374
|
: `${packageDetails}`;
|
|
@@ -376,7 +376,9 @@ class IdentityClient extends coreClient.ServiceClient {
|
|
|
376
376
|
if (!baseUri.startsWith("https:")) {
|
|
377
377
|
throw new Error("The authorityHost address must use the 'https' protocol.");
|
|
378
378
|
}
|
|
379
|
-
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: {
|
|
380
382
|
userAgentPrefix,
|
|
381
383
|
}, baseUri }));
|
|
382
384
|
this.authorityHost = baseUri;
|
|
@@ -601,6 +603,9 @@ function getAuthority(tenantId, host) {
|
|
|
601
603
|
if (!host) {
|
|
602
604
|
host = DefaultAuthorityHost;
|
|
603
605
|
}
|
|
606
|
+
if (new RegExp(`${tenantId}/?$`).test(host)) {
|
|
607
|
+
return host;
|
|
608
|
+
}
|
|
604
609
|
if (host.endsWith("/")) {
|
|
605
610
|
return host + tenantId;
|
|
606
611
|
}
|
|
@@ -2769,15 +2774,20 @@ class ManagedIdentityCredential {
|
|
|
2769
2774
|
*/
|
|
2770
2775
|
constructor(clientIdOrOptions, options) {
|
|
2771
2776
|
this.isEndpointUnavailable = null;
|
|
2777
|
+
let _options;
|
|
2772
2778
|
if (typeof clientIdOrOptions === "string") {
|
|
2773
2779
|
// clientId, options constructor
|
|
2774
2780
|
this.clientId = clientIdOrOptions;
|
|
2775
|
-
|
|
2781
|
+
_options = options;
|
|
2776
2782
|
}
|
|
2777
2783
|
else {
|
|
2778
2784
|
// options only constructor
|
|
2779
|
-
|
|
2785
|
+
_options = clientIdOrOptions;
|
|
2780
2786
|
}
|
|
2787
|
+
this.identityClient = new IdentityClient(_options);
|
|
2788
|
+
this.isAvailableIdentityClient = new IdentityClient(Object.assign(Object.assign({}, _options), { retryOptions: {
|
|
2789
|
+
maxRetries: 0,
|
|
2790
|
+
} }));
|
|
2781
2791
|
}
|
|
2782
2792
|
async cachedAvailableMSI(scopes, clientId, getTokenOptions) {
|
|
2783
2793
|
if (this.cachedMSI) {
|
|
@@ -2785,7 +2795,7 @@ class ManagedIdentityCredential {
|
|
|
2785
2795
|
}
|
|
2786
2796
|
const MSIs = [fabricMsi, appServiceMsi2017, cloudShellMsi, arcMsi, tokenExchangeMsi(), imdsMsi];
|
|
2787
2797
|
for (const msi of MSIs) {
|
|
2788
|
-
if (await msi.isAvailable(scopes, this.
|
|
2798
|
+
if (await msi.isAvailable(scopes, this.isAvailableIdentityClient, clientId, getTokenOptions)) {
|
|
2789
2799
|
this.cachedMSI = msi;
|
|
2790
2800
|
return msi;
|
|
2791
2801
|
}
|