@azure/msal-node 2.2.0 → 2.3.0-alpha.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.
Files changed (216) hide show
  1. package/dist/cache/ITokenCache.d.ts +15 -15
  2. package/dist/cache/NodeStorage.cjs +401 -401
  3. package/dist/cache/NodeStorage.cjs.map +1 -1
  4. package/dist/cache/NodeStorage.d.ts +182 -182
  5. package/dist/cache/NodeStorage.d.ts.map +1 -1
  6. package/dist/cache/NodeStorage.mjs +401 -401
  7. package/dist/cache/NodeStorage.mjs.map +1 -1
  8. package/dist/cache/TokenCache.cjs +265 -265
  9. package/dist/cache/TokenCache.d.ts +90 -90
  10. package/dist/cache/TokenCache.mjs +265 -265
  11. package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
  12. package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
  13. package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
  14. package/dist/cache/distributed/ICacheClient.d.ts +17 -17
  15. package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
  16. package/dist/cache/serializer/Deserializer.cjs +173 -173
  17. package/dist/cache/serializer/Deserializer.d.ts +42 -42
  18. package/dist/cache/serializer/Deserializer.mjs +173 -173
  19. package/dist/cache/serializer/Serializer.cjs +134 -134
  20. package/dist/cache/serializer/Serializer.d.ts +39 -39
  21. package/dist/cache/serializer/Serializer.mjs +134 -134
  22. package/dist/cache/serializer/SerializerTypes.d.ts +101 -101
  23. package/dist/client/ClientApplication.cjs +333 -333
  24. package/dist/client/ClientApplication.cjs.map +1 -1
  25. package/dist/client/ClientApplication.d.ts +142 -142
  26. package/dist/client/ClientApplication.d.ts.map +1 -1
  27. package/dist/client/ClientApplication.mjs +334 -334
  28. package/dist/client/ClientApplication.mjs.map +1 -1
  29. package/dist/client/ClientAssertion.cjs +116 -116
  30. package/dist/client/ClientAssertion.d.ts +46 -46
  31. package/dist/client/ClientAssertion.mjs +116 -116
  32. package/dist/client/ClientCredentialClient.cjs +193 -189
  33. package/dist/client/ClientCredentialClient.cjs.map +1 -1
  34. package/dist/client/ClientCredentialClient.d.ts +33 -33
  35. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  36. package/dist/client/ClientCredentialClient.mjs +194 -190
  37. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  38. package/dist/client/ConfidentialClientApplication.cjs +163 -163
  39. package/dist/client/ConfidentialClientApplication.d.ts +58 -58
  40. package/dist/client/ConfidentialClientApplication.mjs +163 -163
  41. package/dist/client/DeviceCodeClient.cjs +207 -207
  42. package/dist/client/DeviceCodeClient.d.ts +53 -53
  43. package/dist/client/DeviceCodeClient.mjs +207 -207
  44. package/dist/client/IConfidentialClientApplication.d.ts +39 -39
  45. package/dist/client/IPublicClientApplication.d.ts +42 -42
  46. package/dist/client/ManagedIdentityApplication.cjs +96 -0
  47. package/dist/client/ManagedIdentityApplication.cjs.map +1 -0
  48. package/dist/client/ManagedIdentityApplication.d.ts +24 -0
  49. package/dist/client/ManagedIdentityApplication.d.ts.map +1 -0
  50. package/dist/client/ManagedIdentityApplication.mjs +94 -0
  51. package/dist/client/ManagedIdentityApplication.mjs.map +1 -0
  52. package/dist/client/ManagedIdentityClient.cjs +49 -0
  53. package/dist/client/ManagedIdentityClient.cjs.map +1 -0
  54. package/dist/client/ManagedIdentityClient.d.ts +25 -0
  55. package/dist/client/ManagedIdentityClient.d.ts.map +1 -0
  56. package/dist/client/ManagedIdentityClient.mjs +47 -0
  57. package/dist/client/ManagedIdentityClient.mjs.map +1 -0
  58. package/dist/client/ManagedIdentitySources/AppService.cjs +79 -0
  59. package/dist/client/ManagedIdentitySources/AppService.cjs.map +1 -0
  60. package/dist/client/ManagedIdentitySources/AppService.d.ts +17 -0
  61. package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -0
  62. package/dist/client/ManagedIdentitySources/AppService.mjs +77 -0
  63. package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -0
  64. package/dist/client/ManagedIdentitySources/AzureArc.cjs +107 -0
  65. package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +1 -0
  66. package/dist/client/ManagedIdentitySources/AzureArc.d.ts +19 -0
  67. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -0
  68. package/dist/client/ManagedIdentitySources/AzureArc.mjs +104 -0
  69. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -0
  70. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +87 -0
  71. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +1 -0
  72. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +19 -0
  73. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -0
  74. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +85 -0
  75. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -0
  76. package/dist/client/ManagedIdentitySources/CloudShell.d.ts +7 -0
  77. package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -0
  78. package/dist/client/ManagedIdentitySources/Imds.cjs +63 -0
  79. package/dist/client/ManagedIdentitySources/Imds.cjs.map +1 -0
  80. package/dist/client/ManagedIdentitySources/Imds.d.ts +13 -0
  81. package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -0
  82. package/dist/client/ManagedIdentitySources/Imds.mjs +61 -0
  83. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -0
  84. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +7 -0
  85. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -0
  86. package/dist/client/OnBehalfOfClient.cjs +202 -202
  87. package/dist/client/OnBehalfOfClient.d.ts +47 -47
  88. package/dist/client/OnBehalfOfClient.mjs +202 -202
  89. package/dist/client/PublicClientApplication.cjs +229 -229
  90. package/dist/client/PublicClientApplication.d.ts +71 -71
  91. package/dist/client/PublicClientApplication.mjs +229 -229
  92. package/dist/client/UsernamePasswordClient.cjs +95 -95
  93. package/dist/client/UsernamePasswordClient.d.ts +25 -25
  94. package/dist/client/UsernamePasswordClient.mjs +95 -95
  95. package/dist/config/Configuration.cjs +88 -72
  96. package/dist/config/Configuration.cjs.map +1 -1
  97. package/dist/config/Configuration.d.ts +122 -107
  98. package/dist/config/Configuration.d.ts.map +1 -1
  99. package/dist/config/Configuration.mjs +88 -73
  100. package/dist/config/Configuration.mjs.map +1 -1
  101. package/dist/config/ManagedIdentityId.cjs +59 -0
  102. package/dist/config/ManagedIdentityId.cjs.map +1 -0
  103. package/dist/config/ManagedIdentityId.d.ts +12 -0
  104. package/dist/config/ManagedIdentityId.d.ts.map +1 -0
  105. package/dist/config/ManagedIdentityId.mjs +57 -0
  106. package/dist/config/ManagedIdentityId.mjs.map +1 -0
  107. package/dist/config/ManagedIdentityRequestParameters.cjs +38 -0
  108. package/dist/config/ManagedIdentityRequestParameters.cjs.map +1 -0
  109. package/dist/config/ManagedIdentityRequestParameters.d.ts +12 -0
  110. package/dist/config/ManagedIdentityRequestParameters.d.ts.map +1 -0
  111. package/dist/config/ManagedIdentityRequestParameters.mjs +36 -0
  112. package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -0
  113. package/dist/crypto/CryptoProvider.cjs +75 -75
  114. package/dist/crypto/CryptoProvider.d.ts +52 -52
  115. package/dist/crypto/CryptoProvider.mjs +75 -75
  116. package/dist/crypto/GuidGenerator.cjs +22 -22
  117. package/dist/crypto/GuidGenerator.d.ts +14 -14
  118. package/dist/crypto/GuidGenerator.mjs +22 -22
  119. package/dist/crypto/HashUtils.cjs +13 -13
  120. package/dist/crypto/HashUtils.d.ts +8 -8
  121. package/dist/crypto/HashUtils.mjs +13 -13
  122. package/dist/crypto/PkceGenerator.cjs +49 -49
  123. package/dist/crypto/PkceGenerator.d.ts +22 -22
  124. package/dist/crypto/PkceGenerator.mjs +49 -49
  125. package/dist/error/ManagedIdentityError.cjs +40 -0
  126. package/dist/error/ManagedIdentityError.cjs.map +1 -0
  127. package/dist/error/ManagedIdentityError.d.ts +22 -0
  128. package/dist/error/ManagedIdentityError.d.ts.map +1 -0
  129. package/dist/error/ManagedIdentityError.mjs +36 -0
  130. package/dist/error/ManagedIdentityError.mjs.map +1 -0
  131. package/dist/error/ManagedIdentityErrorCodes.cjs +28 -0
  132. package/dist/error/ManagedIdentityErrorCodes.cjs.map +1 -0
  133. package/dist/error/ManagedIdentityErrorCodes.d.ts +10 -0
  134. package/dist/error/ManagedIdentityErrorCodes.d.ts.map +1 -0
  135. package/dist/error/ManagedIdentityErrorCodes.mjs +18 -0
  136. package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -0
  137. package/dist/error/NodeAuthError.cjs +85 -85
  138. package/dist/error/NodeAuthError.d.ts +65 -65
  139. package/dist/error/NodeAuthError.mjs +85 -85
  140. package/dist/index.cjs +3 -1
  141. package/dist/index.cjs.map +1 -1
  142. package/dist/index.d.ts +44 -42
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/index.mjs +2 -1
  145. package/dist/index.mjs.map +1 -1
  146. package/dist/internals.cjs +8 -8
  147. package/dist/internals.d.ts +6 -6
  148. package/dist/internals.mjs +8 -8
  149. package/dist/network/HttpClient.cjs +283 -276
  150. package/dist/network/HttpClient.cjs.map +1 -1
  151. package/dist/network/HttpClient.d.ts +26 -25
  152. package/dist/network/HttpClient.d.ts.map +1 -1
  153. package/dist/network/HttpClient.mjs +283 -276
  154. package/dist/network/HttpClient.mjs.map +1 -1
  155. package/dist/network/ILoopbackClient.d.ts +10 -10
  156. package/dist/network/LoopbackClient.cjs +76 -76
  157. package/dist/network/LoopbackClient.d.ts +21 -21
  158. package/dist/network/LoopbackClient.mjs +76 -76
  159. package/dist/packageMetadata.cjs +4 -4
  160. package/dist/packageMetadata.cjs.map +1 -1
  161. package/dist/packageMetadata.d.ts +2 -2
  162. package/dist/packageMetadata.d.ts.map +1 -1
  163. package/dist/packageMetadata.mjs +4 -4
  164. package/dist/packageMetadata.mjs.map +1 -1
  165. package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
  166. package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
  167. package/dist/request/ClientCredentialRequest.d.ts +14 -14
  168. package/dist/request/DeviceCodeRequest.d.ts +15 -15
  169. package/dist/request/InteractiveRequest.d.ts +22 -22
  170. package/dist/request/ManagedIdentityRequest.d.ts +9 -0
  171. package/dist/request/ManagedIdentityRequest.d.ts.map +1 -0
  172. package/dist/request/ManagedIdentityRequestParams.d.ts +10 -0
  173. package/dist/request/ManagedIdentityRequestParams.d.ts.map +1 -0
  174. package/dist/request/OnBehalfOfRequest.d.ts +14 -14
  175. package/dist/request/RefreshTokenRequest.d.ts +17 -17
  176. package/dist/request/SignOutRequest.d.ts +5 -5
  177. package/dist/request/SilentFlowRequest.d.ts +16 -16
  178. package/dist/request/UsernamePasswordRequest.d.ts +19 -19
  179. package/dist/response/ManagedIdentityTokenResponse.d.ts +25 -0
  180. package/dist/response/ManagedIdentityTokenResponse.d.ts.map +1 -0
  181. package/dist/utils/Constants.cjs +109 -80
  182. package/dist/utils/Constants.cjs.map +1 -1
  183. package/dist/utils/Constants.d.ts +106 -86
  184. package/dist/utils/Constants.d.ts.map +1 -1
  185. package/dist/utils/Constants.mjs +100 -81
  186. package/dist/utils/Constants.mjs.map +1 -1
  187. package/dist/utils/EncodingUtils.cjs +44 -44
  188. package/dist/utils/EncodingUtils.d.ts +26 -26
  189. package/dist/utils/EncodingUtils.mjs +44 -44
  190. package/dist/utils/NetworkUtils.cjs +38 -38
  191. package/dist/utils/NetworkUtils.d.ts +5 -5
  192. package/dist/utils/NetworkUtils.mjs +38 -38
  193. package/package.json +2 -2
  194. package/src/cache/NodeStorage.ts +8 -2
  195. package/src/client/ClientApplication.ts +3 -1
  196. package/src/client/ClientCredentialClient.ts +65 -25
  197. package/src/client/ManagedIdentityApplication.ts +194 -0
  198. package/src/client/ManagedIdentityClient.ts +111 -0
  199. package/src/client/ManagedIdentitySources/AppService.ts +151 -0
  200. package/src/client/ManagedIdentitySources/AzureArc.ts +208 -0
  201. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +169 -0
  202. package/src/client/ManagedIdentitySources/CloudShell.ts +19 -0
  203. package/src/client/ManagedIdentitySources/Imds.ts +112 -0
  204. package/src/client/ManagedIdentitySources/ServiceFabric.ts +19 -0
  205. package/src/config/Configuration.ts +47 -1
  206. package/src/config/ManagedIdentityId.ts +73 -0
  207. package/src/config/ManagedIdentityRequestParameters.ts +53 -0
  208. package/src/error/ManagedIdentityError.ts +46 -0
  209. package/src/error/ManagedIdentityErrorCodes.ts +15 -0
  210. package/src/index.ts +2 -0
  211. package/src/network/HttpClient.ts +17 -5
  212. package/src/packageMetadata.ts +1 -1
  213. package/src/request/ManagedIdentityRequest.ts +15 -0
  214. package/src/request/ManagedIdentityRequestParams.ts +14 -0
  215. package/src/response/ManagedIdentityTokenResponse.ts +33 -0
  216. package/src/utils/Constants.ts +27 -0
