@azure/msal-node 2.7.0-alpha.0 → 2.7.1-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 (245) hide show
  1. package/README.md +1 -1
  2. package/dist/cache/ITokenCache.d.ts +15 -15
  3. package/dist/cache/NodeStorage.cjs +423 -423
  4. package/dist/cache/NodeStorage.cjs.map +1 -1
  5. package/dist/cache/NodeStorage.d.ts +193 -193
  6. package/dist/cache/NodeStorage.d.ts.map +1 -1
  7. package/dist/cache/NodeStorage.mjs +424 -424
  8. package/dist/cache/NodeStorage.mjs.map +1 -1
  9. package/dist/cache/TokenCache.cjs +265 -265
  10. package/dist/cache/TokenCache.d.ts +90 -90
  11. package/dist/cache/TokenCache.mjs +265 -265
  12. package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
  13. package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
  14. package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
  15. package/dist/cache/distributed/ICacheClient.d.ts +17 -17
  16. package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
  17. package/dist/cache/serializer/Deserializer.cjs +167 -170
  18. package/dist/cache/serializer/Deserializer.cjs.map +1 -1
  19. package/dist/cache/serializer/Deserializer.d.ts +42 -42
  20. package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
  21. package/dist/cache/serializer/Deserializer.mjs +168 -171
  22. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  23. package/dist/cache/serializer/Serializer.cjs +137 -137
  24. package/dist/cache/serializer/Serializer.d.ts +39 -39
  25. package/dist/cache/serializer/Serializer.mjs +137 -137
  26. package/dist/cache/serializer/SerializerTypes.d.ts +102 -102
  27. package/dist/client/ClientApplication.cjs +335 -333
  28. package/dist/client/ClientApplication.cjs.map +1 -1
  29. package/dist/client/ClientApplication.d.ts +143 -142
  30. package/dist/client/ClientApplication.d.ts.map +1 -1
  31. package/dist/client/ClientApplication.mjs +336 -334
  32. package/dist/client/ClientApplication.mjs.map +1 -1
  33. package/dist/client/ClientAssertion.cjs +116 -116
  34. package/dist/client/ClientAssertion.d.ts +46 -46
  35. package/dist/client/ClientAssertion.mjs +116 -116
  36. package/dist/client/ClientCredentialClient.cjs +194 -194
  37. package/dist/client/ClientCredentialClient.cjs.map +1 -1
  38. package/dist/client/ClientCredentialClient.d.ts +33 -33
  39. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  40. package/dist/client/ClientCredentialClient.mjs +195 -195
  41. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  42. package/dist/client/ConfidentialClientApplication.cjs +166 -163
  43. package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
  44. package/dist/client/ConfidentialClientApplication.d.ts +58 -58
  45. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  46. package/dist/client/ConfidentialClientApplication.mjs +168 -165
  47. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  48. package/dist/client/DeviceCodeClient.cjs +207 -207
  49. package/dist/client/DeviceCodeClient.d.ts +53 -53
  50. package/dist/client/DeviceCodeClient.mjs +207 -207
  51. package/dist/client/IConfidentialClientApplication.d.ts +39 -39
  52. package/dist/client/IPublicClientApplication.d.ts +42 -42
  53. package/dist/client/ManagedIdentityApplication.cjs +75 -80
  54. package/dist/client/ManagedIdentityApplication.cjs.map +1 -1
  55. package/dist/client/ManagedIdentityApplication.d.ts +23 -23
  56. package/dist/client/ManagedIdentityApplication.d.ts.map +1 -1
  57. package/dist/client/ManagedIdentityApplication.mjs +76 -81
  58. package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
  59. package/dist/client/ManagedIdentityClient.cjs +40 -36
  60. package/dist/client/ManagedIdentityClient.cjs.map +1 -1
  61. package/dist/client/ManagedIdentityClient.d.ts +19 -24
  62. package/dist/client/ManagedIdentityClient.d.ts.map +1 -1
  63. package/dist/client/ManagedIdentityClient.mjs +40 -36
  64. package/dist/client/ManagedIdentityClient.mjs.map +1 -1
  65. package/dist/client/ManagedIdentitySources/AppService.cjs +42 -69
  66. package/dist/client/ManagedIdentitySources/AppService.cjs.map +1 -1
  67. package/dist/client/ManagedIdentitySources/AppService.d.ts +16 -16
  68. package/dist/client/ManagedIdentitySources/AppService.d.ts.map +1 -1
  69. package/dist/client/ManagedIdentitySources/AppService.mjs +43 -70
  70. package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
  71. package/dist/client/ManagedIdentitySources/AzureArc.cjs +81 -92
  72. package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +1 -1
  73. package/dist/client/ManagedIdentitySources/AzureArc.d.ts +18 -18
  74. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  75. package/dist/client/ManagedIdentitySources/AzureArc.mjs +84 -95
  76. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  77. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +116 -77
  78. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +1 -1
  79. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +30 -18
  80. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts.map +1 -1
  81. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +118 -80
  82. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  83. package/dist/client/ManagedIdentitySources/CloudShell.cjs +47 -0
  84. package/dist/client/ManagedIdentitySources/CloudShell.cjs.map +1 -0
  85. package/dist/client/ManagedIdentitySources/CloudShell.d.ts +15 -6
  86. package/dist/client/ManagedIdentitySources/CloudShell.d.ts.map +1 -1
  87. package/dist/client/ManagedIdentitySources/CloudShell.mjs +45 -0
  88. package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -0
  89. package/dist/client/ManagedIdentitySources/Imds.cjs +43 -52
  90. package/dist/client/ManagedIdentitySources/Imds.cjs.map +1 -1
  91. package/dist/client/ManagedIdentitySources/Imds.d.ts +12 -12
  92. package/dist/client/ManagedIdentitySources/Imds.d.ts.map +1 -1
  93. package/dist/client/ManagedIdentitySources/Imds.mjs +44 -53
  94. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
  95. package/dist/client/ManagedIdentitySources/ServiceFabric.cjs +61 -0
  96. package/dist/client/ManagedIdentitySources/ServiceFabric.cjs.map +1 -0
  97. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +16 -6
  98. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts.map +1 -1
  99. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +59 -0
  100. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -0
  101. package/dist/client/OnBehalfOfClient.cjs +202 -202
  102. package/dist/client/OnBehalfOfClient.cjs.map +1 -1
  103. package/dist/client/OnBehalfOfClient.d.ts +47 -47
  104. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  105. package/dist/client/OnBehalfOfClient.mjs +203 -203
  106. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  107. package/dist/client/PublicClientApplication.cjs +229 -229
  108. package/dist/client/PublicClientApplication.d.ts +71 -71
  109. package/dist/client/PublicClientApplication.mjs +229 -229
  110. package/dist/client/UsernamePasswordClient.cjs +95 -95
  111. package/dist/client/UsernamePasswordClient.cjs.map +1 -1
  112. package/dist/client/UsernamePasswordClient.d.ts +25 -25
  113. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  114. package/dist/client/UsernamePasswordClient.mjs +96 -96
  115. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  116. package/dist/config/Configuration.cjs +102 -86
  117. package/dist/config/Configuration.cjs.map +1 -1
  118. package/dist/config/Configuration.d.ts +126 -122
  119. package/dist/config/Configuration.d.ts.map +1 -1
  120. package/dist/config/Configuration.mjs +102 -86
  121. package/dist/config/Configuration.mjs.map +1 -1
  122. package/dist/config/ManagedIdentityId.cjs +48 -48
  123. package/dist/config/ManagedIdentityId.d.ts +11 -11
  124. package/dist/config/ManagedIdentityId.mjs +48 -48
  125. package/dist/config/ManagedIdentityRequestParameters.cjs +28 -29
  126. package/dist/config/ManagedIdentityRequestParameters.cjs.map +1 -1
  127. package/dist/config/ManagedIdentityRequestParameters.d.ts +11 -11
  128. package/dist/config/ManagedIdentityRequestParameters.d.ts.map +1 -1
  129. package/dist/config/ManagedIdentityRequestParameters.mjs +28 -29
  130. package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
  131. package/dist/crypto/CryptoProvider.cjs +75 -75
  132. package/dist/crypto/CryptoProvider.d.ts +52 -52
  133. package/dist/crypto/CryptoProvider.mjs +75 -75
  134. package/dist/crypto/GuidGenerator.cjs +22 -22
  135. package/dist/crypto/GuidGenerator.d.ts +14 -14
  136. package/dist/crypto/GuidGenerator.mjs +22 -22
  137. package/dist/crypto/HashUtils.cjs +13 -13
  138. package/dist/crypto/HashUtils.d.ts +8 -8
  139. package/dist/crypto/HashUtils.mjs +13 -13
  140. package/dist/crypto/PkceGenerator.cjs +49 -49
  141. package/dist/crypto/PkceGenerator.d.ts +22 -22
  142. package/dist/crypto/PkceGenerator.mjs +49 -49
  143. package/dist/error/ManagedIdentityError.cjs +38 -28
  144. package/dist/error/ManagedIdentityError.cjs.map +1 -1
  145. package/dist/error/ManagedIdentityError.d.ts +26 -21
  146. package/dist/error/ManagedIdentityError.d.ts.map +1 -1
  147. package/dist/error/ManagedIdentityError.mjs +39 -29
  148. package/dist/error/ManagedIdentityError.mjs.map +1 -1
  149. package/dist/error/ManagedIdentityErrorCodes.cjs +26 -15
  150. package/dist/error/ManagedIdentityErrorCodes.cjs.map +1 -1
  151. package/dist/error/ManagedIdentityErrorCodes.d.ts +18 -9
  152. package/dist/error/ManagedIdentityErrorCodes.d.ts.map +1 -1
  153. package/dist/error/ManagedIdentityErrorCodes.mjs +23 -14
  154. package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -1
  155. package/dist/error/NodeAuthError.cjs +85 -85
  156. package/dist/error/NodeAuthError.d.ts +65 -65
  157. package/dist/error/NodeAuthError.mjs +85 -85
  158. package/dist/index.cjs +21 -21
  159. package/dist/index.d.ts +44 -44
  160. package/dist/index.d.ts.map +1 -1
  161. package/dist/index.mjs +1 -1
  162. package/dist/internals.cjs +8 -8
  163. package/dist/internals.d.ts +6 -6
  164. package/dist/internals.mjs +8 -8
  165. package/dist/network/HttpClient.cjs +281 -283
  166. package/dist/network/HttpClient.cjs.map +1 -1
  167. package/dist/network/HttpClient.d.ts +25 -26
  168. package/dist/network/HttpClient.d.ts.map +1 -1
  169. package/dist/network/HttpClient.mjs +281 -283
  170. package/dist/network/HttpClient.mjs.map +1 -1
  171. package/dist/network/HttpClientWithRetries.cjs +44 -0
  172. package/dist/network/HttpClientWithRetries.cjs.map +1 -0
  173. package/dist/network/HttpClientWithRetries.d.ts +12 -0
  174. package/dist/network/HttpClientWithRetries.d.ts.map +1 -0
  175. package/dist/network/HttpClientWithRetries.mjs +42 -0
  176. package/dist/network/HttpClientWithRetries.mjs.map +1 -0
  177. package/dist/network/ILoopbackClient.d.ts +10 -10
  178. package/dist/network/LoopbackClient.cjs +77 -77
  179. package/dist/network/LoopbackClient.d.ts +21 -21
  180. package/dist/network/LoopbackClient.mjs +77 -77
  181. package/dist/packageMetadata.cjs +4 -4
  182. package/dist/packageMetadata.d.ts +2 -2
  183. package/dist/packageMetadata.mjs +4 -4
  184. package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
  185. package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
  186. package/dist/request/ClientCredentialRequest.d.ts +14 -14
  187. package/dist/request/ClientCredentialRequest.d.ts.map +1 -1
  188. package/dist/request/DeviceCodeRequest.d.ts +15 -15
  189. package/dist/request/InteractiveRequest.d.ts +22 -22
  190. package/dist/request/ManagedIdentityRequest.d.ts +8 -8
  191. package/dist/request/ManagedIdentityRequestParams.d.ts +9 -9
  192. package/dist/request/OnBehalfOfRequest.d.ts +14 -14
  193. package/dist/request/RefreshTokenRequest.d.ts +17 -17
  194. package/dist/request/SignOutRequest.d.ts +5 -5
  195. package/dist/request/SilentFlowRequest.d.ts +16 -16
  196. package/dist/request/UsernamePasswordRequest.d.ts +19 -19
  197. package/dist/response/ManagedIdentityTokenResponse.d.ts +24 -24
  198. package/dist/retry/IHttpRetryPolicy.d.ts +6 -0
  199. package/dist/retry/IHttpRetryPolicy.d.ts.map +1 -0
  200. package/dist/retry/LinearRetryPolicy.cjs +47 -0
  201. package/dist/retry/LinearRetryPolicy.cjs.map +1 -0
  202. package/dist/retry/LinearRetryPolicy.d.ts +12 -0
  203. package/dist/retry/LinearRetryPolicy.d.ts.map +1 -0
  204. package/dist/retry/LinearRetryPolicy.mjs +45 -0
  205. package/dist/retry/LinearRetryPolicy.mjs.map +1 -0
  206. package/dist/utils/Constants.cjs +142 -103
  207. package/dist/utils/Constants.cjs.map +1 -1
  208. package/dist/utils/Constants.d.ts +132 -106
  209. package/dist/utils/Constants.d.ts.map +1 -1
  210. package/dist/utils/Constants.mjs +134 -100
  211. package/dist/utils/Constants.mjs.map +1 -1
  212. package/dist/utils/EncodingUtils.cjs +44 -44
  213. package/dist/utils/EncodingUtils.d.ts +26 -26
  214. package/dist/utils/EncodingUtils.mjs +44 -44
  215. package/dist/utils/NetworkUtils.cjs +38 -38
  216. package/dist/utils/NetworkUtils.d.ts +5 -5
  217. package/dist/utils/NetworkUtils.mjs +38 -38
  218. package/package.json +5 -5
  219. package/src/cache/NodeStorage.ts +4 -9
  220. package/src/cache/serializer/Deserializer.ts +1 -5
  221. package/src/client/ClientApplication.ts +24 -10
  222. package/src/client/ClientCredentialClient.ts +14 -6
  223. package/src/client/ConfidentialClientApplication.ts +10 -5
  224. package/src/client/ManagedIdentityApplication.ts +8 -16
  225. package/src/client/ManagedIdentityClient.ts +23 -11
  226. package/src/client/ManagedIdentitySources/AppService.ts +68 -97
  227. package/src/client/ManagedIdentitySources/AzureArc.ts +59 -68
  228. package/src/client/ManagedIdentitySources/BaseManagedIdentitySource.ts +82 -11
  229. package/src/client/ManagedIdentitySources/CloudShell.ts +93 -8
  230. package/src/client/ManagedIdentitySources/Imds.ts +54 -40
  231. package/src/client/ManagedIdentitySources/ServiceFabric.ts +126 -5
  232. package/src/client/OnBehalfOfClient.ts +18 -7
  233. package/src/client/UsernamePasswordClient.ts +16 -7
  234. package/src/config/Configuration.ts +50 -18
  235. package/src/config/ManagedIdentityRequestParameters.ts +1 -6
  236. package/src/error/ManagedIdentityError.ts +15 -4
  237. package/src/error/ManagedIdentityErrorCodes.ts +19 -1
  238. package/src/index.ts +1 -0
  239. package/src/network/HttpClient.ts +27 -39
  240. package/src/network/HttpClientWithRetries.ts +80 -0
  241. package/src/packageMetadata.ts +1 -1
  242. package/src/request/ClientCredentialRequest.ts +6 -3
  243. package/src/retry/IHttpRetryPolicy.ts +18 -0
  244. package/src/retry/LinearRetryPolicy.ts +71 -0
  245. package/src/utils/Constants.ts +47 -10
