@azure/msal-node 3.5.3 → 3.6.0
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.
- package/dist/cache/NodeStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
- package/dist/cache/serializer/Deserializer.mjs +1 -1
- package/dist/cache/serializer/Serializer.mjs +1 -1
- package/dist/client/ClientApplication.mjs +1 -1
- package/dist/client/ClientAssertion.d.ts.map +1 -1
- package/dist/client/ClientAssertion.mjs +3 -3
- package/dist/client/ClientAssertion.mjs.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +1 -1
- package/dist/client/DeviceCodeClient.mjs +1 -1
- package/dist/client/ManagedIdentityApplication.d.ts +11 -0
- package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/dist/client/ManagedIdentityApplication.mjs +46 -11
- package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
- package/dist/client/ManagedIdentityClient.mjs +1 -1
- package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +6 -5
- package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +8 -8
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +11 -2
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +4 -4
- package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.d.ts +32 -0
- package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +39 -8
- package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs +7 -6
- package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +30 -0
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +36 -10
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
- package/dist/client/OnBehalfOfClient.mjs +1 -1
- package/dist/client/PublicClientApplication.mjs +1 -1
- package/dist/client/UsernamePasswordClient.mjs +1 -1
- package/dist/config/Configuration.d.ts +4 -2
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +3 -2
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/config/ManagedIdentityId.mjs +1 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
- package/dist/crypto/CryptoProvider.d.ts.map +1 -1
- package/dist/crypto/CryptoProvider.mjs +3 -2
- package/dist/crypto/CryptoProvider.mjs.map +1 -1
- package/dist/crypto/GuidGenerator.mjs +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +3 -3
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/error/ManagedIdentityError.mjs +1 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
- package/dist/error/NodeAuthError.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/internals.mjs +1 -1
- package/dist/network/HttpClient.mjs +1 -1
- package/dist/network/HttpClientWithRetries.mjs +1 -1
- package/dist/network/LoopbackClient.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/request/ManagedIdentityRequest.d.ts +6 -3
- package/dist/request/ManagedIdentityRequest.d.ts.map +1 -1
- package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
- package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
- package/dist/retry/ImdsRetryPolicy.mjs +1 -1
- package/dist/retry/LinearRetryStrategy.mjs +1 -1
- package/dist/utils/Constants.d.ts +20 -6
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +20 -8
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.mjs +4 -4
- package/dist/utils/EncodingUtils.mjs.map +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/lib/msal-node.cjs +234 -124
- package/lib/msal-node.cjs.map +1 -1
- package/lib/types/client/ClientAssertion.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentityApplication.d.ts +11 -0
- package/lib/types/client/ManagedIdentityApplication.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/Imds.d.ts +32 -0
- package/lib/types/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/MachineLearning.d.ts.map +1 -1
- package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts +30 -0
- package/lib/types/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +4 -2
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/crypto/CryptoProvider.d.ts.map +1 -1
- package/lib/types/crypto/PkceGenerator.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/request/ManagedIdentityRequest.d.ts +6 -3
- package/lib/types/request/ManagedIdentityRequest.d.ts.map +1 -1
- package/lib/types/utils/Constants.d.ts +20 -6
- package/lib/types/utils/Constants.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/client/ClientAssertion.ts +2 -1
- package/src/client/ManagedIdentityApplication.ts +71 -10
- package/src/client/ManagedIdentitySources/AppService.ts +6 -6
- package/src/client/ManagedIdentitySources/AzureArc.ts +10 -9
- package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +28 -1
- package/src/client/ManagedIdentitySources/CloudShell.ts +4 -4
- package/src/client/ManagedIdentitySources/Imds.ts +40 -10
- package/src/client/ManagedIdentitySources/MachineLearning.ts +7 -8
- package/src/client/ManagedIdentitySources/ServiceFabric.ts +36 -11
- package/src/config/Configuration.ts +5 -1
- package/src/crypto/CryptoProvider.ts +3 -3
- package/src/crypto/PkceGenerator.ts +3 -3
- package/src/packageMetadata.ts +1 -1
- package/src/request/ManagedIdentityRequest.ts +6 -3
- package/src/utils/Constants.ts +24 -6
- package/src/utils/EncodingUtils.ts +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientAssertion.d.ts","sourceRoot":"","sources":["../../../src/client/ClientAssertion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClientAssertion.d.ts","sourceRoot":"","sources":["../../../src/client/ClientAssertion.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAI7D;;;GAGG;AACH,qBAAa,eAAe;IACxB,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAU;IAC3B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,iBAAiB,CAAgB;IAEzC;;;OAGG;WACW,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe;IAM/D;;;;;;OAMG;WACW,eAAe,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,GAC3B,eAAe;IAYlB;;;;;OAKG;WACW,mCAAmC,CAC7C,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,iBAAiB,CAAC,EAAE,MAAM,GAC3B,eAAe;IAYlB;;;;;OAKG;IACI,MAAM,CACT,cAAc,EAAE,cAAc,EAC9B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GACpB,MAAM;IA0BT;;OAEG;IACH,OAAO,CAAC,SAAS;IA8CjB;;OAEG;IACH,OAAO,CAAC,SAAS;IAIjB;;;OAGG;WACW,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;CAoB3E"}
|
|
@@ -15,6 +15,7 @@ export declare class ManagedIdentityApplication {
|
|
|
15
15
|
private fakeAuthority;
|
|
16
16
|
private fakeClientCredentialClient;
|
|
17
17
|
private managedIdentityClient;
|
|
18
|
+
private hashUtils;
|
|
18
19
|
constructor(configuration?: ManagedIdentityConfiguration);
|
|
19
20
|
/**
|
|
20
21
|
* Acquire an access token from the cache or the managed identity
|
|
@@ -22,6 +23,16 @@ export declare class ManagedIdentityApplication {
|
|
|
22
23
|
* @returns the access token
|
|
23
24
|
*/
|
|
24
25
|
acquireToken(managedIdentityRequestParams: ManagedIdentityRequestParams): Promise<AuthenticationResult>;
|
|
26
|
+
/**
|
|
27
|
+
* Acquires a token from a managed identity endpoint.
|
|
28
|
+
*
|
|
29
|
+
* @param managedIdentityRequest - The request object containing parameters for the managed identity token request.
|
|
30
|
+
* @param managedIdentityId - The identifier for the managed identity (e.g., client ID or resource ID).
|
|
31
|
+
* @param fakeAuthority - A placeholder authority used for the token request.
|
|
32
|
+
* @param refreshAccessToken - Optional flag indicating whether to force a refresh of the access token.
|
|
33
|
+
* @returns A promise that resolves to an AuthenticationResult containing the acquired token and related information.
|
|
34
|
+
*/
|
|
35
|
+
private acquireTokenFromManagedIdentity;
|
|
25
36
|
/**
|
|
26
37
|
* Determine the Managed Identity Source based on available environment variables. This API is consumed by Azure Identity SDK.
|
|
27
38
|
* @returns ManagedIdentitySourceNames - The Managed Identity source's name
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManagedIdentityApplication.d.ts","sourceRoot":"","sources":["../../../src/client/ManagedIdentityApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAYH,oBAAoB,
|
|
1
|
+
{"version":3,"file":"ManagedIdentityApplication.d.ts","sourceRoot":"","sources":["../../../src/client/ManagedIdentityApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAYH,oBAAoB,EAIvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,4BAA4B,EAG/B,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE1F,OAAO,EAEH,0BAA0B,EAC7B,MAAM,uBAAuB,CAAC;AAO/B;;;GAGG;AACH,qBAAa,0BAA0B;IACnC,OAAO,CAAC,MAAM,CAAmC;IAEjD,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAc;IACzC,OAAO,CAAC,aAAa,CAAiB;IACtC,OAAO,CAAC,cAAc,CAAiB;IAGvC,OAAO,CAAC,aAAa,CAAY;IAGjC,OAAO,CAAC,0BAA0B,CAAyB;IAE3D,OAAO,CAAC,qBAAqB,CAAwB;IAErD,OAAO,CAAC,SAAS,CAAY;gBAEjB,aAAa,CAAC,EAAE,4BAA4B;IA8DxD;;;;OAIG;IACU,YAAY,CACrB,4BAA4B,EAAE,4BAA4B,GAC3D,OAAO,CAAC,oBAAoB,CAAC;IAgGhC;;;;;;;;OAQG;YACW,+BAA+B;IAe7C;;;OAGG;IACI,wBAAwB,IAAI,0BAA0B;CAMhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppService.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/AppService.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"AppService.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/AppService.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAS3E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKzD;;GAEG;AACH,qBAAa,UAAW,SAAQ,yBAAyB;IACrD,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,cAAc,CAAS;gBAG3B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,EAC/B,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM;WAcZ,uBAAuB,IAAI,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;WAapD,SAAS,CACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,GAChC,UAAU,GAAG,IAAI;IAmCb,aAAa,CAChB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,iBAAiB,GACrC,gCAAgC;CA6BtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AzureArc.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/AzureArc.ts"],"names":[],"mappings":"AAKA,OAAO,EAKH,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,MAAM,EACN,gCAAgC,
|
|
1
|
+
{"version":3,"file":"AzureArc.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/AzureArc.ts"],"names":[],"mappings":"AAKA,OAAO,EAKH,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,MAAM,EACN,gCAAgC,EAEnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAchE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAOzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gDAAgD,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAGtE,eAAO,MAAM,eAAe,EAAE,MAAqB,CAAC;AACpD,eAAO,MAAM,mCAAmC,EAAE,MACS,CAAC;AAG5D,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,WAG3C,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,WAGtC,CAAC;AAEF;;GAEG;AACH,qBAAa,QAAS,SAAQ,yBAAyB;IACnD,OAAO,CAAC,gBAAgB,CAAS;gBAG7B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,EAC/B,gBAAgB,EAAE,MAAM;WAad,uBAAuB,IAAI,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;WAoCpD,SAAS,CACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,EAC/B,iBAAiB,EAAE,iBAAiB,GACrC,QAAQ,GAAG,IAAI;IA+DX,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,gCAAgC;IAmB3D,2BAA2B,CACpC,gBAAgB,EAAE,eAAe,CAAC,4BAA4B,CAAC,EAC/D,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,gCAAgC,EAChD,qBAAqB,EAAE,qBAAqB,GAC7C,OAAO,CAAC,gCAAgC,CAAC;CA4G/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseManagedIdentitySource.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,SAAS,EAIT,cAAc,EACd,MAAM,EACN,qBAAqB,EACrB,eAAe,EAEf,gCAAgC,EAGhC,oBAAoB,EAEvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,
|
|
1
|
+
{"version":3,"file":"BaseManagedIdentitySource.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,SAAS,EAIT,cAAc,EACd,MAAM,EACN,qBAAqB,EACrB,eAAe,EAEf,gCAAgC,EAGh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,+BAA+B,CACxC,sBAAsB,EAAE,sBAAsB,EAC9C,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,SAAS,EACxB,kBAAkB,CAAC,EAAE,OAAO,GAC7B,OAAO,CAAC,oBAAoB,CAAC;IA8GzB,iDAAiD,CACpD,qBAAqB,EAAE,qBAAqB,EAC5C,MAAM,CAAC,EAAE,OAAO,EAChB,WAAW,CAAC,EAAE,OAAO,GACtB,MAAM;IAiCT,OAAc,gCAAgC,0BACnB,MAAM,eAChB,MAAM,cACP,MAAM,UACV,MAAM,KACf,MAAM,CAeP;CACL"}
|
|
@@ -4,10 +4,42 @@ import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRe
|
|
|
4
4
|
import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource.js";
|
|
5
5
|
import { CryptoProvider } from "../../crypto/CryptoProvider.js";
|
|
6
6
|
import { NodeStorage } from "../../cache/NodeStorage.js";
|
|
7
|
+
/**
|
|
8
|
+
* Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ImdsManagedIdentitySource.cs
|
|
9
|
+
*/
|
|
7
10
|
export declare class Imds extends BaseManagedIdentitySource {
|
|
8
11
|
private identityEndpoint;
|
|
12
|
+
/**
|
|
13
|
+
* Constructs an Imds instance.
|
|
14
|
+
* @param logger - Logger instance for logging.
|
|
15
|
+
* @param nodeStorage - NodeStorage instance for caching.
|
|
16
|
+
* @param networkClient - Network client for HTTP requests.
|
|
17
|
+
* @param cryptoProvider - CryptoProvider for cryptographic operations.
|
|
18
|
+
* @param disableInternalRetries - Whether to disable internal retry logic.
|
|
19
|
+
* @param identityEndpoint - The IMDS endpoint to use.
|
|
20
|
+
*/
|
|
9
21
|
constructor(logger: Logger, nodeStorage: NodeStorage, networkClient: INetworkModule, cryptoProvider: CryptoProvider, disableInternalRetries: boolean, identityEndpoint: string);
|
|
22
|
+
/**
|
|
23
|
+
* Attempts to create an Imds instance by determining the correct endpoint.
|
|
24
|
+
* If the AZURE_POD_IDENTITY_AUTHORITY_HOST environment variable is set, it uses that as the endpoint.
|
|
25
|
+
* Otherwise, it falls back to the default IMDS endpoint.
|
|
26
|
+
*
|
|
27
|
+
* @param logger - Logger instance for logging.
|
|
28
|
+
* @param nodeStorage - NodeStorage instance for caching.
|
|
29
|
+
* @param networkClient - Network client for HTTP requests.
|
|
30
|
+
* @param cryptoProvider - CryptoProvider for cryptographic operations.
|
|
31
|
+
* @param disableInternalRetries - Whether to disable internal retry logic.
|
|
32
|
+
* @returns An instance of Imds configured with the appropriate endpoint.
|
|
33
|
+
*/
|
|
10
34
|
static tryCreate(logger: Logger, nodeStorage: NodeStorage, networkClient: INetworkModule, cryptoProvider: CryptoProvider, disableInternalRetries: boolean): Imds;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a ManagedIdentityRequestParameters object for acquiring a token from IMDS.
|
|
37
|
+
* Sets the required headers and query parameters for the IMDS token request.
|
|
38
|
+
*
|
|
39
|
+
* @param resource - The resource URI for which the token is requested.
|
|
40
|
+
* @param managedIdentityId - The managed identity ID (system-assigned or user-assigned).
|
|
41
|
+
* @returns A ManagedIdentityRequestParameters object configured for IMDS.
|
|
42
|
+
*/
|
|
11
43
|
createRequest(resource: string, managedIdentityId: ManagedIdentityId): ManagedIdentityRequestParameters;
|
|
12
44
|
}
|
|
13
45
|
//# sourceMappingURL=Imds.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Imds.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/Imds.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"Imds.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/Imds.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAShE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AASzD;;GAEG;AACH,qBAAa,IAAK,SAAQ,yBAAyB;IAC/C,OAAO,CAAC,gBAAgB,CAAS;IAEjC;;;;;;;;OAQG;gBAEC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,EAC/B,gBAAgB,EAAE,MAAM;IAa5B;;;;;;;;;;;OAWG;WACW,SAAS,CACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,GAChC,IAAI;IA+CP;;;;;;;OAOG;IACI,aAAa,CAChB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,iBAAiB,GACrC,gCAAgC;CA+BtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MachineLearning.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/MachineLearning.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"MachineLearning.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/MachineLearning.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAS3E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAIzD,qBAAa,eAAgB,SAAQ,yBAAyB;IAC1D,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,MAAM,CAAS;gBAGnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,EAC/B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM;WAcJ,uBAAuB,IAAI,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;WAUpD,SAAS,CACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,GAChC,eAAe,GAAG,IAAI;IAkClB,aAAa,CAChB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,iBAAiB,GACrC,gCAAgC;CAgCtC"}
|
|
@@ -10,9 +10,39 @@ import { CryptoProvider } from "../../crypto/CryptoProvider.js";
|
|
|
10
10
|
export declare class ServiceFabric extends BaseManagedIdentitySource {
|
|
11
11
|
private identityEndpoint;
|
|
12
12
|
private identityHeader;
|
|
13
|
+
/**
|
|
14
|
+
* Constructs a new ServiceFabric managed identity source.
|
|
15
|
+
* @param logger Logger instance for logging
|
|
16
|
+
* @param nodeStorage NodeStorage instance for caching
|
|
17
|
+
* @param networkClient Network client for HTTP requests
|
|
18
|
+
* @param cryptoProvider Crypto provider for cryptographic operations
|
|
19
|
+
* @param disableInternalRetries Whether to disable internal retry logic
|
|
20
|
+
* @param identityEndpoint The Service Fabric managed identity endpoint
|
|
21
|
+
* @param identityHeader The Service Fabric managed identity secret header
|
|
22
|
+
*/
|
|
13
23
|
constructor(logger: Logger, nodeStorage: NodeStorage, networkClient: INetworkModule, cryptoProvider: CryptoProvider, disableInternalRetries: boolean, identityEndpoint: string, identityHeader: string);
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves the environment variables required for Service Fabric managed identity.
|
|
26
|
+
* @returns An array containing the identity endpoint, identity header, and identity server thumbprint.
|
|
27
|
+
*/
|
|
14
28
|
static getEnvironmentVariables(): Array<string | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Attempts to create a ServiceFabric managed identity source if all required environment variables are present.
|
|
31
|
+
* @param logger Logger instance for logging
|
|
32
|
+
* @param nodeStorage NodeStorage instance for caching
|
|
33
|
+
* @param networkClient Network client for HTTP requests
|
|
34
|
+
* @param cryptoProvider Crypto provider for cryptographic operations
|
|
35
|
+
* @param disableInternalRetries Whether to disable internal retry logic
|
|
36
|
+
* @param managedIdentityId Managed identity identifier
|
|
37
|
+
* @returns A ServiceFabric instance if environment variables are set, otherwise null
|
|
38
|
+
*/
|
|
15
39
|
static tryCreate(logger: Logger, nodeStorage: NodeStorage, networkClient: INetworkModule, cryptoProvider: CryptoProvider, disableInternalRetries: boolean, managedIdentityId: ManagedIdentityId): ServiceFabric | null;
|
|
40
|
+
/**
|
|
41
|
+
* Creates the request parameters for acquiring a token from the Service Fabric cluster.
|
|
42
|
+
* @param resource - The resource URI for which the token is requested.
|
|
43
|
+
* @param managedIdentityId - The managed identity ID (system-assigned or user-assigned).
|
|
44
|
+
* @returns A ManagedIdentityRequestParameters object configured for Service Fabric.
|
|
45
|
+
*/
|
|
16
46
|
createRequest(resource: string, managedIdentityId: ManagedIdentityId): ManagedIdentityRequestParameters;
|
|
17
47
|
}
|
|
18
48
|
//# sourceMappingURL=ServiceFabric.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceFabric.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/ServiceFabric.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"ServiceFabric.d.ts","sourceRoot":"","sources":["../../../../src/client/ManagedIdentitySources/ServiceFabric.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,kDAAkD,CAAC;AACpG,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAYhE;;GAEG;AACH,qBAAa,aAAc,SAAQ,yBAAyB;IACxD,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;;;;;OASG;gBAEC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,EAC/B,gBAAgB,EAAE,MAAM,EACxB,cAAc,EAAE,MAAM;IAc1B;;;OAGG;WACW,uBAAuB,IAAI,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;IAkBlE;;;;;;;;;OASG;WACW,SAAS,CACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,cAAc,EAC7B,cAAc,EAAE,cAAc,EAC9B,sBAAsB,EAAE,OAAO,EAC/B,iBAAiB,EAAE,iBAAiB,GACrC,aAAa,GAAG,IAAI;IA0CvB;;;;;OAKG;IACI,aAAa,CAChB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,iBAAiB,GACrC,gCAAgC;CA6BtC"}
|
|
@@ -109,6 +109,7 @@ export type ManagedIdentityIdParams = {
|
|
|
109
109
|
};
|
|
110
110
|
/** @public */
|
|
111
111
|
export type ManagedIdentityConfiguration = {
|
|
112
|
+
clientCapabilities?: Array<string>;
|
|
112
113
|
managedIdentityIdParams?: ManagedIdentityIdParams;
|
|
113
114
|
system?: NodeSystemOptions;
|
|
114
115
|
};
|
|
@@ -134,9 +135,10 @@ export type NodeConfiguration = {
|
|
|
134
135
|
export declare function buildAppConfiguration({ auth, broker, cache, system, telemetry, }: Configuration): NodeConfiguration;
|
|
135
136
|
/** @internal */
|
|
136
137
|
export type ManagedIdentityNodeConfiguration = {
|
|
138
|
+
clientCapabilities?: Array<string>;
|
|
139
|
+
disableInternalRetries: boolean;
|
|
137
140
|
managedIdentityId: ManagedIdentityId;
|
|
138
141
|
system: Required<Pick<NodeSystemOptions, "loggerOptions" | "networkClient">>;
|
|
139
|
-
disableInternalRetries: boolean;
|
|
140
142
|
};
|
|
141
|
-
export declare function buildManagedIdentityConfiguration({ managedIdentityIdParams, system, }: ManagedIdentityConfiguration): ManagedIdentityNodeConfiguration;
|
|
143
|
+
export declare function buildManagedIdentityConfiguration({ clientCapabilities, managedIdentityIdParams, system, }: ManagedIdentityConfiguration): ManagedIdentityNodeConfiguration;
|
|
142
144
|
//# sourceMappingURL=Configuration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.d.ts","sourceRoot":"","sources":["../../../src/config/Configuration.ts"],"names":[],"mappings":";;AAKA,OAAO,EACH,aAAa,EACb,cAAc,EAEd,YAAY,EACZ,YAAY,EAGZ,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EAC1B,MAAM,yBAAyB,CAAC;AAEjC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAAC;IACnD,iBAAiB,CAAC,EAAE;QAChB;;;WAGG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,gBAAgB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AAEF;;;;;G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AAG,gCAAgC,CA6BjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoProvider.d.ts","sourceRoot":"","sources":["../../../src/crypto/CryptoProvider.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"CryptoProvider.d.ts","sourceRoot":"","sources":["../../../src/crypto/CryptoProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAiB,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAM5E;;;;GAIG;AACH,qBAAa,cAAe,YAAW,OAAO;IAC1C,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,SAAS,CAAY;;IAS7B;;OAEG;IACH,eAAe,IAAI,MAAM;IAGzB;;;;OAIG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAInC;;;OAGG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAInC;;OAEG;IACH,iBAAiB,IAAI,OAAO,CAAC,SAAS,CAAC;IAIvC;;OAEG;IACH,sBAAsB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIzC;;;OAGG;IACH,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC;IAIzC;;OAEG;IACH,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAIjC;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAI1B;;OAEG;IACG,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMvD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PkceGenerator.d.ts","sourceRoot":"","sources":["../../../src/crypto/PkceGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"PkceGenerator.d.ts","sourceRoot":"","sources":["../../../src/crypto/PkceGenerator.ts"],"names":[],"mappings":"AAKA,OAAO,EAA4B,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAM9E;;GAEG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,SAAS,CAAY;;IAK7B;;;OAGG;IACG,iBAAiB,IAAI,OAAO,CAAC,SAAS,CAAC;IAM7C;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;;OAGG;IACH,OAAO,CAAC,iCAAiC;CAM5C"}
|
|
@@ -2,8 +2,11 @@ import { CommonClientCredentialRequest } from "@azure/msal-common/node";
|
|
|
2
2
|
import { ManagedIdentityRequestParams } from "./ManagedIdentityRequestParams.js";
|
|
3
3
|
/**
|
|
4
4
|
* ManagedIdentityRequest
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
5
|
+
* - clientCapabilities - an array of capabilities to be added to all network requests as part of the `xms_cc` claim
|
|
6
|
+
* - revokedTokenSha256Hash - a SHA256 hash of the token that was revoked. The managed identity will revoke the token based on the SHA256 hash of the token, not the token itself. This is to prevent the token from being leaked in transit.
|
|
7
7
|
*/
|
|
8
|
-
export type ManagedIdentityRequest = ManagedIdentityRequestParams & CommonClientCredentialRequest
|
|
8
|
+
export type ManagedIdentityRequest = ManagedIdentityRequestParams & CommonClientCredentialRequest & {
|
|
9
|
+
clientCapabilities?: Array<string>;
|
|
10
|
+
revokedTokenSha256Hash?: string;
|
|
11
|
+
};
|
|
9
12
|
//# sourceMappingURL=ManagedIdentityRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ManagedIdentityRequest.d.ts","sourceRoot":"","sources":["../../../src/request/ManagedIdentityRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAC7D,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"ManagedIdentityRequest.d.ts","sourceRoot":"","sources":["../../../src/request/ManagedIdentityRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AAEjF;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG,4BAA4B,GAC7D,6BAA6B,GAAG;IAC5B,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACnC,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACnC,CAAC"}
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import { DefaultManagedIdentityRetryPolicy } from "../retry/DefaultManagedIdentityRetryPolicy.js";
|
|
2
2
|
import { ImdsRetryPolicy } from "../retry/ImdsRetryPolicy.js";
|
|
3
|
-
export declare const AUTHORIZATION_HEADER_NAME: string;
|
|
4
|
-
export declare const METADATA_HEADER_NAME: string;
|
|
5
|
-
export declare const APP_SERVICE_SECRET_HEADER_NAME: string;
|
|
6
|
-
export declare const ML_AND_SF_SECRET_HEADER_NAME: string;
|
|
7
|
-
export declare const API_VERSION_QUERY_PARAMETER_NAME: string;
|
|
8
|
-
export declare const RESOURCE_BODY_OR_QUERY_PARAMETER_NAME: string;
|
|
9
3
|
export declare const DEFAULT_MANAGED_IDENTITY_ID = "system_assigned_managed_identity";
|
|
10
4
|
export declare const MANAGED_IDENTITY_DEFAULT_TENANT = "managed_identity";
|
|
11
5
|
export declare const DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY: string;
|
|
6
|
+
/**
|
|
7
|
+
* Managed Identity Headers - used in network requests
|
|
8
|
+
*/
|
|
9
|
+
export declare const ManagedIdentityHeaders: {
|
|
10
|
+
readonly AUTHORIZATION_HEADER_NAME: "Authorization";
|
|
11
|
+
readonly METADATA_HEADER_NAME: "Metadata";
|
|
12
|
+
readonly APP_SERVICE_SECRET_HEADER_NAME: "X-IDENTITY-HEADER";
|
|
13
|
+
readonly ML_AND_SF_SECRET_HEADER_NAME: "secret";
|
|
14
|
+
};
|
|
15
|
+
export type ManagedIdentityHeaders = (typeof ManagedIdentityHeaders)[keyof typeof ManagedIdentityHeaders];
|
|
16
|
+
/**
|
|
17
|
+
* Managed Identity Query Parameters - used in network requests
|
|
18
|
+
*/
|
|
19
|
+
export declare const ManagedIdentityQueryParameters: {
|
|
20
|
+
readonly API_VERSION: "api-version";
|
|
21
|
+
readonly RESOURCE: "resource";
|
|
22
|
+
readonly SHA256_TOKEN_TO_REFRESH: "token_sha256_to_refresh";
|
|
23
|
+
readonly XMS_CC: "xms_cc";
|
|
24
|
+
};
|
|
25
|
+
export type ManagedIdentityQueryParameters = (typeof ManagedIdentityQueryParameters)[keyof typeof ManagedIdentityQueryParameters];
|
|
12
26
|
/**
|
|
13
27
|
* Managed Identity Environment Variable Names
|
|
14
28
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../src/utils/Constants.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iCAAiC,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../../src/utils/Constants.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iCAAiC,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,eAAO,MAAM,2BAA2B,qCAAqC,CAAC;AAC9E,eAAO,MAAM,+BAA+B,qBAAqB,CAAC;AAClE,eAAO,MAAM,sCAAsC,QAA0E,CAAC;AAE9H;;GAEG;AACH,eAAO,MAAM,sBAAsB;;;;;CAKzB,CAAC;AACX,MAAM,MAAM,sBAAsB,GAC9B,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;;GAEG;AACH,eAAO,MAAM,KAAK;;;CAGjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;CAOrB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK;;;;;;;CAOjB,CAAC;AACF,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;CAaxB,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;CAGrC,CAAC;AAEF,eAAO,MAAM,oCAAoC,EAAE,MAAa,CAAC;AAEjE,MAAM,MAAM,aAAa,GAAG,iCAAiC,GAAG,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@azure/msal-node",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.6.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"email": "nugetaad@microsoft.com",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"yargs": "^17.3.1"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@azure/msal-common": "15.
|
|
86
|
+
"@azure/msal-common": "15.7.0",
|
|
87
87
|
"jsonwebtoken": "^9.0.0",
|
|
88
88
|
"uuid": "^8.3.0"
|
|
89
89
|
},
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
Constants,
|
|
10
10
|
createClientAuthError,
|
|
11
11
|
ClientAuthErrorCodes,
|
|
12
|
+
EncodingTypes,
|
|
12
13
|
} from "@azure/msal-common/node";
|
|
13
14
|
import { CryptoProvider } from "../crypto/CryptoProvider.js";
|
|
14
15
|
import { EncodingUtils } from "../utils/EncodingUtils.js";
|
|
@@ -145,7 +146,7 @@ export class ClientAssertion {
|
|
|
145
146
|
Object.assign(header, {
|
|
146
147
|
[thumbprintHeader]: EncodingUtils.base64EncodeUrl(
|
|
147
148
|
this.thumbprint,
|
|
148
|
-
|
|
149
|
+
EncodingTypes.HEX
|
|
149
150
|
),
|
|
150
151
|
} as Partial<jwt.JwtHeader>);
|
|
151
152
|
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
AuthenticationResult,
|
|
19
19
|
createClientConfigurationError,
|
|
20
20
|
ClientConfigurationErrorCodes,
|
|
21
|
+
EncodingTypes,
|
|
21
22
|
} from "@azure/msal-common/node";
|
|
22
23
|
import {
|
|
23
24
|
ManagedIdentityConfiguration,
|
|
@@ -35,6 +36,11 @@ import {
|
|
|
35
36
|
DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY,
|
|
36
37
|
ManagedIdentitySourceNames,
|
|
37
38
|
} from "../utils/Constants.js";
|
|
39
|
+
import { ManagedIdentityId } from "../config/ManagedIdentityId.js";
|
|
40
|
+
import { HashUtils } from "../crypto/HashUtils.js";
|
|
41
|
+
|
|
42
|
+
const SOURCES_THAT_SUPPORT_TOKEN_REVOCATION: Array<ManagedIdentitySourceNames> =
|
|
43
|
+
[ManagedIdentitySourceNames.SERVICE_FABRIC];
|
|
38
44
|
|
|
39
45
|
/**
|
|
40
46
|
* Class to initialize a managed identity and identify the service
|
|
@@ -56,6 +62,8 @@ export class ManagedIdentityApplication {
|
|
|
56
62
|
|
|
57
63
|
private managedIdentityClient: ManagedIdentityClient;
|
|
58
64
|
|
|
65
|
+
private hashUtils: HashUtils;
|
|
66
|
+
|
|
59
67
|
constructor(configuration?: ManagedIdentityConfiguration) {
|
|
60
68
|
// undefined config means the managed identity is system-assigned
|
|
61
69
|
this.config = buildManagedIdentityConfiguration(configuration || {});
|
|
@@ -114,6 +122,8 @@ export class ManagedIdentityApplication {
|
|
|
114
122
|
this.cryptoProvider,
|
|
115
123
|
this.config.disableInternalRetries
|
|
116
124
|
);
|
|
125
|
+
|
|
126
|
+
this.hashUtils = new HashUtils();
|
|
117
127
|
}
|
|
118
128
|
|
|
119
129
|
/**
|
|
@@ -141,14 +151,12 @@ export class ManagedIdentityApplication {
|
|
|
141
151
|
],
|
|
142
152
|
authority: this.fakeAuthority.canonicalAuthority,
|
|
143
153
|
correlationId: this.cryptoProvider.createNewGuid(),
|
|
154
|
+
claims: managedIdentityRequestParams.claims,
|
|
155
|
+
clientCapabilities: this.config.clientCapabilities,
|
|
144
156
|
};
|
|
145
157
|
|
|
146
|
-
if (
|
|
147
|
-
|
|
148
|
-
managedIdentityRequest.forceRefresh
|
|
149
|
-
) {
|
|
150
|
-
// make a network call to the managed identity source
|
|
151
|
-
return this.managedIdentityClient.sendManagedIdentityTokenRequest(
|
|
158
|
+
if (managedIdentityRequest.forceRefresh) {
|
|
159
|
+
return this.acquireTokenFromManagedIdentity(
|
|
152
160
|
managedIdentityRequest,
|
|
153
161
|
this.config.managedIdentityId,
|
|
154
162
|
this.fakeAuthority
|
|
@@ -164,6 +172,36 @@ export class ManagedIdentityApplication {
|
|
|
164
172
|
ManagedIdentityApplication.nodeStorage as NodeStorage
|
|
165
173
|
);
|
|
166
174
|
|
|
175
|
+
/*
|
|
176
|
+
* Check if claims are present in the managed identity request.
|
|
177
|
+
* If so, the cached token will not be used.
|
|
178
|
+
*/
|
|
179
|
+
if (managedIdentityRequest.claims) {
|
|
180
|
+
const sourceName: ManagedIdentitySourceNames =
|
|
181
|
+
this.managedIdentityClient.getManagedIdentitySource();
|
|
182
|
+
|
|
183
|
+
/*
|
|
184
|
+
* Check if there is a cached token and if the Managed Identity source supports token revocation.
|
|
185
|
+
* If so, hash the cached access token and add it to the request.
|
|
186
|
+
*/
|
|
187
|
+
if (
|
|
188
|
+
cachedAuthenticationResult &&
|
|
189
|
+
SOURCES_THAT_SUPPORT_TOKEN_REVOCATION.includes(sourceName)
|
|
190
|
+
) {
|
|
191
|
+
const revokedTokenSha256Hash: string = this.hashUtils
|
|
192
|
+
.sha256(cachedAuthenticationResult.accessToken)
|
|
193
|
+
.toString(EncodingTypes.HEX);
|
|
194
|
+
managedIdentityRequest.revokedTokenSha256Hash =
|
|
195
|
+
revokedTokenSha256Hash;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return this.acquireTokenFromManagedIdentity(
|
|
199
|
+
managedIdentityRequest,
|
|
200
|
+
this.config.managedIdentityId,
|
|
201
|
+
this.fakeAuthority
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
167
205
|
if (cachedAuthenticationResult) {
|
|
168
206
|
// if the token is not expired but must be refreshed; get a new one in the background
|
|
169
207
|
if (lastCacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {
|
|
@@ -171,9 +209,9 @@ export class ManagedIdentityApplication {
|
|
|
171
209
|
"ClientCredentialClient:getCachedAuthenticationResult - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed."
|
|
172
210
|
);
|
|
173
211
|
|
|
174
|
-
//
|
|
212
|
+
// force refresh; will run in the background
|
|
175
213
|
const refreshAccessToken = true;
|
|
176
|
-
await this.
|
|
214
|
+
await this.acquireTokenFromManagedIdentity(
|
|
177
215
|
managedIdentityRequest,
|
|
178
216
|
this.config.managedIdentityId,
|
|
179
217
|
this.fakeAuthority,
|
|
@@ -183,8 +221,7 @@ export class ManagedIdentityApplication {
|
|
|
183
221
|
|
|
184
222
|
return cachedAuthenticationResult;
|
|
185
223
|
} else {
|
|
186
|
-
|
|
187
|
-
return this.managedIdentityClient.sendManagedIdentityTokenRequest(
|
|
224
|
+
return this.acquireTokenFromManagedIdentity(
|
|
188
225
|
managedIdentityRequest,
|
|
189
226
|
this.config.managedIdentityId,
|
|
190
227
|
this.fakeAuthority
|
|
@@ -192,6 +229,30 @@ export class ManagedIdentityApplication {
|
|
|
192
229
|
}
|
|
193
230
|
}
|
|
194
231
|
|
|
232
|
+
/**
|
|
233
|
+
* Acquires a token from a managed identity endpoint.
|
|
234
|
+
*
|
|
235
|
+
* @param managedIdentityRequest - The request object containing parameters for the managed identity token request.
|
|
236
|
+
* @param managedIdentityId - The identifier for the managed identity (e.g., client ID or resource ID).
|
|
237
|
+
* @param fakeAuthority - A placeholder authority used for the token request.
|
|
238
|
+
* @param refreshAccessToken - Optional flag indicating whether to force a refresh of the access token.
|
|
239
|
+
* @returns A promise that resolves to an AuthenticationResult containing the acquired token and related information.
|
|
240
|
+
*/
|
|
241
|
+
private async acquireTokenFromManagedIdentity(
|
|
242
|
+
managedIdentityRequest: ManagedIdentityRequest,
|
|
243
|
+
managedIdentityId: ManagedIdentityId,
|
|
244
|
+
fakeAuthority: Authority,
|
|
245
|
+
refreshAccessToken?: boolean
|
|
246
|
+
): Promise<AuthenticationResult> {
|
|
247
|
+
// make a network call to the managed identity
|
|
248
|
+
return this.managedIdentityClient.sendManagedIdentityTokenRequest(
|
|
249
|
+
managedIdentityRequest,
|
|
250
|
+
managedIdentityId,
|
|
251
|
+
fakeAuthority,
|
|
252
|
+
refreshAccessToken
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
|
|
195
256
|
/**
|
|
196
257
|
* Determine the Managed Identity Source based on available environment variables. This API is consumed by Azure Identity SDK.
|
|
197
258
|
* @returns ManagedIdentitySourceNames - The Managed Identity source's name
|
|
@@ -7,12 +7,11 @@ import { INetworkModule, Logger } from "@azure/msal-common/node";
|
|
|
7
7
|
import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource.js";
|
|
8
8
|
import {
|
|
9
9
|
HttpMethod,
|
|
10
|
-
APP_SERVICE_SECRET_HEADER_NAME,
|
|
11
|
-
API_VERSION_QUERY_PARAMETER_NAME,
|
|
12
|
-
RESOURCE_BODY_OR_QUERY_PARAMETER_NAME,
|
|
13
10
|
ManagedIdentityEnvironmentVariableNames,
|
|
14
11
|
ManagedIdentitySourceNames,
|
|
15
12
|
ManagedIdentityIdType,
|
|
13
|
+
ManagedIdentityQueryParameters,
|
|
14
|
+
ManagedIdentityHeaders,
|
|
16
15
|
} from "../../utils/Constants.js";
|
|
17
16
|
import { CryptoProvider } from "../../crypto/CryptoProvider.js";
|
|
18
17
|
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters.js";
|
|
@@ -114,11 +113,12 @@ export class AppService extends BaseManagedIdentitySource {
|
|
|
114
113
|
this.identityEndpoint
|
|
115
114
|
);
|
|
116
115
|
|
|
117
|
-
request.headers[APP_SERVICE_SECRET_HEADER_NAME] =
|
|
116
|
+
request.headers[ManagedIdentityHeaders.APP_SERVICE_SECRET_HEADER_NAME] =
|
|
117
|
+
this.identityHeader;
|
|
118
118
|
|
|
119
|
-
request.queryParameters[
|
|
119
|
+
request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
|
|
120
120
|
APP_SERVICE_MSI_API_VERSION;
|
|
121
|
-
request.queryParameters[
|
|
121
|
+
request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
122
122
|
resource;
|
|
123
123
|
|
|
124
124
|
if (
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
NetworkRequestOptions,
|
|
14
14
|
Logger,
|
|
15
15
|
ServerAuthorizationTokenResponse,
|
|
16
|
+
EncodingTypes,
|
|
16
17
|
} from "@azure/msal-common/node";
|
|
17
18
|
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters.js";
|
|
18
19
|
import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource.js";
|
|
@@ -22,15 +23,13 @@ import {
|
|
|
22
23
|
createManagedIdentityError,
|
|
23
24
|
} from "../../error/ManagedIdentityError.js";
|
|
24
25
|
import {
|
|
25
|
-
API_VERSION_QUERY_PARAMETER_NAME,
|
|
26
|
-
AUTHORIZATION_HEADER_NAME,
|
|
27
26
|
AZURE_ARC_SECRET_FILE_MAX_SIZE_BYTES,
|
|
28
27
|
HttpMethod,
|
|
29
|
-
METADATA_HEADER_NAME,
|
|
30
28
|
ManagedIdentityEnvironmentVariableNames,
|
|
29
|
+
ManagedIdentityHeaders,
|
|
31
30
|
ManagedIdentityIdType,
|
|
31
|
+
ManagedIdentityQueryParameters,
|
|
32
32
|
ManagedIdentitySourceNames,
|
|
33
|
-
RESOURCE_BODY_OR_QUERY_PARAMETER_NAME,
|
|
34
33
|
} from "../../utils/Constants.js";
|
|
35
34
|
import { NodeStorage } from "../../cache/NodeStorage.js";
|
|
36
35
|
import {
|
|
@@ -201,11 +200,11 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
201
200
|
this.identityEndpoint.replace("localhost", "127.0.0.1")
|
|
202
201
|
);
|
|
203
202
|
|
|
204
|
-
request.headers[METADATA_HEADER_NAME] = "true";
|
|
203
|
+
request.headers[ManagedIdentityHeaders.METADATA_HEADER_NAME] = "true";
|
|
205
204
|
|
|
206
|
-
request.queryParameters[
|
|
205
|
+
request.queryParameters[ManagedIdentityQueryParameters.API_VERSION] =
|
|
207
206
|
ARC_API_VERSION;
|
|
208
|
-
request.queryParameters[
|
|
207
|
+
request.queryParameters[ManagedIdentityQueryParameters.RESOURCE] =
|
|
209
208
|
resource;
|
|
210
209
|
|
|
211
210
|
// bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
|
|
@@ -292,7 +291,7 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
292
291
|
// attempt to read the contents of the secret file
|
|
293
292
|
let secret;
|
|
294
293
|
try {
|
|
295
|
-
secret = readFileSync(secretFilePath,
|
|
294
|
+
secret = readFileSync(secretFilePath, EncodingTypes.UTF8);
|
|
296
295
|
} catch (e) {
|
|
297
296
|
throw createManagedIdentityError(
|
|
298
297
|
ManagedIdentityErrorCodes.unableToReadSecretFile
|
|
@@ -303,7 +302,9 @@ export class AzureArc extends BaseManagedIdentitySource {
|
|
|
303
302
|
this.logger.info(
|
|
304
303
|
`[Managed Identity] Adding authorization header to the request.`
|
|
305
304
|
);
|
|
306
|
-
networkRequest.headers[
|
|
305
|
+
networkRequest.headers[
|
|
306
|
+
ManagedIdentityHeaders.AUTHORIZATION_HEADER_NAME
|
|
307
|
+
] = authHeaderValue;
|
|
307
308
|
|
|
308
309
|
try {
|
|
309
310
|
retryResponse =
|
|
@@ -24,7 +24,11 @@ import { ManagedIdentityId } from "../../config/ManagedIdentityId.js";
|
|
|
24
24
|
import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters.js";
|
|
25
25
|
import { CryptoProvider } from "../../crypto/CryptoProvider.js";
|
|
26
26
|
import { ManagedIdentityRequest } from "../../request/ManagedIdentityRequest.js";
|
|
27
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
HttpMethod,
|
|
29
|
+
ManagedIdentityIdType,
|
|
30
|
+
ManagedIdentityQueryParameters,
|
|
31
|
+
} from "../../utils/Constants.js";
|
|
28
32
|
import { ManagedIdentityTokenResponse } from "../../response/ManagedIdentityTokenResponse.js";
|
|
29
33
|
import { NodeStorage } from "../../cache/NodeStorage.js";
|
|
30
34
|
import {
|
|
@@ -146,6 +150,29 @@ export abstract class BaseManagedIdentitySource {
|
|
|
146
150
|
managedIdentityId
|
|
147
151
|
);
|
|
148
152
|
|
|
153
|
+
if (managedIdentityRequest.revokedTokenSha256Hash) {
|
|
154
|
+
this.logger.info(
|
|
155
|
+
`[Managed Identity] The following claims are present in the request: ${managedIdentityRequest.claims}`
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
networkRequest.queryParameters[
|
|
159
|
+
ManagedIdentityQueryParameters.SHA256_TOKEN_TO_REFRESH
|
|
160
|
+
] = managedIdentityRequest.revokedTokenSha256Hash;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (managedIdentityRequest.clientCapabilities?.length) {
|
|
164
|
+
const clientCapabilities: string =
|
|
165
|
+
managedIdentityRequest.clientCapabilities.toString();
|
|
166
|
+
|
|
167
|
+
this.logger.info(
|
|
168
|
+
`[Managed Identity] The following client capabilities are present in the request: ${clientCapabilities}`
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
networkRequest.queryParameters[
|
|
172
|
+
ManagedIdentityQueryParameters.XMS_CC
|
|
173
|
+
] = clientCapabilities;
|
|
174
|
+
}
|
|
175
|
+
|
|
149
176
|
const headers: Record<string, string> = networkRequest.headers;
|
|
150
177
|
headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
|
|
151
178
|
|