@@ -1,20 +1,20 @@
1
- /*! @azure/msal-node v2.2.0 2023-10-05 */
1
+ /*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
2
2
  'use strict';
3
3
  import { Hash } from '../utils/Constants.mjs';
4
4
  import crypto from 'crypto';
5
5
 
6
- /*
7
- * Copyright (c) Microsoft Corporation. All rights reserved.
8
- * Licensed under the MIT License.
9
- */
10
- class HashUtils {
11
- /**
12
- * generate 'SHA256' hash
13
- * @param buffer
14
- */
15
- sha256(buffer) {
16
- return crypto.createHash(Hash.SHA256).update(buffer).digest();
17
- }
6
+ /*
7
+ * Copyright (c) Microsoft Corporation. All rights reserved.
8
+ * Licensed under the MIT License.
9
+ */
10
+ class HashUtils {
11
+ /**
12
+ * generate 'SHA256' hash
13
+ * @param buffer
14
+ */
15
+ sha256(buffer) {
16
+ return crypto.createHash(Hash.SHA256).update(buffer).digest();
17
+ }
18
18
  }
19
19
 
20
20
  export { HashUtils };
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v2.2.0 2023-10-05 */
1
+ /*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -8,54 +8,54 @@ var EncodingUtils = require('../utils/EncodingUtils.cjs');
8
8
  var HashUtils = require('./HashUtils.cjs');
9
9
  var crypto = require('crypto');
10
10
 
11
- /*
12
- * Copyright (c) Microsoft Corporation. All rights reserved.
13
- * Licensed under the MIT License.
14
- */
15
- /**
16
- * https://tools.ietf.org/html/rfc7636#page-8
17
- */
18
- class PkceGenerator {
19
- constructor() {
20
- this.hashUtils = new HashUtils.HashUtils();
21
- }
22
- /**
23
- * generates the codeVerfier and the challenge from the codeVerfier
24
- * reference: https://tools.ietf.org/html/rfc7636#section-4.1 and https://tools.ietf.org/html/rfc7636#section-4.2
25
- */
26
- async generatePkceCodes() {
27
- const verifier = this.generateCodeVerifier();
28
- const challenge = this.generateCodeChallengeFromVerifier(verifier);
29
- return { verifier, challenge };
30
- }
31
- /**
32
- * generates the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.1
33
- */
34
- generateCodeVerifier() {
35
- const charArr = [];
36
- const maxNumber = 256 - (256 % Constants.CharSet.CV_CHARSET.length);
37
- while (charArr.length <= Constants.RANDOM_OCTET_SIZE) {
38
- const byte = crypto.randomBytes(1)[0];
39
- if (byte >= maxNumber) {
40
- /*
41
- * Ignore this number to maintain randomness.
42
- * Including it would result in an unequal distribution of characters after doing the modulo
43
- */
44
- continue;
45
- }
46
- const index = byte % Constants.CharSet.CV_CHARSET.length;
47
- charArr.push(Constants.CharSet.CV_CHARSET[index]);
48
- }
49
- const verifier = charArr.join(msalCommon.Constants.EMPTY_STRING);
50
- return EncodingUtils.EncodingUtils.base64EncodeUrl(verifier);
51
- }
52
- /**
53
- * generate the challenge from the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.2
54
- * @param codeVerifier
55
- */
56
- generateCodeChallengeFromVerifier(codeVerifier) {
57
- return EncodingUtils.EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(codeVerifier).toString("base64"), "base64");
58
- }
11
+ /*
12
+ * Copyright (c) Microsoft Corporation. All rights reserved.
13
+ * Licensed under the MIT License.
14
+ */
15
+ /**
16
+ * https://tools.ietf.org/html/rfc7636#page-8
17
+ */
18
+ class PkceGenerator {
19
+ constructor() {
20
+ this.hashUtils = new HashUtils.HashUtils();
21
+ }
22
+ /**
23
+ * generates the codeVerfier and the challenge from the codeVerfier
24
+ * reference: https://tools.ietf.org/html/rfc7636#section-4.1 and https://tools.ietf.org/html/rfc7636#section-4.2
25
+ */
26
+ async generatePkceCodes() {
27
+ const verifier = this.generateCodeVerifier();
28
+ const challenge = this.generateCodeChallengeFromVerifier(verifier);
29
+ return { verifier, challenge };
30
+ }
31
+ /**
32
+ * generates the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.1
33
+ */
34
+ generateCodeVerifier() {
35
+ const charArr = [];
36
+ const maxNumber = 256 - (256 % Constants.CharSet.CV_CHARSET.length);
37
+ while (charArr.length <= Constants.RANDOM_OCTET_SIZE) {
38
+ const byte = crypto.randomBytes(1)[0];
39
+ if (byte >= maxNumber) {
40
+ /*
41
+ * Ignore this number to maintain randomness.
42
+ * Including it would result in an unequal distribution of characters after doing the modulo
43
+ */
44
+ continue;
45
+ }
46
+ const index = byte % Constants.CharSet.CV_CHARSET.length;
47
+ charArr.push(Constants.CharSet.CV_CHARSET[index]);
48
+ }
49
+ const verifier = charArr.join(msalCommon.Constants.EMPTY_STRING);
50
+ return EncodingUtils.EncodingUtils.base64EncodeUrl(verifier);
51
+ }
52
+ /**
53
+ * generate the challenge from the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.2
54
+ * @param codeVerifier
55
+ */
56
+ generateCodeChallengeFromVerifier(codeVerifier) {
57
+ return EncodingUtils.EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(codeVerifier).toString("base64"), "base64");
58
+ }
59
59
  }