@@ -9,12 +9,13 @@ import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRe
9
9
  import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource";
10
10
  import { CryptoProvider } from "../../crypto/CryptoProvider";
11
11
  import {
12
+ API_VERSION_QUERY_PARAMETER_NAME,
12
13
  HttpMethod,
13
- MANAGED_IDENTITY_CLIENT_ID,
14
- MANAGED_IDENTITY_OBJECT_ID,
15
- MANAGED_IDENTITY_RESOURCE_ID,
16
14
  METADATA_HEADER_NAME,
15
+ ManagedIdentityEnvironmentVariableNames,
17
16
  ManagedIdentityIdType,
17
+ ManagedIdentitySourceNames,
18
+ RESOURCE_BODY_OR_QUERY_PARAMETER_NAME,
18
19
  } from "../../utils/Constants";
19
20
  import { NodeStorage } from "../../cache/NodeStorage";
20
21
 
@@ -26,18 +27,18 @@ const IMDS_API_VERSION: string = "2018-02-01";
26
27
 
27
28
  // Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ImdsManagedIdentitySource.cs
28
29
  export class Imds extends BaseManagedIdentitySource {
29
- private endpoint: string;
30
+ private identityEndpoint: string;
30
31
 
31
32
  constructor(
32
33
  logger: Logger,
33
34
  nodeStorage: NodeStorage,
34
35
  networkClient: INetworkModule,
35
36
  cryptoProvider: CryptoProvider,
36
- endpoint: string
37
+ identityEndpoint: string
37
38
  ) {
38
39
  super(logger, nodeStorage, networkClient, cryptoProvider);
39
40
 
40
- this.endpoint = endpoint;
41
+ this.identityEndpoint = identityEndpoint;
41
42
  }
42
43
 
43
44
  public static tryCreate(
@@ -46,18 +47,40 @@ export class Imds extends BaseManagedIdentitySource {
46
47
  networkClient: INetworkModule,
47
48
  cryptoProvider: CryptoProvider
48
49
  ): Imds {
49
- let endpoint: string;
50
+ let validatedIdentityEndpoint: string;
50
51
 
51
- if (process.env["AZURE_POD_IDENTITY_AUTHORITY_HOST"]) {
52
+ if (
53
+ process.env[
54
+ ManagedIdentityEnvironmentVariableNames
55
+ .AZURE_POD_IDENTITY_AUTHORITY_HOST
56
+ ]
57
+ ) {
52
58
  logger.info(
53
- `[Managed Identity] Environment variable AZURE_POD_IDENTITY_AUTHORITY_HOST for IMDS returned endpoint: ${process.env["AZURE_POD_IDENTITY_AUTHORITY_HOST"]}`
59
+ `[Managed Identity] Environment variable ${
60
+ ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST
61
+ } for ${ManagedIdentitySourceNames.IMDS} returned endpoint: ${
62
+ process.env[
63
+ ManagedIdentityEnvironmentVariableNames
64
+ .AZURE_POD_IDENTITY_AUTHORITY_HOST
65
+ ]
66
+ }`
67
+ );
68
+ validatedIdentityEndpoint = Imds.getValidatedEnvVariableUrlString(
69
+ ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST,
70
+ `${
71
+ process.env[
72
+ ManagedIdentityEnvironmentVariableNames
73
+ .AZURE_POD_IDENTITY_AUTHORITY_HOST
74
+ ]
75
+ }${IMDS_TOKEN_PATH}`,
76
+ ManagedIdentitySourceNames.IMDS,
77
+ logger
54
78
  );
55
- endpoint = `${process.env["AZURE_POD_IDENTITY_AUTHORITY_HOST"]}${IMDS_TOKEN_PATH}`;
56
79
  } else {
57
80
  logger.info(
58
- "[Managed Identity] Unable to find AZURE_POD_IDENTITY_AUTHORITY_HOST environment variable for IMDS, using the default endpoint."
81
+ `[Managed Identity] Unable to find ${ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST} environment variable for ${ManagedIdentitySourceNames.IMDS}, using the default endpoint.`
59
82
  );
60
- endpoint = DEFAULT_IMDS_ENDPOINT;
83
+ validatedIdentityEndpoint = DEFAULT_IMDS_ENDPOINT;
61
84
  }
62
85
 
63
86
  return new Imds(
@@ -65,7 +88,7 @@ export class Imds extends BaseManagedIdentitySource {
65
88
  nodeStorage,
66
89
  networkClient,
67
90
  cryptoProvider,
68
- endpoint
91
+ validatedIdentityEndpoint
69
92
  );
70
93
  }
71
94
 
@@ -74,39 +97,30 @@ export class Imds extends BaseManagedIdentitySource {
74
97
  managedIdentityId: ManagedIdentityId
75
98
  ): ManagedIdentityRequestParameters {
76
99
  const request: ManagedIdentityRequestParameters =
77
- new ManagedIdentityRequestParameters(HttpMethod.GET, this.endpoint);
100
+ new ManagedIdentityRequestParameters(
101
+ HttpMethod.GET,
102
+ this.identityEndpoint
103
+ );
78
104
 
79
105
  request.headers[METADATA_HEADER_NAME] = "true";
80
- request.queryParameters["api-version"] = IMDS_API_VERSION;
81
- request.queryParameters["resource"] = resource;
82
- // bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
83
106
 
84
- switch (managedIdentityId.idType) {
85
- case ManagedIdentityIdType.USER_ASSIGNED_CLIENT_ID:
86
- this.logger.info(
87
- "[Managed Identity] Adding user assigned client id to the request."
88
- );
89
- request.queryParameters[MANAGED_IDENTITY_CLIENT_ID] =
90
- managedIdentityId.id;
91
- break;
107
+ request.queryParameters[API_VERSION_QUERY_PARAMETER_NAME] =
108
+ IMDS_API_VERSION;
109
+ request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
110
+ resource;
92
111
 
93
- case ManagedIdentityIdType.USER_ASSIGNED_RESOURCE_ID:
94
- this.logger.info(
95
- "[Managed Identity] Adding user assigned resource id to the request."
96
- );
97
- request.queryParameters[MANAGED_IDENTITY_RESOURCE_ID] =
98
- managedIdentityId.id;
99
- break;
100
-
101
- case ManagedIdentityIdType.USER_ASSIGNED_OBJECT_ID:
102
- this.logger.info(
103
- "[Managed Identity] Adding user assigned object id to the request."
104
- );
105
- request.queryParameters[MANAGED_IDENTITY_OBJECT_ID] =
106
- managedIdentityId.id;
107
- break;
112
+ if (
113
+ managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
114
+ ) {
115
+ request.queryParameters[
116
+ this.getManagedIdentityUserAssignedIdQueryParameterKey(
117
+ managedIdentityId.idType
118
+ )
119
+ ] = managedIdentityId.id;
108
120
  }
109
121
 
122
+ // bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
123
+
110
124
  return request;
111
125
  }
112
126
  }
@@ -3,17 +3,138 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { INetworkModule, Logger } from "@azure/msal-common";
6
7
  import { ManagedIdentityId } from "../../config/ManagedIdentityId";
7
8
  import { ManagedIdentityRequestParameters } from "../../config/ManagedIdentityRequestParameters";
8
9
  import { BaseManagedIdentitySource } from "./BaseManagedIdentitySource";
10
+ import { NodeStorage } from "../../cache/NodeStorage";
11
+ import { CryptoProvider } from "../../crypto/CryptoProvider";
12
+ import {
13
+ API_VERSION_QUERY_PARAMETER_NAME,
14
+ HttpMethod,
15
+ ManagedIdentityEnvironmentVariableNames,
16
+ ManagedIdentityIdType,
17
+ ManagedIdentitySourceNames,
18
+ RESOURCE_BODY_OR_QUERY_PARAMETER_NAME,
19
+ SERVICE_FABRIC_SECRET_HEADER_NAME,
20
+ } from "../../utils/Constants";
9
21
 
22
+ // MSI Constants. Docs for MSI are available here https://docs.microsoft.com/azure/app-service/overview-managed-identity
23
+ const SERVICE_FABRIC_MSI_API_VERSION: string = "2019-07-01-preview";
24
+
25
+ /**
26
+ * Original source of code: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/src/ServiceFabricManagedIdentitySource.cs
27
+ */
10
28
  export class ServiceFabric extends BaseManagedIdentitySource {
29
+ private identityEndpoint: string;
30
+ private identityHeader: string;
31
+
32
+ constructor(
33
+ logger: Logger,
34
+ nodeStorage: NodeStorage,
35
+ networkClient: INetworkModule,
36
+ cryptoProvider: CryptoProvider,
37
+ identityEndpoint: string,
38
+ identityHeader: string
39
+ ) {
40
+ super(logger, nodeStorage, networkClient, cryptoProvider);
41
+
42
+ this.identityEndpoint = identityEndpoint;
43
+ this.identityHeader = identityHeader;
44
+ }
45
+
46
+ public static tryCreate(
47
+ logger: Logger,
48
+ nodeStorage: NodeStorage,
49
+ networkClient: INetworkModule,
50
+ cryptoProvider: CryptoProvider,
51
+ managedIdentityId: ManagedIdentityId
52
+ ): ServiceFabric | null {
53
+ const identityEndpoint: string | undefined =
54
+ process.env[
55
+ ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT
56
+ ];
57
+ const identityHeader: string | undefined =
58
+ process.env[
59
+ ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER
60
+ ];
61
+ const identityServerThumbprint: string | undefined =
62
+ process.env[
63
+ ManagedIdentityEnvironmentVariableNames
64
+ .IDENTITY_SERVER_THUMBPRINT
65
+ ];
66
+
67
+ /*
68
+ * if either of the identity endpoint, identity header, or identity server thumbprint
69
+ * environment variables are undefined, this MSI provider is unavailable.
70
+ */
71
+ if (!identityEndpoint || !identityHeader || !identityServerThumbprint) {
72
+ logger.info(
73
+ `[Managed Identity] ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity is unavailable because one or all of the '${ManagedIdentityEnvironmentVariableNames.IDENTITY_HEADER}', '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' or '${ManagedIdentityEnvironmentVariableNames.IDENTITY_SERVER_THUMBPRINT}' environment variables are not defined.`
74
+ );
75
+ return null;
76
+ }
77
+
78
+ const validatedIdentityEndpoint: string =
79
+ ServiceFabric.getValidatedEnvVariableUrlString(
80
+ ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT,
81
+ identityEndpoint,
82
+ ManagedIdentitySourceNames.SERVICE_FABRIC,
83
+ logger
84
+ );
85
+
86
+ logger.info(
87
+ `[Managed Identity] Environment variables validation passed for ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity. Endpoint URI: ${validatedIdentityEndpoint}. Creating ${ManagedIdentitySourceNames.SERVICE_FABRIC} managed identity.`
88
+ );
89
+
90
+ if (
91
+ managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
92
+ ) {
93
+ logger.warning(
94
+ `[Managed Identity] ${ManagedIdentitySourceNames.SERVICE_FABRIC} user assigned managed identity is configured in the cluster, not during runtime. See also: https://learn.microsoft.com/en-us/azure/service-fabric/configure-existing-cluster-enable-managed-identity-token-service.`
95
+ );
96
+ }
97
+
98
+ return new ServiceFabric(
99
+ logger,
100
+ nodeStorage,
101
+ networkClient,
102
+ cryptoProvider,
103
+ identityEndpoint,
104
+ identityHeader
105
+ );
106
+ }
107
+
11
108
  public createRequest(
12
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
- _resource: string,
14
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
15
- _managedIdentityId: ManagedIdentityId
109
+ resource: string,
110
+ managedIdentityId: ManagedIdentityId
16
111
  ): ManagedIdentityRequestParameters {
17
- throw new Error("Method not implemented.");
112
+ const request: ManagedIdentityRequestParameters =
113
+ new ManagedIdentityRequestParameters(
114
+ HttpMethod.GET,
115
+ this.identityEndpoint
116
+ );
117
+
118
+ request.headers[SERVICE_FABRIC_SECRET_HEADER_NAME] =
119
+ this.identityHeader;
120
+
121
+ request.queryParameters[API_VERSION_QUERY_PARAMETER_NAME] =
122
+ SERVICE_FABRIC_MSI_API_VERSION;
123
+ request.queryParameters[RESOURCE_BODY_OR_QUERY_PARAMETER_NAME] =
124
+ resource;
125
+
126
+ if (
127
+ managedIdentityId.idType !== ManagedIdentityIdType.SYSTEM_ASSIGNED
128
+ ) {
129
+ request.queryParameters[
130
+ this.getManagedIdentityUserAssignedIdQueryParameterKey(
131
+ managedIdentityId.idType
132
+ )
133
+ ] = managedIdentityId.id;
134
+ }
135
+
136
+ // bodyParameters calculated in BaseManagedIdentity.acquireTokenWithManagedIdentity
137
+
138
+ return request;
18
139
  }
19
140
  }
@@ -30,6 +30,8 @@ import {
30
30
  TimeUtils,
31
31
  TokenClaims,
32
32
  UrlString,
33
+ ClientAssertion,
34
+ getClientAssertion,
33
35
  } from "@azure/msal-common";
34
36
  import { EncodingUtils } from "../utils/EncodingUtils";
35
37
 
@@ -58,7 +60,7 @@ export class OnBehalfOfClient extends BaseClient {
58
60
  request.oboAssertion
59
61
  );
60
62
 
61
- if (request.skipCache) {
63
+ if (request.skipCache || request.claims) {
62
64
  return this.executeTokenRequest(
63
65
  request,
64
66
  this.authority,
@@ -257,7 +259,7 @@ export class OnBehalfOfClient extends BaseClient {
257
259
  authority.tokenEndpoint,
258
260
  queryParametersString
259
261
  );
260
- const requestBody = this.createTokenRequestBody(request);
262
+ const requestBody = await this.createTokenRequestBody(request);
261
263
  const headers: Record<string, string> =
262
264
  this.createTokenRequestHeaders();
263
265
  const thumbprint: RequestThumbprint = {
@@ -307,7 +309,9 @@ export class OnBehalfOfClient extends BaseClient {
307
309
  * generate a server request in accepable format
308
310
  * @param request
309
311
  */
310
- private createTokenRequestBody(request: CommonOnBehalfOfRequest): string {
312
+ private async createTokenRequestBody(
313
+ request: CommonOnBehalfOfRequest
314
+ ): Promise<string> {
311
315
  const parameterBuilder = new RequestParameterBuilder();
312
316
 
313
317
  parameterBuilder.addClientId(this.config.authOptions.clientId);
@@ -343,10 +347,17 @@ export class OnBehalfOfClient extends BaseClient {
343
347
  );
344
348
  }
345
349
 
346
- if (this.config.clientCredentials.clientAssertion) {
347
- const clientAssertion =
348
- this.config.clientCredentials.clientAssertion;
349
- parameterBuilder.addClientAssertion(clientAssertion.assertion);
350
+ const clientAssertion: ClientAssertion | undefined =
351
+ this.config.clientCredentials.clientAssertion;
352
+
353
+ if (clientAssertion) {
354
+ parameterBuilder.addClientAssertion(
355
+ await getClientAssertion(
356
+ clientAssertion.assertion,
357
+ this.config.authOptions.clientId,
358
+ request.resourceRequestUri
359
+ )
360
+ );
350
361
  parameterBuilder.addClientAssertionType(
351
362
  clientAssertion.assertionType
352
363
  );
@@ -8,6 +8,7 @@ import {
8
8
  Authority,
9
9
  BaseClient,
10
10
  CcsCredentialType,
11
+ ClientAssertion,
11
12
  ClientConfiguration,
12
13
  CommonUsernamePasswordRequest,
13
14
  GrantType,
@@ -19,6 +20,7 @@ import {
19
20
  StringUtils,
20
21
  TimeUtils,
21
22
  UrlString,
23
+ getClientAssertion,
22
24
  } from "@azure/msal-common";
23
25
 
24
26
  /**
@@ -81,7 +83,7 @@ export class UsernamePasswordClient extends BaseClient {
81
83
  authority.tokenEndpoint,
82
84
  queryParametersString
83
85
  );
84
- const requestBody = this.createTokenRequestBody(request);
86
+ const requestBody = await this.createTokenRequestBody(request);
85
87
  const headers: Record<string, string> = this.createTokenRequestHeaders({
86
88
  credential: request.username,
87
89
  type: CcsCredentialType.UPN,
@@ -111,9 +113,9 @@ export class UsernamePasswordClient extends BaseClient {
111
113
  * Generates a map for all the params to be sent to the service
112
114
  * @param request
113
115
  */
114
- private createTokenRequestBody(
116
+ private async createTokenRequestBody(
115
117
  request: CommonUsernamePasswordRequest
116
- ): string {
118
+ ): Promise<string> {
117
119
  const parameterBuilder = new RequestParameterBuilder();
118
120
 
119
121
  parameterBuilder.addClientId(this.config.authOptions.clientId);
@@ -148,10 +150,17 @@ export class UsernamePasswordClient extends BaseClient {
148
150
  );
149
151
  }
150
152
 
151
- if (this.config.clientCredentials.clientAssertion) {
152
- const clientAssertion =
153
- this.config.clientCredentials.clientAssertion;
154
- parameterBuilder.addClientAssertion(clientAssertion.assertion);
153
+ const clientAssertion: ClientAssertion | undefined =
154
+ this.config.clientCredentials.clientAssertion;
155
+
156
+ if (clientAssertion) {
157
+ parameterBuilder.addClientAssertion(
158
+ await getClientAssertion(
159
+ clientAssertion.assertion,
160
+ this.config.authOptions.clientId,
161
+ request.resourceRequestUri
162
+ )
163
+ );
155
164
  parameterBuilder.addClientAssertionType(
156
165
  clientAssertion.assertionType
157
166
  );
@@ -14,18 +14,26 @@ import {
14
14
  AzureCloudOptions,
15
15
  ApplicationTelemetry,
16
16
  INativeBrokerPlugin,
17
+ ClientAssertionCallback,
17
18
  } from "@azure/msal-common";
18
19
  import { HttpClient } from "../network/HttpClient.js";
19
20
  import http from "http";
20
21
  import https from "https";
21
22
  import { ManagedIdentityId } from "./ManagedIdentityId.js";
23
+ import {
24
+ MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON,
25
+ MANAGED_IDENTITY_MAX_RETRIES,
26
+ MANAGED_IDENTITY_RETRY_DELAY,
27
+ } from "../utils/Constants.js";
28
+ import { LinearRetryPolicy } from "../retry/LinearRetryPolicy.js";
29
+ import { HttpClientWithRetries } from "../network/HttpClientWithRetries.js";
22
30
 
23
31
  /**
24
32
  * - clientId - Client id of the application.
25
33
  * - authority - Url of the authority. If no value is set, defaults to https://login.microsoftonline.com/common.
26
34
  * - knownAuthorities - Needed for Azure B2C and ADFS. All authorities that will be used in the client application. Only the host of the authority should be passed in.
27
35
  * - clientSecret - Secret string that the application uses when requesting a token. Only used in confidential client applications. Can be created in the Azure app registration portal.
28
- * - clientAssertion - Assertion string that the application uses when requesting a token. Only used in confidential client applications. Assertion should be of type urn:ietf:params:oauth:client-assertion-type:jwt-bearer.
36
+ * - clientAssertion - A ClientAssertion object containing an assertion string or a callback function that returns an assertion string that the application uses when requesting a token, as well as the assertion's type (urn:ietf:params:oauth:client-assertion-type:jwt-bearer). Only used in confidential client applications.
29
37
  * - clientCertificate - Certificate that the application uses when requesting a token. Only used in confidential client applications. Requires hex encoded X.509 SHA-1 thumbprint of the certificiate, and the PEM encoded private key (string should contain -----BEGIN PRIVATE KEY----- ... -----END PRIVATE KEY----- )
30
38
  * - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
31
39
  * - skipAuthorityMetadataCache - A flag to choose whether to use or not use the local metadata cache during authority initialization. Defaults to false.
@@ -35,7 +43,7 @@ export type NodeAuthOptions = {
35
43
  clientId: string;
36
44
  authority?: string;
37
45
  clientSecret?: string;
38
- clientAssertion?: string;
46
+ clientAssertion?: string | ClientAssertionCallback;
39
47
  clientCertificate?: {
40
48
  thumbprint: string;
41
49
  privateKey: string;
@@ -58,6 +66,9 @@ export type NodeAuthOptions = {
58
66
  */
59
67
  export type CacheOptions = {
60
68
  cachePlugin?: ICachePlugin;
69
+ /**
70
+ * @deprecated claims-based-caching functionality will be removed in the next version of MSALJS
71
+ */
61
72
  claimsBasedCachingEnabled?: boolean;
62
73
  };
63
74
 
@@ -84,6 +95,7 @@ export type NodeSystemOptions = {
84
95
  networkClient?: INetworkModule;
85
96
  proxyUrl?: string;
86
97
  customAgentOptions?: http.AgentOptions | https.AgentOptions;
98
+ disableInternalRetries?: boolean;
87
99
  };
88
100
 
89
101
  export type NodeTelemetryOptions = {
@@ -158,6 +170,7 @@ const DEFAULT_SYSTEM_OPTIONS: Required<NodeSystemOptions> = {
158
170
  networkClient: new HttpClient(),
159
171
  proxyUrl: Constants.EMPTY_STRING,
160
172
  customAgentOptions: {} as http.AgentOptions | https.AgentOptions,
173
+ disableInternalRetries: false,
161
174
  };
162
175
 
163
176
  const DEFAULT_TELEMETRY_OPTIONS: Required<NodeTelemetryOptions> = {
@@ -198,12 +211,10 @@ export function buildAppConfiguration({
198
211
  ...DEFAULT_SYSTEM_OPTIONS,
199
212
  networkClient: new HttpClient(
200
213
  system?.proxyUrl,
201
- system?.customAgentOptions as
202
- | http.AgentOptions
203
- | https.AgentOptions,
204
- false // Managed Identity
214
+ system?.customAgentOptions as http.AgentOptions | https.AgentOptions
205
215
  ),
206
216
  loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
217
+ disableInternalRetries: system?.disableInternalRetries || false,
207
218
  };
208
219
 
209
220
  return {
@@ -217,7 +228,9 @@ export function buildAppConfiguration({
217
228
 
218
229
  export type ManagedIdentityNodeConfiguration = {
219
230
  managedIdentityId: ManagedIdentityId;
220
- system: Required<NodeSystemOptions>;
231
+ system: Required<
232
+ Pick<NodeSystemOptions, "loggerOptions" | "networkClient">
233
+ >;
221
234
  };
222
235
 
223
236
  export function buildManagedIdentityConfiguration({
@@ -228,20 +241,39 @@ export function buildManagedIdentityConfiguration({
228
241
  managedIdentityIdParams
229
242
  );
230
243
 
231
- const systemOptions: Required<NodeSystemOptions> = {
232
- ...DEFAULT_SYSTEM_OPTIONS,
233
- loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
234
- networkClient: new HttpClient(
244
+ const loggerOptions: LoggerOptions =
245
+ system?.loggerOptions || DEFAULT_LOGGER_OPTIONS;
246
+
247
+ let networkClient: INetworkModule;
248
+ // use developer provided network client if passed in
249
+ if (system?.networkClient) {
250
+ networkClient = system.networkClient;
251
+ // otherwise, create a new one
252
+ } else {
253
+ networkClient = new HttpClient(
235
254
  system?.proxyUrl,
236
- system?.customAgentOptions as
237
- | http.AgentOptions
238
- | https.AgentOptions,
239
- true // Managed Identity
240
- ),
241
- };
255
+ system?.customAgentOptions as http.AgentOptions | https.AgentOptions
256
+ );
257
+ }
258
+
259
+ // wrap the network client with a retry policy if the developer has not disabled the option to do so
260
+ if (!system?.disableInternalRetries) {
261
+ const linearRetryPolicy: LinearRetryPolicy = new LinearRetryPolicy(
262
+ MANAGED_IDENTITY_MAX_RETRIES,
263
+ MANAGED_IDENTITY_RETRY_DELAY,
264
+ MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON
265
+ );
266
+ networkClient = new HttpClientWithRetries(
267
+ networkClient,
268
+ linearRetryPolicy
269
+ );
270
+ }
242
271
 
243
272
  return {
244
273
  managedIdentityId: managedIdentityId,
245
- system: { ...systemOptions, ...system },
274
+ system: {
275
+ loggerOptions,
276
+ networkClient,
277
+ },
246
278
  };
247
279
  }
@@ -43,11 +43,6 @@ export class ManagedIdentityRequestParameters {
43
43
  parameterBuilder.addExtraQueryParameters(this.bodyParameters);
44
44
  }
45
45
 
46
- const bodyParametersString = parameterBuilder.createQueryString();
47
-
48
- return UrlString.appendQueryString(
49
- this._baseEndpoint,
50
- bodyParametersString
51
- );
46
+ return parameterBuilder.createQueryString();
52
47
  }
53
48
  }
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { AuthError } from "@azure/msal-common";
7
7
  import * as ManagedIdentityErrorCodes from "./ManagedIdentityErrorCodes";
8
+ import { ManagedIdentityEnvironmentVariableNames } from "../utils/Constants";
8
9
  export { ManagedIdentityErrorCodes };
9
10
 
10
11
  /**
@@ -13,18 +14,28 @@ export { ManagedIdentityErrorCodes };
13
14
  export const ManagedIdentityErrorMessages = {
14
15
  [ManagedIdentityErrorCodes.invalidManagedIdentityIdType]:
15
16
  "More than one ManagedIdentityIdType was provided.",
16
- [ManagedIdentityErrorCodes.invalidResource]:
17
- "The supplied resource is an invalid URL.",
18
17
  [ManagedIdentityErrorCodes.missingId]:
19
18
  "A ManagedIdentityId id was not provided.",
19
+ [ManagedIdentityErrorCodes.MsiEnvironmentVariableUrlMalformedErrorCodes
20
+ .AZURE_POD_IDENTITY_AUTHORITY_HOST]: `The Managed Identity's '${ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST}' environment variable is malformed.`,
21
+ [ManagedIdentityErrorCodes.MsiEnvironmentVariableUrlMalformedErrorCodes
22
+ .IDENTITY_ENDPOINT]: `The Managed Identity's '${ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT}' environment variable is malformed.`,
23
+ [ManagedIdentityErrorCodes.MsiEnvironmentVariableUrlMalformedErrorCodes
24
+ .IMDS_ENDPOINT]: `The Managed Identity's '${ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT}' environment variable is malformed.`,
25
+ [ManagedIdentityErrorCodes.MsiEnvironmentVariableUrlMalformedErrorCodes
26
+ .MSI_ENDPOINT]: `The Managed Identity's '${ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT}' environment variable is malformed.`,
27
+ [ManagedIdentityErrorCodes.networkUnavailable]:
28
+ "Authentication unavailable. The request to the managed identity endpoint timed out.",
20
29
  [ManagedIdentityErrorCodes.unableToCreateAzureArc]:
21
30
  "Azure Arc Managed Identities can only be system assigned.",
31
+ [ManagedIdentityErrorCodes.unableToCreateCloudShell]:
32
+ "Cloud Shell Managed Identities can only be system assigned.",
22
33
  [ManagedIdentityErrorCodes.unableToCreateSource]:
23
34
  "Unable to create a Managed Identity source based on environment variables.",
24
35
  [ManagedIdentityErrorCodes.unableToReadSecretFile]:
25
36
  "Unable to read the secret file.",
26
- [ManagedIdentityErrorCodes.urlParseError]:
27
- "The Managed Identity's 'IDENTITY_ENDPOINT' environment variable is malformed.",
37
+ [ManagedIdentityErrorCodes.userAssignedNotAvailableAtRuntime]:
38
+ "Service Fabric user assigned managed identity ClientId or ResourceId is not configurable at runtime.",
28
39
  [ManagedIdentityErrorCodes.wwwAuthenticateHeaderMissing]:
29
40
  "A 401 response was received form the Azure Arc Managed Identity, but the www-authenticate header is missing.",
30
41
  [ManagedIdentityErrorCodes.wwwAuthenticateHeaderUnsupportedFormat]:
@@ -3,13 +3,31 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { ManagedIdentityEnvironmentVariableNames } from "../utils/Constants";
7
+
6
8
  export const invalidManagedIdentityIdType = "invalid_managed_identity_id_type";
7
- export const invalidResource = "invalid_resource";
8
9
  export const missingId = "missing_client_id";
10
+ export const networkUnavailable = "network_unavailable";
9
11
  export const unableToCreateAzureArc = "unable_to_create_azure_arc";
12
+ export const unableToCreateCloudShell = "unable_to_create_cloud_shell";
10
13
  export const unableToCreateSource = "unable_to_create_source";
11
14
  export const unableToReadSecretFile = "unable_to_read_secret_file";
12
15
  export const urlParseError = "url_parse_error";
16
+ export const userAssignedNotAvailableAtRuntime =
17
+ "user_assigned_not_available_at_runtime";
13
18
  export const wwwAuthenticateHeaderMissing = "www_authenticate_header_missing";
14
19
  export const wwwAuthenticateHeaderUnsupportedFormat =
15
20
  "www_authenticate_header_unsupported_format";
21
+
22
+ export const MsiEnvironmentVariableUrlMalformedErrorCodes = {
23
+ [ManagedIdentityEnvironmentVariableNames.AZURE_POD_IDENTITY_AUTHORITY_HOST]:
24
+ "azure_pod_identity_authority_host_url_malformed",
25
+ [ManagedIdentityEnvironmentVariableNames.IDENTITY_ENDPOINT]:
26
+ "identity_endpoint_url_malformed",
27
+ [ManagedIdentityEnvironmentVariableNames.IMDS_ENDPOINT]:
28
+ "imds_endpoint_url_malformed",
29
+ [ManagedIdentityEnvironmentVariableNames.MSI_ENDPOINT]:
30
+ "msi_endpoint_url_malformed",
31
+ } as const;
32
+ export type MsiEnvironmentVariableErrorCodes =
33
+ (typeof MsiEnvironmentVariableUrlMalformedErrorCodes)[keyof typeof MsiEnvironmentVariableUrlMalformedErrorCodes];
package/src/index.ts CHANGED
@@ -125,6 +125,7 @@ export {
125
125
  AppTokenProviderParameters,
126
126
  AppTokenProviderResult,
127
127
  INativeBrokerPlugin,
128
+ ClientAssertionCallback,
128
129
  } from "@azure/msal-common";
129
130
 
130
131
  export { version } from "./packageMetadata.js";