@azure/msal-node 2.6.5-alpha.0 → 2.6.6
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.cjs +1 -1
- package/dist/cache/NodeStorage.mjs +1 -1
- package/dist/cache/TokenCache.cjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.cjs +1 -1
- package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
- package/dist/cache/serializer/Deserializer.cjs +1 -1
- package/dist/cache/serializer/Deserializer.mjs +1 -1
- package/dist/cache/serializer/Serializer.cjs +1 -1
- package/dist/cache/serializer/Serializer.mjs +1 -1
- package/dist/client/ClientApplication.cjs +1 -1
- package/dist/client/ClientApplication.mjs +1 -1
- package/dist/client/ClientAssertion.cjs +1 -1
- package/dist/client/ClientAssertion.mjs +1 -1
- package/dist/client/ClientCredentialClient.cjs +23 -27
- package/dist/client/ClientCredentialClient.cjs.map +1 -1
- package/dist/client/ClientCredentialClient.d.ts +3 -3
- package/dist/client/ClientCredentialClient.d.ts.map +1 -1
- package/dist/client/ClientCredentialClient.mjs +24 -28
- package/dist/client/ClientCredentialClient.mjs.map +1 -1
- package/dist/client/ConfidentialClientApplication.cjs +1 -1
- package/dist/client/ConfidentialClientApplication.mjs +1 -1
- package/dist/client/DeviceCodeClient.cjs +1 -1
- package/dist/client/DeviceCodeClient.mjs +1 -1
- package/dist/client/OnBehalfOfClient.cjs +1 -1
- package/dist/client/OnBehalfOfClient.mjs +1 -1
- package/dist/client/PublicClientApplication.cjs +1 -1
- package/dist/client/PublicClientApplication.mjs +1 -1
- package/dist/client/UsernamePasswordClient.cjs +1 -1
- package/dist/client/UsernamePasswordClient.mjs +1 -1
- package/dist/config/Configuration.cjs +2 -36
- package/dist/config/Configuration.cjs.map +1 -1
- package/dist/config/Configuration.d.ts +0 -16
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +3 -36
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/crypto/CryptoProvider.cjs +1 -1
- package/dist/crypto/CryptoProvider.mjs +1 -1
- package/dist/crypto/GuidGenerator.cjs +1 -1
- package/dist/crypto/GuidGenerator.mjs +1 -1
- package/dist/crypto/HashUtils.cjs +1 -1
- package/dist/crypto/HashUtils.mjs +1 -1
- package/dist/crypto/PkceGenerator.cjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/error/NodeAuthError.cjs +1 -1
- package/dist/error/NodeAuthError.mjs +1 -1
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internals.cjs +1 -1
- package/dist/internals.mjs +1 -1
- package/dist/network/HttpClient.cjs +6 -13
- package/dist/network/HttpClient.cjs.map +1 -1
- package/dist/network/HttpClient.d.ts +1 -2
- package/dist/network/HttpClient.d.ts.map +1 -1
- package/dist/network/HttpClient.mjs +6 -13
- package/dist/network/HttpClient.mjs.map +1 -1
- package/dist/network/LoopbackClient.cjs +1 -1
- package/dist/network/LoopbackClient.mjs +1 -1
- package/dist/packageMetadata.cjs +2 -2
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/utils/Constants.cjs +1 -68
- package/dist/utils/Constants.cjs.map +1 -1
- package/dist/utils/Constants.d.ts +0 -45
- package/dist/utils/Constants.d.ts.map +1 -1
- package/dist/utils/Constants.mjs +2 -54
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/EncodingUtils.cjs +1 -1
- package/dist/utils/EncodingUtils.mjs +1 -1
- package/dist/utils/NetworkUtils.cjs +1 -1
- package/dist/utils/NetworkUtils.mjs +1 -1
- package/package.json +2 -2
- package/src/client/ClientCredentialClient.ts +25 -65
- package/src/config/Configuration.ts +1 -81
- package/src/index.ts +0 -4
- package/src/network/HttpClient.ts +5 -17
- package/src/packageMetadata.ts +1 -1
- package/src/utils/Constants.ts +0 -63
- package/dist/client/ManagedIdentityApplication.cjs +0 -97
- package/dist/client/ManagedIdentityApplication.cjs.map +0 -1
- package/dist/client/ManagedIdentityApplication.d.ts +0 -24
- package/dist/client/ManagedIdentityApplication.d.ts.map +0 -1
- package/dist/client/ManagedIdentityApplication.mjs +0 -95
- package/dist/client/ManagedIdentityApplication.mjs.map +0 -1
- package/dist/client/ManagedIdentityClient.cjs +0 -53
- package/dist/client/ManagedIdentityClient.cjs.map +0 -1
- package/dist/client/ManagedIdentityClient.d.ts +0 -25
- package/dist/client/ManagedIdentityClient.d.ts.map +0 -1
- package/dist/client/ManagedIdentityClient.mjs +0 -51
- package/dist/client/ManagedIdentityClient.mjs.map +0 -1
- package/dist/client/ManagedIdentitySources/AppService.cjs +0 -52
- package/dist/client/ManagedIdentitySources/AppService.cjs.map +0 -1
- package/dist/client/ManagedIdentitySources/AppService.d.ts +0 -17
- package/dist/client/ManagedIdentitySources/AppService.d.ts.map +0 -1
- package/dist/client/ManagedIdentitySources/AppService.mjs +0 -50
- package/dist/client/ManagedIdentitySources/AppService.mjs.map +0 -1
- package/dist/client/ManagedIdentitySources/AzureArc.cjs +0 -96
- package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +0 -1
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts +0 -19
- package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +0 -1
- package/dist/client/ManagedIdentitySources/AzureArc.mjs +0 -93
- package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +0 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +0 -122
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +0 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +0 -31
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +0 -1
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +0 -119
- package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +0 -1
- package/dist/client/ManagedIdentitySources/CloudShell.cjs +0 -47
- package/dist/client/ManagedIdentitySources/CloudShell.cjs.map +0 -1
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts +0 -16
- package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +0 -1
- package/dist/client/ManagedIdentitySources/CloudShell.mjs +0 -45
- package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +0 -1
- package/dist/client/ManagedIdentitySources/Imds.cjs +0 -54
- package/dist/client/ManagedIdentitySources/Imds.cjs.map +0 -1
- package/dist/client/ManagedIdentitySources/Imds.d.ts +0 -13
- package/dist/client/ManagedIdentitySources/Imds.d.ts.map +0 -1
- package/dist/client/ManagedIdentitySources/Imds.mjs +0 -52
- package/dist/client/ManagedIdentitySources/Imds.mjs.map +0 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.cjs +0 -61
- package/dist/client/ManagedIdentitySources/ServiceFabric.cjs.map +0 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +0 -17
- package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +0 -1
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +0 -59
- package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +0 -1
- package/dist/config/ManagedIdentityId.cjs +0 -59
- package/dist/config/ManagedIdentityId.cjs.map +0 -1
- package/dist/config/ManagedIdentityId.d.ts +0 -12
- package/dist/config/ManagedIdentityId.d.ts.map +0 -1
- package/dist/config/ManagedIdentityId.mjs +0 -57
- package/dist/config/ManagedIdentityId.mjs.map +0 -1
- package/dist/config/ManagedIdentityRequestParameters.cjs +0 -37
- package/dist/config/ManagedIdentityRequestParameters.cjs.map +0 -1
- package/dist/config/ManagedIdentityRequestParameters.d.ts +0 -12
- package/dist/config/ManagedIdentityRequestParameters.d.ts.map +0 -1
- package/dist/config/ManagedIdentityRequestParameters.mjs +0 -35
- package/dist/config/ManagedIdentityRequestParameters.mjs.map +0 -1
- package/dist/error/ManagedIdentityError.cjs +0 -51
- package/dist/error/ManagedIdentityError.cjs.map +0 -1
- package/dist/error/ManagedIdentityError.d.ts +0 -28
- package/dist/error/ManagedIdentityError.d.ts.map +0 -1
- package/dist/error/ManagedIdentityError.mjs +0 -47
- package/dist/error/ManagedIdentityError.mjs.map +0 -1
- package/dist/error/ManagedIdentityErrorCodes.cjs +0 -41
- package/dist/error/ManagedIdentityErrorCodes.cjs.map +0 -1
- package/dist/error/ManagedIdentityErrorCodes.d.ts +0 -20
- package/dist/error/ManagedIdentityErrorCodes.d.ts.map +0 -1
- package/dist/error/ManagedIdentityErrorCodes.mjs +0 -28
- package/dist/error/ManagedIdentityErrorCodes.mjs.map +0 -1
- package/dist/network/HttpClientWithRetries.cjs +0 -44
- package/dist/network/HttpClientWithRetries.cjs.map +0 -1
- package/dist/network/HttpClientWithRetries.d.ts +0 -12
- package/dist/network/HttpClientWithRetries.d.ts.map +0 -1
- package/dist/network/HttpClientWithRetries.mjs +0 -42
- package/dist/network/HttpClientWithRetries.mjs.map +0 -1
- package/dist/request/ManagedIdentityRequest.d.ts +0 -9
- package/dist/request/ManagedIdentityRequest.d.ts.map +0 -1
- package/dist/request/ManagedIdentityRequestParams.d.ts +0 -10
- package/dist/request/ManagedIdentityRequestParams.d.ts.map +0 -1
- package/dist/response/ManagedIdentityTokenResponse.d.ts +0 -25
- package/dist/response/ManagedIdentityTokenResponse.d.ts.map +0 -1
- package/dist/retry/IHttpRetryPolicy.d.ts +0 -6
- package/dist/retry/IHttpRetryPolicy.d.ts.map +0 -1
- package/dist/retry/LinearRetryPolicy.cjs +0 -47
- package/dist/retry/LinearRetryPolicy.cjs.map +0 -1
- package/dist/retry/LinearRetryPolicy.d.ts +0 -12
- package/dist/retry/LinearRetryPolicy.d.ts.map +0 -1
- package/dist/retry/LinearRetryPolicy.mjs +0 -45
- package/dist/retry/LinearRetryPolicy.mjs.map +0 -1
- package/src/client/ManagedIdentityApplication.ts +0 -194
- package/src/client/ManagedIdentityClient.ts +0 -128
- package/src/client/ManagedIdentitySources/AppService.ts +0 -122
- package/src/client/ManagedIdentitySources/AzureArc.ts +0 -199
- package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +0 -237
- package/src/client/ManagedIdentitySources/CloudShell.ts +0 -104
- package/src/client/ManagedIdentitySources/Imds.ts +0 -126
- package/src/client/ManagedIdentitySources/ServiceFabric.ts +0 -140
- package/src/config/ManagedIdentityId.ts +0 -73
- package/src/config/ManagedIdentityRequestParameters.ts +0 -48
- package/src/error/ManagedIdentityError.ts +0 -59
- package/src/error/ManagedIdentityErrorCodes.ts +0 -34
- package/src/network/HttpClientWithRetries.ts +0 -80
- package/src/request/ManagedIdentityRequest.ts +0 -15
- package/src/request/ManagedIdentityRequestParams.ts +0 -14
- package/src/response/ManagedIdentityTokenResponse.ts +0 -33
- package/src/retry/IHttpRetryPolicy.ts +0 -18
- package/src/retry/LinearRetryPolicy.ts +0 -71
package/dist/utils/Constants.cjs
CHANGED
|
@@ -1,53 +1,11 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.6.
|
|
1
|
+
/*! @azure/msal-node v2.6.6 2024-03-27 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
var msalCommon = require('@azure/msal-common');
|
|
6
|
-
|
|
7
5
|
/*
|
|
8
6
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
7
|
* Licensed under the MIT License.
|
|
10
8
|
*/
|
|
11
|
-
// MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
|
|
12
|
-
const AUTHORIZATION_HEADER_NAME = "Authorization";
|
|
13
|
-
const METADATA_HEADER_NAME = "Metadata";
|
|
14
|
-
const APP_SERVICE_SECRET_HEADER_NAME = "X-IDENTITY-HEADER";
|
|
15
|
-
const SERVICE_FABRIC_SECRET_HEADER_NAME = "secret";
|
|
16
|
-
const API_VERSION_QUERY_PARAMETER_NAME = "api-version";
|
|
17
|
-
const RESOURCE_BODY_OR_QUERY_PARAMETER_NAME = "resource";
|
|
18
|
-
const DEFAULT_MANAGED_IDENTITY_ID = "system_assigned_managed_identity";
|
|
19
|
-
const MANAGED_IDENTITY_DEFAULT_TENANT = "managed_identity";
|
|
20
|
-
const DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY = `https://login.microsoftonline.com/${MANAGED_IDENTITY_DEFAULT_TENANT}/`;
|
|
21
|
-
/**
|
|
22
|
-
* Managed Identity Environment Variable Names
|
|
23
|
-
*/
|
|
24
|
-
const ManagedIdentityEnvironmentVariableNames = {
|
|
25
|
-
AZURE_POD_IDENTITY_AUTHORITY_HOST: "AZURE_POD_IDENTITY_AUTHORITY_HOST",
|
|
26
|
-
IDENTITY_ENDPOINT: "IDENTITY_ENDPOINT",
|
|
27
|
-
IDENTITY_HEADER: "IDENTITY_HEADER",
|
|
28
|
-
IDENTITY_SERVER_THUMBPRINT: "IDENTITY_SERVER_THUMBPRINT",
|
|
29
|
-
IMDS_ENDPOINT: "IMDS_ENDPOINT",
|
|
30
|
-
MSI_ENDPOINT: "MSI_ENDPOINT",
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* Managed Identity Source Names
|
|
34
|
-
*/
|
|
35
|
-
const ManagedIdentitySourceNames = {
|
|
36
|
-
APP_SERVICE: "App Service",
|
|
37
|
-
AZURE_ARC: "Azure Arc",
|
|
38
|
-
CLOUD_SHELL: "Cloud Shell",
|
|
39
|
-
IMDS: "IMDS",
|
|
40
|
-
SERVICE_FABRIC: "Service Fabric",
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Managed Identity Ids
|
|
44
|
-
*/
|
|
45
|
-
const ManagedIdentityIdType = {
|
|
46
|
-
SYSTEM_ASSIGNED: "system-assigned",
|
|
47
|
-
USER_ASSIGNED_CLIENT_ID: "user-assigned-client-id",
|
|
48
|
-
USER_ASSIGNED_RESOURCE_ID: "user-assigned-resource-id",
|
|
49
|
-
USER_ASSIGNED_OBJECT_ID: "user-assigned-object-id",
|
|
50
|
-
};
|
|
51
9
|
/**
|
|
52
10
|
* http methods
|
|
53
11
|
*/
|
|
@@ -124,40 +82,15 @@ const LOOPBACK_SERVER_CONSTANTS = {
|
|
|
124
82
|
INTERVAL_MS: 100,
|
|
125
83
|
TIMEOUT_MS: 5000,
|
|
126
84
|
};
|
|
127
|
-
const MANAGED_IDENTITY_MAX_RETRIES = 1;
|
|
128
|
-
const MANAGED_IDENTITY_RETRY_DELAY = 1000;
|
|
129
|
-
const MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON = [
|
|
130
|
-
msalCommon.HttpStatus.NOT_FOUND,
|
|
131
|
-
msalCommon.HttpStatus.REQUEST_TIMEOUT,
|
|
132
|
-
msalCommon.HttpStatus.TOO_MANY_REQUESTS,
|
|
133
|
-
msalCommon.HttpStatus.INTERNAL_SERVER_ERROR,
|
|
134
|
-
msalCommon.HttpStatus.SERVICE_UNAVAILABLE,
|
|
135
|
-
msalCommon.HttpStatus.GATEWAY_TIMEOUT,
|
|
136
|
-
];
|
|
137
85
|
|
|
138
|
-
exports.API_VERSION_QUERY_PARAMETER_NAME = API_VERSION_QUERY_PARAMETER_NAME;
|
|
139
|
-
exports.APP_SERVICE_SECRET_HEADER_NAME = APP_SERVICE_SECRET_HEADER_NAME;
|
|
140
|
-
exports.AUTHORIZATION_HEADER_NAME = AUTHORIZATION_HEADER_NAME;
|
|
141
86
|
exports.ApiId = ApiId;
|
|
142
87
|
exports.CharSet = CharSet;
|
|
143
88
|
exports.Constants = Constants;
|
|
144
|
-
exports.DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY = DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY;
|
|
145
|
-
exports.DEFAULT_MANAGED_IDENTITY_ID = DEFAULT_MANAGED_IDENTITY_ID;
|
|
146
89
|
exports.Hash = Hash;
|
|
147
90
|
exports.HttpMethod = HttpMethod;
|
|
148
91
|
exports.JwtConstants = JwtConstants;
|
|
149
92
|
exports.LOOPBACK_SERVER_CONSTANTS = LOOPBACK_SERVER_CONSTANTS;
|
|
150
|
-
exports.MANAGED_IDENTITY_DEFAULT_TENANT = MANAGED_IDENTITY_DEFAULT_TENANT;
|
|
151
|
-
exports.MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON = MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON;
|
|
152
|
-
exports.MANAGED_IDENTITY_MAX_RETRIES = MANAGED_IDENTITY_MAX_RETRIES;
|
|
153
|
-
exports.MANAGED_IDENTITY_RETRY_DELAY = MANAGED_IDENTITY_RETRY_DELAY;
|
|
154
|
-
exports.METADATA_HEADER_NAME = METADATA_HEADER_NAME;
|
|
155
|
-
exports.ManagedIdentityEnvironmentVariableNames = ManagedIdentityEnvironmentVariableNames;
|
|
156
|
-
exports.ManagedIdentityIdType = ManagedIdentityIdType;
|
|
157
|
-
exports.ManagedIdentitySourceNames = ManagedIdentitySourceNames;
|
|
158
93
|
exports.ProxyStatus = ProxyStatus;
|
|
159
94
|
exports.RANDOM_OCTET_SIZE = RANDOM_OCTET_SIZE;
|
|
160
95
|
exports.REGION_ENVIRONMENT_VARIABLE = REGION_ENVIRONMENT_VARIABLE;
|
|
161
|
-
exports.RESOURCE_BODY_OR_QUERY_PARAMETER_NAME = RESOURCE_BODY_OR_QUERY_PARAMETER_NAME;
|
|
162
|
-
exports.SERVICE_FABRIC_SECRET_HEADER_NAME = SERVICE_FABRIC_SECRET_HEADER_NAME;
|
|
163
96
|
//# sourceMappingURL=Constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.cjs","sources":["../../src/utils/Constants.ts"],"sourcesContent":[null],"names":[
|
|
1
|
+
{"version":3,"file":"Constants.cjs","sources":["../../src/utils/Constants.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AAEH;;AAEG;AACU,MAAA,UAAU,GAAG;AACtB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,MAAM;EACL;AAGE,MAAA,WAAW,GAAG;AACvB,IAAA,mBAAmB,EAAE,GAAG;AACxB,IAAA,iBAAiB,EAAE,GAAG;AACtB,IAAA,YAAY,EAAE,GAAG;EACV;AAGX;;AAEG;AACI,MAAM,2BAA2B,GAAG,cAAc;AAEzD;;AAEG;AACI,MAAM,iBAAiB,GAAG,GAAG;AAEpC;;AAEG;AACU,MAAA,IAAI,GAAG;AAChB,IAAA,MAAM,EAAE,QAAQ;EAClB;AAEF;;AAEG;AACU,MAAA,OAAO,GAAG;AACnB,IAAA,UAAU,EACN,oEAAoE;EAC1E;AAUF;;AAEG;AACU,MAAA,SAAS,GAAG;AACrB,IAAA,QAAQ,EAAE,cAAc;AACxB,IAAA,yBAAyB,EACrB,wDAAwD;AAC5D,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,SAAS,EAAE,WAAW;EACxB;AAEF;;;;;;AAMG;AACU,MAAA,KAAK,GAAG;AACjB,IAAA,kBAAkB,EAAE,EAAE;AACtB,IAAA,8BAA8B,EAAE,GAAG;AACnC,IAAA,wBAAwB,EAAE,GAAG;AAC7B,IAAA,8BAA8B,EAAE,GAAG;AACnC,IAAA,kBAAkB,EAAE,GAAG;AACvB,IAAA,0BAA0B,EAAE,GAAG;EACjC;AAGF;;AAEG;AACU,MAAA,YAAY,GAAG;AACxB,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,MAAM,EAAE,KAAK;EACf;AAEW,MAAA,yBAAyB,GAAG;AACrC,IAAA,WAAW,EAAE,GAAG;AAChB,IAAA,UAAU,EAAE,IAAI;;;;;;;;;;;;;;"}
|
|
@@ -1,45 +1,3 @@
|
|
|
1
|
-
export declare const AUTHORIZATION_HEADER_NAME: string;
|
|
2
|
-
export declare const METADATA_HEADER_NAME: string;
|
|
3
|
-
export declare const APP_SERVICE_SECRET_HEADER_NAME: string;
|
|
4
|
-
export declare const SERVICE_FABRIC_SECRET_HEADER_NAME: string;
|
|
5
|
-
export declare const API_VERSION_QUERY_PARAMETER_NAME: string;
|
|
6
|
-
export declare const RESOURCE_BODY_OR_QUERY_PARAMETER_NAME: string;
|
|
7
|
-
export declare const DEFAULT_MANAGED_IDENTITY_ID = "system_assigned_managed_identity";
|
|
8
|
-
export declare const MANAGED_IDENTITY_DEFAULT_TENANT = "managed_identity";
|
|
9
|
-
export declare const DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY: string;
|
|
10
|
-
/**
|
|
11
|
-
* Managed Identity Environment Variable Names
|
|
12
|
-
*/
|
|
13
|
-
export declare const ManagedIdentityEnvironmentVariableNames: {
|
|
14
|
-
readonly AZURE_POD_IDENTITY_AUTHORITY_HOST: "AZURE_POD_IDENTITY_AUTHORITY_HOST";
|
|
15
|
-
readonly IDENTITY_ENDPOINT: "IDENTITY_ENDPOINT";
|
|
16
|
-
readonly IDENTITY_HEADER: "IDENTITY_HEADER";
|
|
17
|
-
readonly IDENTITY_SERVER_THUMBPRINT: "IDENTITY_SERVER_THUMBPRINT";
|
|
18
|
-
readonly IMDS_ENDPOINT: "IMDS_ENDPOINT";
|
|
19
|
-
readonly MSI_ENDPOINT: "MSI_ENDPOINT";
|
|
20
|
-
};
|
|
21
|
-
export type ManagedIdentityEnvironmentVariableNames = (typeof ManagedIdentityEnvironmentVariableNames)[keyof typeof ManagedIdentityEnvironmentVariableNames];
|
|
22
|
-
/**
|
|
23
|
-
* Managed Identity Source Names
|
|
24
|
-
*/
|
|
25
|
-
export declare const ManagedIdentitySourceNames: {
|
|
26
|
-
readonly APP_SERVICE: "App Service";
|
|
27
|
-
readonly AZURE_ARC: "Azure Arc";
|
|
28
|
-
readonly CLOUD_SHELL: "Cloud Shell";
|
|
29
|
-
readonly IMDS: "IMDS";
|
|
30
|
-
readonly SERVICE_FABRIC: "Service Fabric";
|
|
31
|
-
};
|
|
32
|
-
export type ManagedIdentitySourceNames = (typeof ManagedIdentitySourceNames)[keyof typeof ManagedIdentitySourceNames];
|
|
33
|
-
/**
|
|
34
|
-
* Managed Identity Ids
|
|
35
|
-
*/
|
|
36
|
-
export declare const ManagedIdentityIdType: {
|
|
37
|
-
readonly SYSTEM_ASSIGNED: "system-assigned";
|
|
38
|
-
readonly USER_ASSIGNED_CLIENT_ID: "user-assigned-client-id";
|
|
39
|
-
readonly USER_ASSIGNED_RESOURCE_ID: "user-assigned-resource-id";
|
|
40
|
-
readonly USER_ASSIGNED_OBJECT_ID: "user-assigned-object-id";
|
|
41
|
-
};
|
|
42
|
-
export type ManagedIdentityIdType = (typeof ManagedIdentityIdType)[keyof typeof ManagedIdentityIdType];
|
|
43
1
|
/**
|
|
44
2
|
* http methods
|
|
45
3
|
*/
|
|
@@ -126,7 +84,4 @@ export declare const LOOPBACK_SERVER_CONSTANTS: {
|
|
|
126
84
|
INTERVAL_MS: number;
|
|
127
85
|
TIMEOUT_MS: number;
|
|
128
86
|
};
|
|
129
|
-
export declare const MANAGED_IDENTITY_MAX_RETRIES = 1;
|
|
130
|
-
export declare const MANAGED_IDENTITY_RETRY_DELAY = 1000;
|
|
131
|
-
export declare const MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON: (500 | 404 | 408 | 429 | 503 | 504)[];
|
|
132
87
|
//# sourceMappingURL=Constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/utils/Constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Constants.d.ts","sourceRoot":"","sources":["../../src/utils/Constants.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,UAAU;;;CAGb,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEtE,eAAO,MAAM,WAAW;;;;CAId,CAAC;AACX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,2BAA2B,gBAAgB,CAAC;AAEzD;;GAEG;AACH,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC;;GAEG;AACH,eAAO,MAAM,IAAI;;CAEhB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO;;CAGnB,CAAC;AAEF;;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;;;;;;;;;;;CAWxB,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;CAGrC,CAAC"}
|
package/dist/utils/Constants.mjs
CHANGED
|
@@ -1,51 +1,9 @@
|
|
|
1
|
-
/*! @azure/msal-node v2.6.
|
|
1
|
+
/*! @azure/msal-node v2.6.6 2024-03-27 */
|
|
2
2
|
'use strict';
|
|
3
|
-
import { HttpStatus } from '@azure/msal-common';
|
|
4
|
-
|
|
5
3
|
/*
|
|
6
4
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
5
|
* Licensed under the MIT License.
|
|
8
6
|
*/
|
|
9
|
-
// MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
|
|
10
|
-
const AUTHORIZATION_HEADER_NAME = "Authorization";
|
|
11
|
-
const METADATA_HEADER_NAME = "Metadata";
|
|
12
|
-
const APP_SERVICE_SECRET_HEADER_NAME = "X-IDENTITY-HEADER";
|
|
13
|
-
const SERVICE_FABRIC_SECRET_HEADER_NAME = "secret";
|
|
14
|
-
const API_VERSION_QUERY_PARAMETER_NAME = "api-version";
|
|
15
|
-
const RESOURCE_BODY_OR_QUERY_PARAMETER_NAME = "resource";
|
|
16
|
-
const DEFAULT_MANAGED_IDENTITY_ID = "system_assigned_managed_identity";
|
|
17
|
-
const MANAGED_IDENTITY_DEFAULT_TENANT = "managed_identity";
|
|
18
|
-
const DEFAULT_AUTHORITY_FOR_MANAGED_IDENTITY = `https://login.microsoftonline.com/${MANAGED_IDENTITY_DEFAULT_TENANT}/`;
|
|
19
|
-
/**
|
|
20
|
-
* Managed Identity Environment Variable Names
|
|
21
|
-
*/
|
|
22
|
-
const ManagedIdentityEnvironmentVariableNames = {
|
|
23
|
-
AZURE_POD_IDENTITY_AUTHORITY_HOST: "AZURE_POD_IDENTITY_AUTHORITY_HOST",
|
|
24
|
-
IDENTITY_ENDPOINT: "IDENTITY_ENDPOINT",
|
|
25
|
-
IDENTITY_HEADER: "IDENTITY_HEADER",
|
|
26
|
-
IDENTITY_SERVER_THUMBPRINT: "IDENTITY_SERVER_THUMBPRINT",
|
|
27
|
-
IMDS_ENDPOINT: "IMDS_ENDPOINT",
|
|
28
|
-
MSI_ENDPOINT: "MSI_ENDPOINT",
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Managed Identity Source Names
|
|
32
|
-
*/
|
|
33
|
-
const ManagedIdentitySourceNames = {
|
|
34
|
-
APP_SERVICE: "App Service",
|
|
35
|
-
AZURE_ARC: "Azure Arc",
|
|
36
|
-
CLOUD_SHELL: "Cloud Shell",
|
|
37
|
-
IMDS: "IMDS",
|
|
38
|
-
SERVICE_FABRIC: "Service Fabric",
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Managed Identity Ids
|
|
42
|
-
*/
|
|
43
|
-
const ManagedIdentityIdType = {
|
|
44
|
-
SYSTEM_ASSIGNED: "system-assigned",
|
|
45
|
-
USER_ASSIGNED_CLIENT_ID: "user-assigned-client-id",
|
|
46
|
-
USER_ASSIGNED_RESOURCE_ID: "user-assigned-resource-id",
|
|
47
|
-
USER_ASSIGNED_OBJECT_ID: "user-assigned-object-id",
|
|
48
|
-
};
|
|
49
7
|
/**
|
|
50
8
|
* http methods
|
|
51
9
|
*/
|
|
@@ -122,16 +80,6 @@ const LOOPBACK_SERVER_CONSTANTS = {
|
|
|
122
80
|
INTERVAL_MS: 100,
|
|
123
81
|
TIMEOUT_MS: 5000,
|
|
124
82
|
};
|
|
125
|
-
const MANAGED_IDENTITY_MAX_RETRIES = 1;
|
|
126
|
-
const MANAGED_IDENTITY_RETRY_DELAY = 1000;
|
|
127
|
-
const MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON = [
|
|
128
|
-
HttpStatus.NOT_FOUND,
|
|
129
|
-
HttpStatus.REQUEST_TIMEOUT,
|
|
130
|
-
HttpStatus.TOO_MANY_REQUESTS,
|
|
131
|
-
HttpStatus.INTERNAL_SERVER_ERROR,
|
|
132
|
-
HttpStatus.SERVICE_UNAVAILABLE,
|
|
133
|
-
HttpStatus.GATEWAY_TIMEOUT,
|
|
134
|
-
];
|
|
135
83
|
|
|
136
|
-
export {
|
|
84
|
+
export { ApiId, CharSet, Constants, Hash, HttpMethod, JwtConstants, LOOPBACK_SERVER_CONSTANTS, ProxyStatus, RANDOM_OCTET_SIZE, REGION_ENVIRONMENT_VARIABLE };
|
|
137
85
|
//# sourceMappingURL=Constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Constants.mjs","sources":["../../src/utils/Constants.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Constants.mjs","sources":["../../src/utils/Constants.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAEH;;AAEG;AACU,MAAA,UAAU,GAAG;AACtB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,IAAI,EAAE,MAAM;EACL;AAGE,MAAA,WAAW,GAAG;AACvB,IAAA,mBAAmB,EAAE,GAAG;AACxB,IAAA,iBAAiB,EAAE,GAAG;AACtB,IAAA,YAAY,EAAE,GAAG;EACV;AAGX;;AAEG;AACI,MAAM,2BAA2B,GAAG,cAAc;AAEzD;;AAEG;AACI,MAAM,iBAAiB,GAAG,GAAG;AAEpC;;AAEG;AACU,MAAA,IAAI,GAAG;AAChB,IAAA,MAAM,EAAE,QAAQ;EAClB;AAEF;;AAEG;AACU,MAAA,OAAO,GAAG;AACnB,IAAA,UAAU,EACN,oEAAoE;EAC1E;AAUF;;AAEG;AACU,MAAA,SAAS,GAAG;AACrB,IAAA,QAAQ,EAAE,cAAc;AACxB,IAAA,yBAAyB,EACrB,wDAAwD;AAC5D,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,aAAa,EAAE,SAAS;AACxB,IAAA,SAAS,EAAE,WAAW;EACxB;AAEF;;;;;;AAMG;AACU,MAAA,KAAK,GAAG;AACjB,IAAA,kBAAkB,EAAE,EAAE;AACtB,IAAA,8BAA8B,EAAE,GAAG;AACnC,IAAA,wBAAwB,EAAE,GAAG;AAC7B,IAAA,8BAA8B,EAAE,GAAG;AACnC,IAAA,kBAAkB,EAAE,GAAG;AACvB,IAAA,0BAA0B,EAAE,GAAG;EACjC;AAGF;;AAEG;AACU,MAAA,YAAY,GAAG;AACxB,IAAA,SAAS,EAAE,KAAK;AAChB,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,GAAG,EAAE,KAAK;AACV,IAAA,QAAQ,EAAE,KAAK;AACf,IAAA,eAAe,EAAE,KAAK;AACtB,IAAA,MAAM,EAAE,KAAK;AACb,IAAA,OAAO,EAAE,KAAK;AACd,IAAA,UAAU,EAAE,KAAK;AACjB,IAAA,MAAM,EAAE,KAAK;EACf;AAEW,MAAA,yBAAyB,GAAG;AACrC,IAAA,WAAW,EAAE,GAAG;AAChB,IAAA,UAAU,EAAE,IAAI;;;;;"}
|
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": "2.6.
|
|
4
|
+
"version": "2.6.6",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Microsoft",
|
|
7
7
|
"email": "nugetaad@microsoft.com",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"yargs": "^17.3.1"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@azure/msal-common": "14.
|
|
80
|
+
"@azure/msal-common": "14.8.1",
|
|
81
81
|
"jsonwebtoken": "^9.0.0",
|
|
82
82
|
"uuid": "^8.3.0"
|
|
83
83
|
},
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
AuthenticationScheme,
|
|
10
10
|
Authority,
|
|
11
11
|
BaseClient,
|
|
12
|
-
CacheManager,
|
|
13
12
|
CacheOutcome,
|
|
14
13
|
ClientAuthErrorCodes,
|
|
15
14
|
ClientConfiguration,
|
|
@@ -17,31 +16,25 @@ import {
|
|
|
17
16
|
Constants,
|
|
18
17
|
CredentialFilter,
|
|
19
18
|
CredentialType,
|
|
20
|
-
DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
21
19
|
GrantType,
|
|
22
20
|
IAppTokenProvider,
|
|
23
|
-
ICrypto,
|
|
24
21
|
RequestParameterBuilder,
|
|
25
22
|
RequestThumbprint,
|
|
26
23
|
ResponseHandler,
|
|
27
24
|
ScopeSet,
|
|
28
25
|
ServerAuthorizationTokenResponse,
|
|
29
|
-
ServerTelemetryManager,
|
|
30
26
|
StringUtils,
|
|
31
27
|
TimeUtils,
|
|
32
28
|
TokenCacheContext,
|
|
33
29
|
UrlString,
|
|
34
30
|
createClientAuthError,
|
|
35
31
|
} from "@azure/msal-common";
|
|
36
|
-
import {
|
|
37
|
-
ManagedIdentityConfiguration,
|
|
38
|
-
ManagedIdentityNodeConfiguration,
|
|
39
|
-
} from "../config/Configuration";
|
|
40
32
|
|
|
41
33
|
/**
|
|
42
34
|
* OAuth2.0 client credential grant
|
|
43
35
|
*/
|
|
44
36
|
export class ClientCredentialClient extends BaseClient {
|
|
37
|
+
private scopeSet: ScopeSet;
|
|
45
38
|
private readonly appTokenProvider?: IAppTokenProvider;
|
|
46
39
|
|
|
47
40
|
constructor(
|
|
@@ -59,19 +52,14 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
59
52
|
public async acquireToken(
|
|
60
53
|
request: CommonClientCredentialRequest
|
|
61
54
|
): Promise<AuthenticationResult | null> {
|
|
55
|
+
this.scopeSet = new ScopeSet(request.scopes || []);
|
|
56
|
+
|
|
62
57
|
if (request.skipCache) {
|
|
63
58
|
return this.executeTokenRequest(request, this.authority);
|
|
64
59
|
}
|
|
65
60
|
|
|
66
61
|
const [cachedAuthenticationResult, lastCacheOutcome] =
|
|
67
|
-
await this.getCachedAuthenticationResult(
|
|
68
|
-
request,
|
|
69
|
-
this.config,
|
|
70
|
-
this.cryptoUtils,
|
|
71
|
-
this.authority,
|
|
72
|
-
this.cacheManager,
|
|
73
|
-
this.serverTelemetryManager
|
|
74
|
-
);
|
|
62
|
+
await this.getCachedAuthenticationResult(request);
|
|
75
63
|
|
|
76
64
|
if (cachedAuthenticationResult) {
|
|
77
65
|
// if the token is not expired but must be refreshed; get a new one in the background
|
|
@@ -99,56 +87,34 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
99
87
|
/**
|
|
100
88
|
* looks up cache if the tokens are cached already
|
|
101
89
|
*/
|
|
102
|
-
|
|
103
|
-
request: CommonClientCredentialRequest
|
|
104
|
-
config: ClientConfiguration | ManagedIdentityConfiguration,
|
|
105
|
-
cryptoUtils: ICrypto,
|
|
106
|
-
authority: Authority,
|
|
107
|
-
cacheManager: CacheManager,
|
|
108
|
-
serverTelemetryManager?: ServerTelemetryManager | null
|
|
90
|
+
private async getCachedAuthenticationResult(
|
|
91
|
+
request: CommonClientCredentialRequest
|
|
109
92
|
): Promise<[AuthenticationResult | null, CacheOutcome]> {
|
|
110
|
-
const clientConfiguration = config as ClientConfiguration;
|
|
111
|
-
const managedIdentityConfiguration =
|
|
112
|
-
config as ManagedIdentityNodeConfiguration;
|
|
113
|
-
|
|
114
93
|
let lastCacheOutcome: CacheOutcome = CacheOutcome.NOT_APPLICABLE;
|
|
115
94
|
|
|
116
95
|
// read the user-supplied cache into memory, if applicable
|
|
117
96
|
let cacheContext;
|
|
118
|
-
if (
|
|
119
|
-
clientConfiguration.serializableCache &&
|
|
120
|
-
clientConfiguration.persistencePlugin
|
|
121
|
-
) {
|
|
97
|
+
if (this.config.serializableCache && this.config.persistencePlugin) {
|
|
122
98
|
cacheContext = new TokenCacheContext(
|
|
123
|
-
|
|
99
|
+
this.config.serializableCache,
|
|
124
100
|
false
|
|
125
101
|
);
|
|
126
|
-
await
|
|
127
|
-
cacheContext
|
|
128
|
-
);
|
|
102
|
+
await this.config.persistencePlugin.beforeCacheAccess(cacheContext);
|
|
129
103
|
}
|
|
130
104
|
|
|
131
|
-
const cachedAccessToken = this.readAccessTokenFromCache(
|
|
132
|
-
authority,
|
|
133
|
-
managedIdentityConfiguration.managedIdentityId?.id ||
|
|
134
|
-
clientConfiguration.authOptions.clientId,
|
|
135
|
-
new ScopeSet(request.scopes || []),
|
|
136
|
-
cacheManager
|
|
137
|
-
);
|
|
105
|
+
const cachedAccessToken = this.readAccessTokenFromCache();
|
|
138
106
|
|
|
139
107
|
if (
|
|
140
|
-
|
|
141
|
-
|
|
108
|
+
this.config.serializableCache &&
|
|
109
|
+
this.config.persistencePlugin &&
|
|
142
110
|
cacheContext
|
|
143
111
|
) {
|
|
144
|
-
await
|
|
145
|
-
cacheContext
|
|
146
|
-
);
|
|
112
|
+
await this.config.persistencePlugin.afterCacheAccess(cacheContext);
|
|
147
113
|
}
|
|
148
114
|
|
|
149
115
|
// must refresh due to non-existent access_token
|
|
150
116
|
if (!cachedAccessToken) {
|
|
151
|
-
serverTelemetryManager?.setCacheOutcome(
|
|
117
|
+
this.serverTelemetryManager?.setCacheOutcome(
|
|
152
118
|
CacheOutcome.NO_CACHED_ACCESS_TOKEN
|
|
153
119
|
);
|
|
154
120
|
return [null, CacheOutcome.NO_CACHED_ACCESS_TOKEN];
|
|
@@ -158,11 +124,10 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
158
124
|
if (
|
|
159
125
|
TimeUtils.isTokenExpired(
|
|
160
126
|
cachedAccessToken.expiresOn,
|
|
161
|
-
|
|
162
|
-
DEFAULT_TOKEN_RENEWAL_OFFSET_SEC
|
|
127
|
+
this.config.systemOptions.tokenRenewalOffsetSeconds
|
|
163
128
|
)
|
|
164
129
|
) {
|
|
165
|
-
serverTelemetryManager?.setCacheOutcome(
|
|
130
|
+
this.serverTelemetryManager?.setCacheOutcome(
|
|
166
131
|
CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED
|
|
167
132
|
);
|
|
168
133
|
return [null, CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED];
|
|
@@ -174,15 +139,15 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
174
139
|
TimeUtils.isTokenExpired(cachedAccessToken.refreshOn.toString(), 0)
|
|
175
140
|
) {
|
|
176
141
|
lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
|
|
177
|
-
serverTelemetryManager?.setCacheOutcome(
|
|
142
|
+
this.serverTelemetryManager?.setCacheOutcome(
|
|
178
143
|
CacheOutcome.PROACTIVELY_REFRESHED
|
|
179
144
|
);
|
|
180
145
|
}
|
|
181
146
|
|
|
182
147
|
return [
|
|
183
148
|
await ResponseHandler.generateAuthenticationResult(
|
|
184
|
-
cryptoUtils,
|
|
185
|
-
authority,
|
|
149
|
+
this.cryptoUtils,
|
|
150
|
+
this.authority,
|
|
186
151
|
{
|
|
187
152
|
account: null,
|
|
188
153
|
idToken: null,
|
|
@@ -200,24 +165,19 @@ export class ClientCredentialClient extends BaseClient {
|
|
|
200
165
|
/**
|
|
201
166
|
* Reads access token from the cache
|
|
202
167
|
*/
|
|
203
|
-
private readAccessTokenFromCache(
|
|
204
|
-
authority: Authority,
|
|
205
|
-
id: string,
|
|
206
|
-
scopeSet: ScopeSet,
|
|
207
|
-
cacheManager: CacheManager
|
|
208
|
-
): AccessTokenEntity | null {
|
|
168
|
+
private readAccessTokenFromCache(): AccessTokenEntity | null {
|
|
209
169
|
const accessTokenFilter: CredentialFilter = {
|
|
210
170
|
homeAccountId: Constants.EMPTY_STRING,
|
|
211
171
|
environment:
|
|
212
|
-
authority.canonicalAuthorityUrlComponents.HostNameAndPort,
|
|
172
|
+
this.authority.canonicalAuthorityUrlComponents.HostNameAndPort,
|
|
213
173
|
credentialType: CredentialType.ACCESS_TOKEN,
|
|
214
|
-
clientId:
|
|
215
|
-
realm: authority.tenant,
|
|
216
|
-
target: ScopeSet.createSearchScopes(scopeSet.asArray()),
|
|
174
|
+
clientId: this.config.authOptions.clientId,
|
|
175
|
+
realm: this.authority.tenant,
|
|
176
|
+
target: ScopeSet.createSearchScopes(this.scopeSet.asArray()),
|
|
217
177
|
};
|
|
218
178
|
|
|
219
179
|
const accessTokens =
|
|
220
|
-
cacheManager.getAccessTokensByFilter(accessTokenFilter);
|
|
180
|
+
this.cacheManager.getAccessTokensByFilter(accessTokenFilter);
|
|
221
181
|
if (accessTokens.length < 1) {
|
|
222
182
|
return null;
|
|
223
183
|
} else if (accessTokens.length > 1) {
|
|
@@ -18,14 +18,6 @@ import {
|
|
|
18
18
|
import { HttpClient } from "../network/HttpClient.js";
|
|
19
19
|
import http from "http";
|
|
20
20
|
import https from "https";
|
|
21
|
-
import { ManagedIdentityId } from "./ManagedIdentityId.js";
|
|
22
|
-
import {
|
|
23
|
-
MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON,
|
|
24
|
-
MANAGED_IDENTITY_MAX_RETRIES,
|
|
25
|
-
MANAGED_IDENTITY_RETRY_DELAY,
|
|
26
|
-
} from "../utils/Constants.js";
|
|
27
|
-
import { LinearRetryPolicy } from "../retry/LinearRetryPolicy.js";
|
|
28
|
-
import { HttpClientWithRetries } from "../network/HttpClientWithRetries.js";
|
|
29
21
|
|
|
30
22
|
/**
|
|
31
23
|
* - clientId - Client id of the application.
|
|
@@ -91,7 +83,6 @@ export type NodeSystemOptions = {
|
|
|
91
83
|
networkClient?: INetworkModule;
|
|
92
84
|
proxyUrl?: string;
|
|
93
85
|
customAgentOptions?: http.AgentOptions | https.AgentOptions;
|
|
94
|
-
disableInternalRetries?: boolean;
|
|
95
86
|
};
|
|
96
87
|
|
|
97
88
|
export type NodeTelemetryOptions = {
|
|
@@ -116,17 +107,6 @@ export type Configuration = {
|
|
|
116
107
|
telemetry?: NodeTelemetryOptions;
|
|
117
108
|
};
|
|
118
109
|
|
|
119
|
-
export type ManagedIdentityIdParams = {
|
|
120
|
-
userAssignedClientId?: string;
|
|
121
|
-
userAssignedResourceId?: string;
|
|
122
|
-
userAssignedObjectId?: string;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export type ManagedIdentityConfiguration = {
|
|
126
|
-
managedIdentityIdParams?: ManagedIdentityIdParams;
|
|
127
|
-
system?: NodeSystemOptions;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
110
|
const DEFAULT_AUTH_OPTIONS: Required<NodeAuthOptions> = {
|
|
131
111
|
clientId: Constants.EMPTY_STRING,
|
|
132
112
|
authority: Constants.DEFAULT_AUTHORITY,
|
|
@@ -166,7 +146,6 @@ const DEFAULT_SYSTEM_OPTIONS: Required<NodeSystemOptions> = {
|
|
|
166
146
|
networkClient: new HttpClient(),
|
|
167
147
|
proxyUrl: Constants.EMPTY_STRING,
|
|
168
148
|
customAgentOptions: {} as http.AgentOptions | https.AgentOptions,
|
|
169
|
-
disableInternalRetries: false,
|
|
170
149
|
};
|
|
171
150
|
|
|
172
151
|
const DEFAULT_TELEMETRY_OPTIONS: Required<NodeTelemetryOptions> = {
|
|
@@ -207,13 +186,9 @@ export function buildAppConfiguration({
|
|
|
207
186
|
...DEFAULT_SYSTEM_OPTIONS,
|
|
208
187
|
networkClient: new HttpClient(
|
|
209
188
|
system?.proxyUrl,
|
|
210
|
-
system?.customAgentOptions as
|
|
211
|
-
| http.AgentOptions
|
|
212
|
-
| https.AgentOptions,
|
|
213
|
-
false // Managed Identity
|
|
189
|
+
system?.customAgentOptions as http.AgentOptions | https.AgentOptions
|
|
214
190
|
),
|
|
215
191
|
loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
|
|
216
|
-
disableInternalRetries: system?.disableInternalRetries || false,
|
|
217
192
|
};
|
|
218
193
|
|
|
219
194
|
return {
|
|
@@ -224,58 +199,3 @@ export function buildAppConfiguration({
|
|
|
224
199
|
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
|
|
225
200
|
};
|
|
226
201
|
}
|
|
227
|
-
|
|
228
|
-
export type ManagedIdentityNodeConfiguration = {
|
|
229
|
-
managedIdentityId: ManagedIdentityId;
|
|
230
|
-
system: Required<
|
|
231
|
-
Pick<NodeSystemOptions, "loggerOptions" | "networkClient">
|
|
232
|
-
>;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
export function buildManagedIdentityConfiguration({
|
|
236
|
-
managedIdentityIdParams,
|
|
237
|
-
system,
|
|
238
|
-
}: ManagedIdentityConfiguration): ManagedIdentityNodeConfiguration {
|
|
239
|
-
const managedIdentityId: ManagedIdentityId = new ManagedIdentityId(
|
|
240
|
-
managedIdentityIdParams
|
|
241
|
-
);
|
|
242
|
-
|
|
243
|
-
const loggerOptions: LoggerOptions =
|
|
244
|
-
system?.loggerOptions || DEFAULT_LOGGER_OPTIONS;
|
|
245
|
-
|
|
246
|
-
let networkClient: INetworkModule;
|
|
247
|
-
// use developer provided network client if passed in
|
|
248
|
-
if (system?.networkClient) {
|
|
249
|
-
networkClient = system.networkClient;
|
|
250
|
-
// otherwise, create a new one
|
|
251
|
-
} else {
|
|
252
|
-
networkClient = new HttpClient(
|
|
253
|
-
system?.proxyUrl,
|
|
254
|
-
system?.customAgentOptions as
|
|
255
|
-
| http.AgentOptions
|
|
256
|
-
| https.AgentOptions,
|
|
257
|
-
true // Managed Identity
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// wrap the network client with a retry policy if the developer has not disabled the option to do so
|
|
262
|
-
if (!system?.disableInternalRetries) {
|
|
263
|
-
const linearRetryPolicy: LinearRetryPolicy = new LinearRetryPolicy(
|
|
264
|
-
MANAGED_IDENTITY_MAX_RETRIES,
|
|
265
|
-
MANAGED_IDENTITY_RETRY_DELAY,
|
|
266
|
-
MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON
|
|
267
|
-
);
|
|
268
|
-
networkClient = new HttpClientWithRetries(
|
|
269
|
-
networkClient,
|
|
270
|
-
linearRetryPolicy
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
return {
|
|
275
|
-
managedIdentityId: managedIdentityId,
|
|
276
|
-
system: {
|
|
277
|
-
loggerOptions,
|
|
278
|
-
networkClient,
|
|
279
|
-
},
|
|
280
|
-
};
|
|
281
|
-
}
|
package/src/index.ts
CHANGED
|
@@ -31,13 +31,10 @@ export { ClientApplication } from "./client/ClientApplication.js";
|
|
|
31
31
|
export { ClientCredentialClient } from "./client/ClientCredentialClient.js";
|
|
32
32
|
export { DeviceCodeClient } from "./client/DeviceCodeClient.js";
|
|
33
33
|
export { OnBehalfOfClient } from "./client/OnBehalfOfClient.js";
|
|
34
|
-
export { ManagedIdentityApplication } from "./client/ManagedIdentityApplication.js";
|
|
35
34
|
export { UsernamePasswordClient } from "./client/UsernamePasswordClient.js";
|
|
36
35
|
|
|
37
36
|
export {
|
|
38
37
|
Configuration,
|
|
39
|
-
ManagedIdentityConfiguration,
|
|
40
|
-
ManagedIdentityIdParams,
|
|
41
38
|
buildAppConfiguration,
|
|
42
39
|
NodeAuthOptions,
|
|
43
40
|
NodeSystemOptions,
|
|
@@ -76,7 +73,6 @@ export type { RefreshTokenRequest } from "./request/RefreshTokenRequest.js";
|
|
|
76
73
|
export type { SilentFlowRequest } from "./request/SilentFlowRequest.js";
|
|
77
74
|
export type { InteractiveRequest } from "./request/InteractiveRequest.js";
|
|
78
75
|
export type { SignOutRequest } from "./request/SignOutRequest.js";
|
|
79
|
-
export type { ManagedIdentityRequestParams } from "./request/ManagedIdentityRequestParams.js";
|
|
80
76
|
|
|
81
77
|
// Common Object Formats
|
|
82
78
|
export {
|