60
60
 
61
61
  exports.PkceGenerator = PkceGenerator;
@@ -1,23 +1,23 @@
1
- import { PkceCodes } from "@azure/msal-common";
2
- /**
3
- * https://tools.ietf.org/html/rfc7636#page-8
4
- */
5
- export declare class PkceGenerator {
6
- private hashUtils;
7
- constructor();
8
- /**
9
- * generates the codeVerfier and the challenge from the codeVerfier
10
- * reference: https://tools.ietf.org/html/rfc7636#section-4.1 and https://tools.ietf.org/html/rfc7636#section-4.2
11
- */
12
- generatePkceCodes(): Promise<PkceCodes>;
13
- /**
14
- * generates the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.1
15
- */
16
- private generateCodeVerifier;
17
- /**
18
- * generate the challenge from the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.2
19
- * @param codeVerifier
20
- */
21
- private generateCodeChallengeFromVerifier;
22
- }
1
+ import { PkceCodes } from "@azure/msal-common";
2
+ /**
3
+ * https://tools.ietf.org/html/rfc7636#page-8
4
+ */
5
+ export declare class PkceGenerator {
6
+ private hashUtils;
7
+ constructor();
8
+ /**
9
+ * generates the codeVerfier and the challenge from the codeVerfier
10
+ * reference: https://tools.ietf.org/html/rfc7636#section-4.1 and https://tools.ietf.org/html/rfc7636#section-4.2
11
+ */
12
+ generatePkceCodes(): Promise<PkceCodes>;
13
+ /**
14
+ * generates the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.1
15
+ */
16
+ private generateCodeVerifier;
17
+ /**
18
+ * generate the challenge from the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.2
19
+ * @param codeVerifier
20
+ */
21
+ private generateCodeChallengeFromVerifier;
22
+ }
23
23
  //# sourceMappingURL=PkceGenerator.d.ts.map
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v2.2.0 2023-10-05 */
1
+ /*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
2
2
  'use strict';
3
3
  import { Constants } from '@azure/msal-common';
4
4
  import { RANDOM_OCTET_SIZE, CharSet } from '../utils/Constants.mjs';
@@ -6,54 +6,54 @@ import { EncodingUtils } from '../utils/EncodingUtils.mjs';
6
6
  import { HashUtils } from './HashUtils.mjs';
7
7
  import crypto from 'crypto';
8
8
 
9
- /*
10
- * Copyright (c) Microsoft Corporation. All rights reserved.
11
- * Licensed under the MIT License.
12
- */
13
- /**
14
- * https://tools.ietf.org/html/rfc7636#page-8
15
- */
16
- class PkceGenerator {
17
- constructor() {
18
- this.hashUtils = new HashUtils();
19
- }
20
- /**
21
- * generates the codeVerfier and the challenge from the codeVerfier
22
- * reference: https://tools.ietf.org/html/rfc7636#section-4.1 and https://tools.ietf.org/html/rfc7636#section-4.2
23
- */
24
- async generatePkceCodes() {
25
- const verifier = this.generateCodeVerifier();
26
- const challenge = this.generateCodeChallengeFromVerifier(verifier);
27
- return { verifier, challenge };
28
- }
29
- /**
30
- * generates the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.1
31
- */
32
- generateCodeVerifier() {
33
- const charArr = [];
34
- const maxNumber = 256 - (256 % CharSet.CV_CHARSET.length);
35
- while (charArr.length <= RANDOM_OCTET_SIZE) {
36
- const byte = crypto.randomBytes(1)[0];
37
- if (byte >= maxNumber) {
38
- /*
39
- * Ignore this number to maintain randomness.
40
- * Including it would result in an unequal distribution of characters after doing the modulo
41
- */
42
- continue;
43
- }
44
- const index = byte % CharSet.CV_CHARSET.length;
45
- charArr.push(CharSet.CV_CHARSET[index]);
46
- }
47
- const verifier = charArr.join(Constants.EMPTY_STRING);
48
- return EncodingUtils.base64EncodeUrl(verifier);
49
- }
50
- /**
51
- * generate the challenge from the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.2
52
- * @param codeVerifier
53
- */
54
- generateCodeChallengeFromVerifier(codeVerifier) {
55
- return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(codeVerifier).toString("base64"), "base64");
56
- }
9
+ /*
10
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11
+ * Licensed under the MIT License.
12
+ */
13
+ /**
14
+ * https://tools.ietf.org/html/rfc7636#page-8
15
+ */
16
+ class PkceGenerator {
17
+ constructor() {
18
+ this.hashUtils = new HashUtils();
19
+ }
20
+ /**
21
+ * generates the codeVerfier and the challenge from the codeVerfier
22
+ * reference: https://tools.ietf.org/html/rfc7636#section-4.1 and https://tools.ietf.org/html/rfc7636#section-4.2
23
+ */
24
+ async generatePkceCodes() {
25
+ const verifier = this.generateCodeVerifier();
26
+ const challenge = this.generateCodeChallengeFromVerifier(verifier);
27
+ return { verifier, challenge };
28
+ }
29
+ /**
30
+ * generates the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.1
31
+ */
32
+ generateCodeVerifier() {
33
+ const charArr = [];
34
+ const maxNumber = 256 - (256 % CharSet.CV_CHARSET.length);
35
+ while (charArr.length <= RANDOM_OCTET_SIZE) {
36
+ const byte = crypto.randomBytes(1)[0];
37
+ if (byte >= maxNumber) {
38
+ /*
39
+ * Ignore this number to maintain randomness.
40
+ * Including it would result in an unequal distribution of characters after doing the modulo
41
+ */
42
+ continue;
43
+ }
44
+ const index = byte % CharSet.CV_CHARSET.length;
45
+ charArr.push(CharSet.CV_CHARSET[index]);
46
+ }
47
+ const verifier = charArr.join(Constants.EMPTY_STRING);
48
+ return EncodingUtils.base64EncodeUrl(verifier);
49
+ }
50
+ /**
51
+ * generate the challenge from the codeVerfier; reference: https://tools.ietf.org/html/rfc7636#section-4.2
52
+ * @param codeVerifier
53
+ */
54
+ generateCodeChallengeFromVerifier(codeVerifier) {
55
+ return EncodingUtils.base64EncodeUrl(this.hashUtils.sha256(codeVerifier).toString("base64"), "base64");
56
+ }
57
57
  }
58
58
 
59
59
  export { PkceGenerator };
@@ -0,0 +1,40 @@
1
+ /*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
2
+ 'use strict';
3
+ 'use strict';
4
+
5
+ var msalCommon = require('@azure/msal-common');
6
+ var ManagedIdentityErrorCodes = require('./ManagedIdentityErrorCodes.cjs');
7
+
8
+ /*
9
+ * Copyright (c) Microsoft Corporation. All rights reserved.
10
+ * Licensed under the MIT License.
11
+ */
12
+ /**
13
+ * ManagedIdentityErrorMessage class containing string constants used by error codes and messages.
14
+ */
15
+ const ManagedIdentityErrorMessages = {
16
+ [ManagedIdentityErrorCodes.invalidManagedIdentityIdType]: "More than one ManagedIdentityIdType was provided.",
17
+ [ManagedIdentityErrorCodes.invalidResource]: "The supplied resource is an invalid URL.",
18
+ [ManagedIdentityErrorCodes.missingId]: "A ManagedIdentityId id was not provided.",
19
+ [ManagedIdentityErrorCodes.unableToCreateAzureArc]: "Azure Arc Managed Identities can only be system assigned.",
20
+ [ManagedIdentityErrorCodes.unableToCreateSource]: "Unable to create a Managed Identity source based on environment variables.",
21
+ [ManagedIdentityErrorCodes.unableToReadSecretFile]: "Unable to read the secret file.",
22
+ [ManagedIdentityErrorCodes.urlParseError]: "The Managed Identity's 'IDENTITY_ENDPOINT' environment variable is malformed.",
23
+ [ManagedIdentityErrorCodes.wwwAuthenticateHeaderMissing]: "A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is missing.",
24
+ [ManagedIdentityErrorCodes.wwwAuthenticateHeaderUnsupportedFormat]: "A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is in an unsupported format.",
25
+ };
26
+ class ManagedIdentityError extends msalCommon.AuthError {
27
+ constructor(errorCode) {
28
+ super(errorCode, ManagedIdentityErrorMessages[errorCode]);
29
+ this.name = "ManagedIdentityError";
30
+ Object.setPrototypeOf(this, ManagedIdentityError.prototype);
31
+ }
32
+ }
33
+ function createManagedIdentityError(errorCode) {
34
+ return new ManagedIdentityError(errorCode);
35
+ }
36
+
37
+ exports.ManagedIdentityError = ManagedIdentityError;
38
+ exports.ManagedIdentityErrorMessages = ManagedIdentityErrorMessages;
39
+ exports.createManagedIdentityError = createManagedIdentityError;
40
+ //# sourceMappingURL=ManagedIdentityError.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManagedIdentityError.cjs","sources":["../../src/error/ManagedIdentityError.ts"],"sourcesContent":[null],"names":["ManagedIdentityErrorCodes.unableToReadSecretFile","ManagedIdentityErrorCodes.urlParseError","ManagedIdentityErrorCodes.wwwAuthenticateHeaderMissing","ManagedIdentityErrorCodes.wwwAuthenticateHeaderUnsupportedFormat"],"mappings":";;;;;;;AAKA;AACA;AACA;AAEA;;;;;;;;;;IAsBE,CAAAA,gDAAA,GAAA,iCAAA;AAEF,IAAa,CAAAC,yHAAsC;AACnC,IAAA,CAAAC,sDAAiB,GAAA,8GAAA;AAKhC,IAAA,CAAAC,gEAAA,GAAA,+HAAA;AAED,EAAA;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,22 @@
1
+ import { AuthError } from "@azure/msal-common";
2
+ import * as ManagedIdentityErrorCodes from "./ManagedIdentityErrorCodes";
3
+ export { ManagedIdentityErrorCodes };
4
+ /**
5
+ * ManagedIdentityErrorMessage class containing string constants used by error codes and messages.
6
+ */
7
+ export declare const ManagedIdentityErrorMessages: {
8
+ invalid_managed_identity_id_type: string;
9
+ invalid_resource: string;
10
+ missing_client_id: string;
11
+ unable_to_create_azure_arc: string;
12
+ unable_to_create_source: string;
13
+ unable_to_read_secret_file: string;
14
+ url_parse_error: string;
15
+ www_authenticate_header_missing: string;
16
+ www_authenticate_header_unsupported_format: string;
17
+ };
18
+ export declare class ManagedIdentityError extends AuthError {
19
+ constructor(errorCode: string);
20
+ }
21
+ export declare function createManagedIdentityError(errorCode: string): ManagedIdentityError;
22
+ //# sourceMappingURL=ManagedIdentityError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManagedIdentityError.d.ts","sourceRoot":"","sources":["../../src/error/ManagedIdentityError.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,KAAK,yBAAyB,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;CAmBxC,CAAC;AAEF,qBAAa,oBAAqB,SAAQ,SAAS;gBACnC,SAAS,EAAE,MAAM;CAKhC;AAED,wBAAgB,0BAA0B,CACtC,SAAS,EAAE,MAAM,GAClB,oBAAoB,CAEtB"}
@@ -0,0 +1,36 @@
1
+ /*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
2
+ 'use strict';
3
+ import { AuthError } from '@azure/msal-common';
4
+ import { invalidManagedIdentityIdType, invalidResource, missingId, unableToCreateAzureArc, unableToCreateSource, unableToReadSecretFile, urlParseError, wwwAuthenticateHeaderMissing, wwwAuthenticateHeaderUnsupportedFormat } from './ManagedIdentityErrorCodes.mjs';
5
+
6
+ /*
7
+ * Copyright (c) Microsoft Corporation. All rights reserved.
8
+ * Licensed under the MIT License.
9
+ */
10
+ /**
11
+ * ManagedIdentityErrorMessage class containing string constants used by error codes and messages.
12
+ */
13
+ const ManagedIdentityErrorMessages = {
14
+ [invalidManagedIdentityIdType]: "More than one ManagedIdentityIdType was provided.",
15
+ [invalidResource]: "The supplied resource is an invalid URL.",
16
+ [missingId]: "A ManagedIdentityId id was not provided.",
17
+ [unableToCreateAzureArc]: "Azure Arc Managed Identities can only be system assigned.",
18
+ [unableToCreateSource]: "Unable to create a Managed Identity source based on environment variables.",
19
+ [unableToReadSecretFile]: "Unable to read the secret file.",
20
+ [urlParseError]: "The Managed Identity's 'IDENTITY_ENDPOINT' environment variable is malformed.",
21
+ [wwwAuthenticateHeaderMissing]: "A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is missing.",
22
+ [wwwAuthenticateHeaderUnsupportedFormat]: "A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is in an unsupported format.",
23
+ };
24
+ class ManagedIdentityError extends AuthError {
25
+ constructor(errorCode) {
26
+ super(errorCode, ManagedIdentityErrorMessages[errorCode]);
27
+ this.name = "ManagedIdentityError";
28
+ Object.setPrototypeOf(this, ManagedIdentityError.prototype);
29
+ }
30
+ }
31
+ function createManagedIdentityError(errorCode) {
32
+ return new ManagedIdentityError(errorCode);
33
+ }
34
+
35
+ export { ManagedIdentityError, ManagedIdentityErrorMessages, createManagedIdentityError };
36
+ //# sourceMappingURL=ManagedIdentityError.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManagedIdentityError.mjs","sources":["../../src/error/ManagedIdentityError.ts"],"sourcesContent":[null],"names":["ManagedIdentityErrorCodes.unableToReadSecretFile","ManagedIdentityErrorCodes.urlParseError","ManagedIdentityErrorCodes.wwwAuthenticateHeaderMissing","ManagedIdentityErrorCodes.wwwAuthenticateHeaderUnsupportedFormat"],"mappings":";;;;;AAKA;AACA;AACA;AAEA;;;;;;;;;;IAsBE,CAAAA,sBAAA,GAAA,iCAAA;AAEF,IAAa,CAAAC,+FAAsC;AACnC,IAAA,CAAAC,4BAAiB,GAAA,8GAAA;AAKhC,IAAA,CAAAC,sCAAA,GAAA,+HAAA;AAED,EAAA;;;;;;;;;;;;;;"}
@@ -0,0 +1,28 @@
1
+ /*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
2
+ 'use strict';
3
+ 'use strict';
4
+
5
+ /*
6
+ * Copyright (c) Microsoft Corporation. All rights reserved.
7
+ * Licensed under the MIT License.
8
+ */
9
+ const invalidManagedIdentityIdType = "invalid_managed_identity_id_type";
10
+ const invalidResource = "invalid_resource";
11
+ const missingId = "missing_client_id";
12
+ const unableToCreateAzureArc = "unable_to_create_azure_arc";
13
+ const unableToCreateSource = "unable_to_create_source";
14
+ const unableToReadSecretFile = "unable_to_read_secret_file";
15
+ const urlParseError = "url_parse_error";
16
+ const wwwAuthenticateHeaderMissing = "www_authenticate_header_missing";
17
+ const wwwAuthenticateHeaderUnsupportedFormat = "www_authenticate_header_unsupported_format";
18
+
19
+ exports.invalidManagedIdentityIdType = invalidManagedIdentityIdType;
20
+ exports.invalidResource = invalidResource;
21
+ exports.missingId = missingId;
22
+ exports.unableToCreateAzureArc = unableToCreateAzureArc;
23
+ exports.unableToCreateSource = unableToCreateSource;
24
+ exports.unableToReadSecretFile = unableToReadSecretFile;
25
+ exports.urlParseError = urlParseError;
26
+ exports.wwwAuthenticateHeaderMissing = wwwAuthenticateHeaderMissing;
27
+ exports.wwwAuthenticateHeaderUnsupportedFormat = wwwAuthenticateHeaderUnsupportedFormat;
28
+ //# sourceMappingURL=ManagedIdentityErrorCodes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManagedIdentityErrorCodes.cjs","sources":["../../src/error/ManagedIdentityErrorCodes.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA;AACA;AACA;AACA;AACO,MAAA,4BAA0B,GAAA,mCAA6B;AACvD,MAAA,eAA4B,GAAA,mBAAA;AAC5B,MAAA,SAAmB,GAAA,oBAAA;AACnB,MAAA,sBAAkC,GAAA,6BAAA;AAClC,MAAA,oBAA4C,GAAA,0BAAA;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,10 @@
1
+ export declare const invalidManagedIdentityIdType = "invalid_managed_identity_id_type";
2
+ export declare const invalidResource = "invalid_resource";
3
+ export declare const missingId = "missing_client_id";
4
+ export declare const unableToCreateAzureArc = "unable_to_create_azure_arc";
5
+ export declare const unableToCreateSource = "unable_to_create_source";
6
+ export declare const unableToReadSecretFile = "unable_to_read_secret_file";
7
+ export declare const urlParseError = "url_parse_error";
8
+ export declare const wwwAuthenticateHeaderMissing = "www_authenticate_header_missing";
9
+ export declare const wwwAuthenticateHeaderUnsupportedFormat = "www_authenticate_header_unsupported_format";
10
+ //# sourceMappingURL=ManagedIdentityErrorCodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManagedIdentityErrorCodes.d.ts","sourceRoot":"","sources":["../../src/error/ManagedIdentityErrorCodes.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,4BAA4B,qCAAqC,CAAC;AAC/E,eAAO,MAAM,eAAe,qBAAqB,CAAC;AAClD,eAAO,MAAM,SAAS,sBAAsB,CAAC;AAC7C,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AACnE,eAAO,MAAM,oBAAoB,4BAA4B,CAAC;AAC9D,eAAO,MAAM,sBAAsB,+BAA+B,CAAC;AACnE,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAC/C,eAAO,MAAM,4BAA4B,oCAAoC,CAAC;AAC9E,eAAO,MAAM,sCAAsC,+CACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ /*! @azure/msal-node v2.3.0-alpha.0 2023-12-07 */
2
+ 'use strict';
3
+ /*
4
+ * Copyright (c) Microsoft Corporation. All rights reserved.
5
+ * Licensed under the MIT License.
6
+ */
7
+ const invalidManagedIdentityIdType = "invalid_managed_identity_id_type";
8
+ const invalidResource = "invalid_resource";
9
+ const missingId = "missing_client_id";
10
+ const unableToCreateAzureArc = "unable_to_create_azure_arc";
11
+ const unableToCreateSource = "unable_to_create_source";
12
+ const unableToReadSecretFile = "unable_to_read_secret_file";
13
+ const urlParseError = "url_parse_error";
14
+ const wwwAuthenticateHeaderMissing = "www_authenticate_header_missing";
15
+ const wwwAuthenticateHeaderUnsupportedFormat = "www_authenticate_header_unsupported_format";
16
+
17
+ export { invalidManagedIdentityIdType, invalidResource, missingId, unableToCreateAzureArc, unableToCreateSource, unableToReadSecretFile, urlParseError, wwwAuthenticateHeaderMissing, wwwAuthenticateHeaderUnsupportedFormat };
18
+ //# sourceMappingURL=ManagedIdentityErrorCodes.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManagedIdentityErrorCodes.mjs","sources":["../../src/error/ManagedIdentityErrorCodes.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAKA;AACA;AACA;AACA;AACO,MAAA,4BAA0B,GAAA,mCAA6B;AACvD,MAAA,eAA4B,GAAA,mBAAA;AAC5B,MAAA,SAAmB,GAAA,oBAAA;AACnB,MAAA,sBAAkC,GAAA,6BAAA;AAClC,MAAA,oBAA4C,GAAA,0BAAA;;;;;;;;"}