@azure/msal-node 2.0.2 → 2.2.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 (218) hide show
  1. package/README.md +3 -1
  2. package/dist/cache/ITokenCache.d.ts +15 -15
  3. package/dist/cache/NodeStorage.cjs +401 -401
  4. package/dist/cache/NodeStorage.cjs.map +1 -1
  5. package/dist/cache/NodeStorage.d.ts +182 -182
  6. package/dist/cache/NodeStorage.d.ts.map +1 -1
  7. package/dist/cache/NodeStorage.mjs +401 -401
  8. package/dist/cache/NodeStorage.mjs.map +1 -1
  9. package/dist/cache/TokenCache.cjs +265 -269
  10. package/dist/cache/TokenCache.cjs.map +1 -1
  11. package/dist/cache/TokenCache.d.ts +90 -90
  12. package/dist/cache/TokenCache.d.ts.map +1 -1
  13. package/dist/cache/TokenCache.mjs +266 -270
  14. package/dist/cache/TokenCache.mjs.map +1 -1
  15. package/dist/cache/distributed/DistributedCachePlugin.cjs +26 -26
  16. package/dist/cache/distributed/DistributedCachePlugin.cjs.map +1 -1
  17. package/dist/cache/distributed/DistributedCachePlugin.d.ts +10 -10
  18. package/dist/cache/distributed/DistributedCachePlugin.d.ts.map +1 -1
  19. package/dist/cache/distributed/DistributedCachePlugin.mjs +26 -26
  20. package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
  21. package/dist/cache/distributed/ICacheClient.d.ts +17 -17
  22. package/dist/cache/distributed/IPartitionManager.d.ts +28 -28
  23. package/dist/cache/serializer/Deserializer.cjs +173 -175
  24. package/dist/cache/serializer/Deserializer.cjs.map +1 -1
  25. package/dist/cache/serializer/Deserializer.d.ts +42 -42
  26. package/dist/cache/serializer/Deserializer.d.ts.map +1 -1
  27. package/dist/cache/serializer/Deserializer.mjs +174 -176
  28. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  29. package/dist/cache/serializer/Serializer.cjs +134 -134
  30. package/dist/cache/serializer/Serializer.cjs.map +1 -1
  31. package/dist/cache/serializer/Serializer.d.ts +39 -39
  32. package/dist/cache/serializer/Serializer.d.ts.map +1 -1
  33. package/dist/cache/serializer/Serializer.mjs +134 -134
  34. package/dist/cache/serializer/Serializer.mjs.map +1 -1
  35. package/dist/cache/serializer/SerializerTypes.d.ts +101 -101
  36. package/dist/client/ClientApplication.cjs +333 -333
  37. package/dist/client/ClientApplication.cjs.map +1 -1
  38. package/dist/client/ClientApplication.d.ts +142 -142
  39. package/dist/client/ClientApplication.d.ts.map +1 -1
  40. package/dist/client/ClientApplication.mjs +334 -334
  41. package/dist/client/ClientApplication.mjs.map +1 -1
  42. package/dist/client/ClientAssertion.cjs +116 -116
  43. package/dist/client/ClientAssertion.cjs.map +1 -1
  44. package/dist/client/ClientAssertion.d.ts +46 -46
  45. package/dist/client/ClientAssertion.d.ts.map +1 -1
  46. package/dist/client/ClientAssertion.mjs +117 -117
  47. package/dist/client/ClientAssertion.mjs.map +1 -1
  48. package/dist/client/ClientCredentialClient.cjs +189 -168
  49. package/dist/client/ClientCredentialClient.cjs.map +1 -1
  50. package/dist/client/ClientCredentialClient.d.ts +33 -33
  51. package/dist/client/ClientCredentialClient.d.ts.map +1 -1
  52. package/dist/client/ClientCredentialClient.mjs +190 -169
  53. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  54. package/dist/client/ConfidentialClientApplication.cjs +163 -164
  55. package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
  56. package/dist/client/ConfidentialClientApplication.d.ts +58 -58
  57. package/dist/client/ConfidentialClientApplication.d.ts.map +1 -1
  58. package/dist/client/ConfidentialClientApplication.mjs +164 -165
  59. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  60. package/dist/client/DeviceCodeClient.cjs +207 -207
  61. package/dist/client/DeviceCodeClient.cjs.map +1 -1
  62. package/dist/client/DeviceCodeClient.d.ts +53 -53
  63. package/dist/client/DeviceCodeClient.d.ts.map +1 -1
  64. package/dist/client/DeviceCodeClient.mjs +208 -208
  65. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  66. package/dist/client/IConfidentialClientApplication.d.ts +39 -39
  67. package/dist/client/IConfidentialClientApplication.d.ts.map +1 -1
  68. package/dist/client/IPublicClientApplication.d.ts +42 -42
  69. package/dist/client/IPublicClientApplication.d.ts.map +1 -1
  70. package/dist/client/OnBehalfOfClient.cjs +203 -204
  71. package/dist/client/OnBehalfOfClient.cjs.map +1 -1
  72. package/dist/client/OnBehalfOfClient.d.ts +47 -47
  73. package/dist/client/OnBehalfOfClient.d.ts.map +1 -1
  74. package/dist/client/OnBehalfOfClient.mjs +204 -205
  75. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  76. package/dist/client/PublicClientApplication.cjs +229 -175
  77. package/dist/client/PublicClientApplication.cjs.map +1 -1
  78. package/dist/client/PublicClientApplication.d.ts +71 -65
  79. package/dist/client/PublicClientApplication.d.ts.map +1 -1
  80. package/dist/client/PublicClientApplication.mjs +232 -178
  81. package/dist/client/PublicClientApplication.mjs.map +1 -1
  82. package/dist/client/UsernamePasswordClient.cjs +95 -95
  83. package/dist/client/UsernamePasswordClient.cjs.map +1 -1
  84. package/dist/client/UsernamePasswordClient.d.ts +25 -25
  85. package/dist/client/UsernamePasswordClient.d.ts.map +1 -1
  86. package/dist/client/UsernamePasswordClient.mjs +95 -95
  87. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  88. package/dist/config/Configuration.cjs +72 -72
  89. package/dist/config/Configuration.cjs.map +1 -1
  90. package/dist/config/Configuration.d.ts +107 -107
  91. package/dist/config/Configuration.mjs +72 -72
  92. package/dist/config/Configuration.mjs.map +1 -1
  93. package/dist/crypto/CryptoProvider.cjs +75 -75
  94. package/dist/crypto/CryptoProvider.cjs.map +1 -1
  95. package/dist/crypto/CryptoProvider.d.ts +52 -52
  96. package/dist/crypto/CryptoProvider.mjs +75 -75
  97. package/dist/crypto/CryptoProvider.mjs.map +1 -1
  98. package/dist/crypto/GuidGenerator.cjs +22 -22
  99. package/dist/crypto/GuidGenerator.cjs.map +1 -1
  100. package/dist/crypto/GuidGenerator.d.ts +14 -14
  101. package/dist/crypto/GuidGenerator.mjs +22 -22
  102. package/dist/crypto/GuidGenerator.mjs.map +1 -1
  103. package/dist/crypto/HashUtils.cjs +13 -13
  104. package/dist/crypto/HashUtils.cjs.map +1 -1
  105. package/dist/crypto/HashUtils.d.ts +8 -8
  106. package/dist/crypto/HashUtils.mjs +13 -13
  107. package/dist/crypto/HashUtils.mjs.map +1 -1
  108. package/dist/crypto/PkceGenerator.cjs +49 -49
  109. package/dist/crypto/PkceGenerator.cjs.map +1 -1
  110. package/dist/crypto/PkceGenerator.d.ts +22 -22
  111. package/dist/crypto/PkceGenerator.mjs +49 -49
  112. package/dist/crypto/PkceGenerator.mjs.map +1 -1
  113. package/dist/error/NodeAuthError.cjs +85 -85
  114. package/dist/error/NodeAuthError.cjs.map +1 -1
  115. package/dist/error/NodeAuthError.d.ts +65 -65
  116. package/dist/error/NodeAuthError.mjs +85 -85
  117. package/dist/error/NodeAuthError.mjs.map +1 -1
  118. package/dist/index.cjs +17 -1
  119. package/dist/index.cjs.map +1 -1
  120. package/dist/index.d.ts +42 -42
  121. package/dist/index.d.ts.map +1 -1
  122. package/dist/index.mjs +2 -2
  123. package/dist/internals.cjs +8 -8
  124. package/dist/internals.cjs.map +1 -1
  125. package/dist/internals.d.ts +6 -6
  126. package/dist/internals.d.ts.map +1 -1
  127. package/dist/internals.mjs +8 -8
  128. package/dist/internals.mjs.map +1 -1
  129. package/dist/network/HttpClient.cjs +277 -276
  130. package/dist/network/HttpClient.cjs.map +1 -1
  131. package/dist/network/HttpClient.d.ts +25 -25
  132. package/dist/network/HttpClient.d.ts.map +1 -1
  133. package/dist/network/HttpClient.mjs +278 -277
  134. package/dist/network/HttpClient.mjs.map +1 -1
  135. package/dist/network/ILoopbackClient.d.ts +10 -10
  136. package/dist/network/LoopbackClient.cjs +75 -84
  137. package/dist/network/LoopbackClient.cjs.map +1 -1
  138. package/dist/network/LoopbackClient.d.ts +21 -21
  139. package/dist/network/LoopbackClient.d.ts.map +1 -1
  140. package/dist/network/LoopbackClient.mjs +77 -86
  141. package/dist/network/LoopbackClient.mjs.map +1 -1
  142. package/dist/packageMetadata.cjs +4 -4
  143. package/dist/packageMetadata.cjs.map +1 -1
  144. package/dist/packageMetadata.d.ts +2 -2
  145. package/dist/packageMetadata.mjs +4 -4
  146. package/dist/packageMetadata.mjs.map +1 -1
  147. package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
  148. package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
  149. package/dist/request/ClientCredentialRequest.d.ts +14 -14
  150. package/dist/request/DeviceCodeRequest.d.ts +15 -15
  151. package/dist/request/InteractiveRequest.d.ts +22 -22
  152. package/dist/request/InteractiveRequest.d.ts.map +1 -1
  153. package/dist/request/OnBehalfOfRequest.d.ts +14 -14
  154. package/dist/request/RefreshTokenRequest.d.ts +17 -17
  155. package/dist/request/SignOutRequest.d.ts +5 -5
  156. package/dist/request/SilentFlowRequest.d.ts +16 -16
  157. package/dist/request/UsernamePasswordRequest.d.ts +19 -19
  158. package/dist/utils/Constants.cjs +80 -90
  159. package/dist/utils/Constants.cjs.map +1 -1
  160. package/dist/utils/Constants.d.ts +86 -96
  161. package/dist/utils/Constants.d.ts.map +1 -1
  162. package/dist/utils/Constants.mjs +81 -90
  163. package/dist/utils/Constants.mjs.map +1 -1
  164. package/dist/utils/EncodingUtils.cjs +44 -44
  165. package/dist/utils/EncodingUtils.cjs.map +1 -1
  166. package/dist/utils/EncodingUtils.d.ts +26 -26
  167. package/dist/utils/EncodingUtils.mjs +44 -44
  168. package/dist/utils/EncodingUtils.mjs.map +1 -1
  169. package/dist/utils/NetworkUtils.cjs +38 -38
  170. package/dist/utils/NetworkUtils.cjs.map +1 -1
  171. package/dist/utils/NetworkUtils.d.ts +5 -5
  172. package/dist/utils/NetworkUtils.mjs +38 -38
  173. package/dist/utils/NetworkUtils.mjs.map +1 -1
  174. package/package.json +8 -5
  175. package/src/cache/ITokenCache.ts +24 -0
  176. package/src/cache/NodeStorage.ts +533 -0
  177. package/src/cache/TokenCache.ts +358 -0
  178. package/src/cache/distributed/DistributedCachePlugin.ts +56 -0
  179. package/src/cache/distributed/ICacheClient.ts +23 -0
  180. package/src/cache/distributed/IPartitionManager.ts +35 -0
  181. package/src/cache/serializer/Deserializer.ts +218 -0
  182. package/src/cache/serializer/Serializer.ts +173 -0
  183. package/src/cache/serializer/SerializerTypes.ts +121 -0
  184. package/src/client/ClientApplication.ts +596 -0
  185. package/src/client/ClientAssertion.ts +165 -0
  186. package/src/client/ClientCredentialClient.ts +346 -0
  187. package/src/client/ConfidentialClientApplication.ts +268 -0
  188. package/src/client/DeviceCodeClient.ts +369 -0
  189. package/src/client/IConfidentialClientApplication.ts +72 -0
  190. package/src/client/IPublicClientApplication.ts +72 -0
  191. package/src/client/OnBehalfOfClient.ts +368 -0
  192. package/src/client/PublicClientApplication.ts +339 -0
  193. package/src/client/UsernamePasswordClient.ts +180 -0
  194. package/src/config/Configuration.ts +201 -0
  195. package/src/crypto/CryptoProvider.ts +98 -0
  196. package/src/crypto/GuidGenerator.ts +28 -0
  197. package/src/crypto/HashUtils.ts +17 -0
  198. package/src/crypto/PkceGenerator.ts +63 -0
  199. package/src/error/NodeAuthError.ts +117 -0
  200. package/src/index.ts +125 -0
  201. package/src/internals.ts +12 -0
  202. package/src/network/HttpClient.ts +425 -0
  203. package/src/network/ILoopbackClient.ts +19 -0
  204. package/src/network/LoopbackClient.ts +110 -0
  205. package/src/packageMetadata.ts +3 -0
  206. package/src/request/AuthorizationCodeRequest.ts +39 -0
  207. package/src/request/AuthorizationUrlRequest.ts +50 -0
  208. package/src/request/ClientCredentialRequest.ts +29 -0
  209. package/src/request/DeviceCodeRequest.ts +34 -0
  210. package/src/request/InteractiveRequest.ts +39 -0
  211. package/src/request/OnBehalfOfRequest.ts +30 -0
  212. package/src/request/RefreshTokenRequest.ts +34 -0
  213. package/src/request/SignOutRequest.ts +11 -0
  214. package/src/request/SilentFlowRequest.ts +32 -0
  215. package/src/request/UsernamePasswordRequest.ts +36 -0
  216. package/src/utils/Constants.ts +103 -0
  217. package/src/utils/EncodingUtils.ts +50 -0
  218. package/src/utils/NetworkUtils.ts +49 -0
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-node v2.0.2 2023-08-18 */
1
+ /*! @azure/msal-node v2.2.0-alpha.0 2023-09-20 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -9,169 +9,168 @@ var msalCommon = require('@azure/msal-common');
9
9
  var ClientCredentialClient = require('./ClientCredentialClient.cjs');
10
10
  var OnBehalfOfClient = require('./OnBehalfOfClient.cjs');
11
11
 
12
- /*
13
- * Copyright (c) Microsoft Corporation. All rights reserved.
14
- * Licensed under the MIT License.
15
- */
16
- // AADAuthorityConstants
17
- /**
18
- * This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
19
- * will configure application secrets, client certificates/assertions as applicable
20
- * @public
21
- */
22
- class ConfidentialClientApplication extends ClientApplication.ClientApplication {
23
- /**
24
- * Constructor for the ConfidentialClientApplication
25
- *
26
- * Required attributes in the Configuration object are:
27
- * - clientID: the application ID of your application. You can obtain one by registering your application with our application registration portal
28
- * - authority: the authority URL for your application.
29
- * - client credential: Must set either client secret, certificate, or assertion for confidential clients. You can obtain a client secret from the application registration portal.
30
- *
31
- * In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
32
- * If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
33
- * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
34
- * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
35
- * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
36
- *
37
- * In Azure B2C, authority is of the form https://\{instance\}/tfp/\{tenant\}/\{policyName\}/
38
- * Full B2C functionality will be available in this library in future versions.
39
- *
40
- * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
41
- */
42
- constructor(configuration) {
43
- super(configuration);
44
- this.setClientCredential(this.config);
45
- this.appTokenProvider = undefined;
46
- }
47
- /**
48
- * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
49
- * is meant for Azure SDK to enhance Managed Identity support.
50
- *
51
- * @param IAppTokenProvider - Extensibility interface, which allows the app developer to return a token from a custom source.
52
- */
53
- SetAppTokenProvider(provider) {
54
- this.appTokenProvider = provider;
55
- }
56
- /**
57
- * Acquires tokens from the authority for the application (not for an end user).
58
- */
59
- async acquireTokenByClientCredential(request) {
60
- this.logger.info("acquireTokenByClientCredential called", request.correlationId);
61
- // If there is a client assertion present in the request, it overrides the one present in the client configuration
62
- let clientAssertion;
63
- if (request.clientAssertion) {
64
- clientAssertion = {
65
- assertion: request.clientAssertion,
66
- assertionType: Constants.Constants.JWT_BEARER_ASSERTION_TYPE,
67
- };
68
- }
69
- const baseRequest = await this.initializeBaseRequest(request);
70
- // valid base request should not contain oidc scopes in this grant type
71
- const validBaseRequest = {
72
- ...baseRequest,
73
- scopes: baseRequest.scopes.filter((scope) => !msalCommon.OIDC_DEFAULT_SCOPES.includes(scope)),
74
- };
75
- const validRequest = {
76
- ...request,
77
- ...validBaseRequest,
78
- clientAssertion,
79
- };
80
- /*
81
- * valid request should not have "common" or "organizations" in lieu of the tenant_id in the authority in the auth configuration
82
- * example authority: "https://login.microsoftonline.com/TenantId",
83
- */
84
- const authority = new msalCommon.UrlString(validRequest.authority);
85
- const tenantId = authority.getUrlComponents().PathSegments[0];
86
- if (Object.values(msalCommon.AADAuthorityConstants).includes(tenantId)) {
87
- throw msalCommon.ClientAuthError.createMissingTenantIdError();
88
- }
89
- const azureRegionConfiguration = {
90
- azureRegion: validRequest.azureRegion,
91
- environmentRegion: process.env[Constants.REGION_ENVIRONMENT_VARIABLE],
92
- };
93
- const serverTelemetryManager = this.initializeServerTelemetryManager(Constants.ApiId.acquireTokenByClientCredential, validRequest.correlationId, validRequest.skipCache);
94
- try {
95
- const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, azureRegionConfiguration, request.azureCloudOptions);
96
- const clientCredentialClient = new ClientCredentialClient.ClientCredentialClient(clientCredentialConfig, this.appTokenProvider);
97
- this.logger.verbose("Client credential client created", validRequest.correlationId);
98
- return clientCredentialClient.acquireToken(validRequest);
99
- }
100
- catch (e) {
101
- if (e instanceof msalCommon.AuthError) {
102
- e.setCorrelationId(validRequest.correlationId);
103
- }
104
- serverTelemetryManager.cacheFailedRequest(e);
105
- throw e;
106
- }
107
- }
108
- /**
109
- * Acquires tokens from the authority for the application.
110
- *
111
- * Used in scenarios where the current app is a middle-tier service which was called with a token
112
- * representing an end user. The current app can use the token (oboAssertion) to request another
113
- * token to access downstream web API, on behalf of that user.
114
- *
115
- * The current middle-tier app has no user interaction to obtain consent.
116
- * See how to gain consent upfront for your middle-tier app from this article.
117
- * https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#gaining-consent-for-the-middle-tier-application
118
- */
119
- async acquireTokenOnBehalfOf(request) {
120
- this.logger.info("acquireTokenOnBehalfOf called", request.correlationId);
121
- const validRequest = {
122
- ...request,
123
- ...(await this.initializeBaseRequest(request)),
124
- };
125
- try {
126
- const onBehalfOfConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, undefined, undefined, request.azureCloudOptions);
127
- const oboClient = new OnBehalfOfClient.OnBehalfOfClient(onBehalfOfConfig);
128
- this.logger.verbose("On behalf of client created", validRequest.correlationId);
129
- return oboClient.acquireToken(validRequest);
130
- }
131
- catch (e) {
132
- if (e instanceof msalCommon.AuthError) {
133
- e.setCorrelationId(validRequest.correlationId);
134
- }
135
- throw e;
136
- }
137
- }
138
- setClientCredential(configuration) {
139
- const clientSecretNotEmpty = !msalCommon.StringUtils.isEmpty(configuration.auth.clientSecret);
140
- const clientAssertionNotEmpty = !msalCommon.StringUtils.isEmpty(configuration.auth.clientAssertion);
141
- const certificate = configuration.auth.clientCertificate || {
142
- thumbprint: msalCommon.Constants.EMPTY_STRING,
143
- privateKey: msalCommon.Constants.EMPTY_STRING,
144
- };
145
- const certificateNotEmpty = !msalCommon.StringUtils.isEmpty(certificate.thumbprint) ||
146
- !msalCommon.StringUtils.isEmpty(certificate.privateKey);
147
- /*
148
- * If app developer configures this callback, they don't need a credential
149
- * i.e. AzureSDK can get token from Managed Identity without a cert / secret
150
- */
151
- if (this.appTokenProvider) {
152
- return;
153
- }
154
- // Check that at most one credential is set on the application
155
- if ((clientSecretNotEmpty && clientAssertionNotEmpty) ||
156
- (clientAssertionNotEmpty && certificateNotEmpty) ||
157
- (clientSecretNotEmpty && certificateNotEmpty)) {
158
- throw msalCommon.ClientAuthError.createInvalidCredentialError();
159
- }
160
- if (configuration.auth.clientSecret) {
161
- this.clientSecret = configuration.auth.clientSecret;
162
- return;
163
- }
164
- if (configuration.auth.clientAssertion) {
165
- this.clientAssertion = ClientAssertion.ClientAssertion.fromAssertion(configuration.auth.clientAssertion);
166
- return;
167
- }
168
- if (!certificateNotEmpty) {
169
- throw msalCommon.ClientAuthError.createInvalidCredentialError();
170
- }
171
- else {
172
- this.clientAssertion = ClientAssertion.ClientAssertion.fromCertificate(certificate.thumbprint, certificate.privateKey, configuration.auth.clientCertificate?.x5c);
173
- }
174
- }
12
+ /*
13
+ * Copyright (c) Microsoft Corporation. All rights reserved.
14
+ * Licensed under the MIT License.
15
+ */
16
+ // AADAuthorityConstants
17
+ /**
18
+ * This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
19
+ * will configure application secrets, client certificates/assertions as applicable
20
+ * @public
21
+ */
22
+ class ConfidentialClientApplication extends ClientApplication.ClientApplication {
23
+ /**
24
+ * Constructor for the ConfidentialClientApplication
25
+ *
26
+ * Required attributes in the Configuration object are:
27
+ * - clientID: the application ID of your application. You can obtain one by registering your application with our application registration portal
28
+ * - authority: the authority URL for your application.
29
+ * - client credential: Must set either client secret, certificate, or assertion for confidential clients. You can obtain a client secret from the application registration portal.
30
+ *
31
+ * In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
32
+ * If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
33
+ * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
34
+ * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
35
+ * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
36
+ *
37
+ * In Azure B2C, authority is of the form https://\{instance\}/tfp/\{tenant\}/\{policyName\}/
38
+ * Full B2C functionality will be available in this library in future versions.
39
+ *
40
+ * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
41
+ */
42
+ constructor(configuration) {
43
+ super(configuration);
44
+ this.setClientCredential(this.config);
45
+ this.appTokenProvider = undefined;
46
+ }
47
+ /**
48
+ * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
49
+ * is meant for Azure SDK to enhance Managed Identity support.
50
+ *
51
+ * @param IAppTokenProvider - Extensibility interface, which allows the app developer to return a token from a custom source.
52
+ */
53
+ SetAppTokenProvider(provider) {
54
+ this.appTokenProvider = provider;
55
+ }
56
+ /**
57
+ * Acquires tokens from the authority for the application (not for an end user).
58
+ */
59
+ async acquireTokenByClientCredential(request) {
60
+ this.logger.info("acquireTokenByClientCredential called", request.correlationId);
61
+ // If there is a client assertion present in the request, it overrides the one present in the client configuration
62
+ let clientAssertion;
63
+ if (request.clientAssertion) {
64
+ clientAssertion = {
65
+ assertion: request.clientAssertion,
66
+ assertionType: Constants.Constants.JWT_BEARER_ASSERTION_TYPE,
67
+ };
68
+ }
69
+ const baseRequest = await this.initializeBaseRequest(request);
70
+ // valid base request should not contain oidc scopes in this grant type
71
+ const validBaseRequest = {
72
+ ...baseRequest,
73
+ scopes: baseRequest.scopes.filter((scope) => !msalCommon.OIDC_DEFAULT_SCOPES.includes(scope)),
74
+ };
75
+ const validRequest = {
76
+ ...request,
77
+ ...validBaseRequest,
78
+ clientAssertion,
79
+ };
80
+ /*
81
+ * valid request should not have "common" or "organizations" in lieu of the tenant_id in the authority in the auth configuration
82
+ * example authority: "https://login.microsoftonline.com/TenantId",
83
+ */
84
+ const authority = new msalCommon.UrlString(validRequest.authority);
85
+ const tenantId = authority.getUrlComponents().PathSegments[0];
86
+ if (Object.values(msalCommon.AADAuthorityConstants).includes(tenantId)) {
87
+ throw msalCommon.createClientAuthError(msalCommon.ClientAuthErrorCodes.missingTenantIdError);
88
+ }
89
+ const azureRegionConfiguration = {
90
+ azureRegion: validRequest.azureRegion,
91
+ environmentRegion: process.env[Constants.REGION_ENVIRONMENT_VARIABLE],
92
+ };
93
+ const serverTelemetryManager = this.initializeServerTelemetryManager(Constants.ApiId.acquireTokenByClientCredential, validRequest.correlationId, validRequest.skipCache);
94
+ try {
95
+ const clientCredentialConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, azureRegionConfiguration, request.azureCloudOptions);
96
+ const clientCredentialClient = new ClientCredentialClient.ClientCredentialClient(clientCredentialConfig, this.appTokenProvider);
97
+ this.logger.verbose("Client credential client created", validRequest.correlationId);
98
+ return clientCredentialClient.acquireToken(validRequest);
99
+ }
100
+ catch (e) {
101
+ if (e instanceof msalCommon.AuthError) {
102
+ e.setCorrelationId(validRequest.correlationId);
103
+ }
104
+ serverTelemetryManager.cacheFailedRequest(e);
105
+ throw e;
106
+ }
107
+ }
108
+ /**
109
+ * Acquires tokens from the authority for the application.
110
+ *
111
+ * Used in scenarios where the current app is a middle-tier service which was called with a token
112
+ * representing an end user. The current app can use the token (oboAssertion) to request another
113
+ * token to access downstream web API, on behalf of that user.
114
+ *
115
+ * The current middle-tier app has no user interaction to obtain consent.
116
+ * See how to gain consent upfront for your middle-tier app from this article.
117
+ * https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#gaining-consent-for-the-middle-tier-application
118
+ */
119
+ async acquireTokenOnBehalfOf(request) {
120
+ this.logger.info("acquireTokenOnBehalfOf called", request.correlationId);
121
+ const validRequest = {
122
+ ...request,
123
+ ...(await this.initializeBaseRequest(request)),
124
+ };
125
+ try {
126
+ const onBehalfOfConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, undefined, undefined, request.azureCloudOptions);
127
+ const oboClient = new OnBehalfOfClient.OnBehalfOfClient(onBehalfOfConfig);
128
+ this.logger.verbose("On behalf of client created", validRequest.correlationId);
129
+ return oboClient.acquireToken(validRequest);
130
+ }
131
+ catch (e) {
132
+ if (e instanceof msalCommon.AuthError) {
133
+ e.setCorrelationId(validRequest.correlationId);
134
+ }
135
+ throw e;
136
+ }
137
+ }
138
+ setClientCredential(configuration) {
139
+ const clientSecretNotEmpty = !!configuration.auth.clientSecret;
140
+ const clientAssertionNotEmpty = !!configuration.auth.clientAssertion;
141
+ const certificate = configuration.auth.clientCertificate || {
142
+ thumbprint: msalCommon.Constants.EMPTY_STRING,
143
+ privateKey: msalCommon.Constants.EMPTY_STRING,
144
+ };
145
+ const certificateNotEmpty = !!certificate.thumbprint || !!certificate.privateKey;
146
+ /*
147
+ * If app developer configures this callback, they don't need a credential
148
+ * i.e. AzureSDK can get token from Managed Identity without a cert / secret
149
+ */
150
+ if (this.appTokenProvider) {
151
+ return;
152
+ }
153
+ // Check that at most one credential is set on the application
154
+ if ((clientSecretNotEmpty && clientAssertionNotEmpty) ||
155
+ (clientAssertionNotEmpty && certificateNotEmpty) ||
156
+ (clientSecretNotEmpty && certificateNotEmpty)) {
157
+ throw msalCommon.createClientAuthError(msalCommon.ClientAuthErrorCodes.invalidClientCredential);
158
+ }
159
+ if (configuration.auth.clientSecret) {
160
+ this.clientSecret = configuration.auth.clientSecret;
161
+ return;
162
+ }
163
+ if (configuration.auth.clientAssertion) {
164
+ this.clientAssertion = ClientAssertion.ClientAssertion.fromAssertion(configuration.auth.clientAssertion);
165
+ return;
166
+ }
167
+ if (!certificateNotEmpty) {
168
+ throw msalCommon.createClientAuthError(msalCommon.ClientAuthErrorCodes.invalidClientCredential);
169
+ }
170
+ else {
171
+ this.clientAssertion = ClientAssertion.ClientAssertion.fromCertificate(certificate.thumbprint, certificate.privateKey, configuration.auth.clientCertificate?.x5c);
172
+ }
173
+ }
175
174
  }
176
175
 
177
176
  exports.ConfidentialClientApplication = ConfidentialClientApplication;
@@ -1 +1 @@
1
- {"version":3,"file":"ConfidentialClientApplication.cjs","sources":["../../src/client/ConfidentialClientApplication.ts"],"sourcesContent":[null],"names":["ClientApplication","NodeConstants","OIDC_DEFAULT_SCOPES","UrlString","AADAuthorityConstants","ClientAuthError","REGION_ENVIRONMENT_VARIABLE","ApiId","ClientCredentialClient","AuthError","OnBehalfOfClient","StringUtils","Constants","ClientAssertion"],"mappings":";;;;;;;;;;;AAAA;;;AAGG;AAEH;AA8BA;;;;AAIG;AACG,MAAO,6BACT,SAAQA,mCAAiB,CAAA;AAKzB;;;;;;;;;;;;;;;;;;AAkBG;AACH,IAAA,WAAA,CAAY,aAA4B,EAAA;QACpC,KAAK,CAAC,aAAa,CAAC,CAAC;AACrB,QAAA,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACtC,QAAA,IAAI,CAAC,gBAAgB,GAAG,SAAS,CAAC;KACrC;AAED;;;;;AAKG;AACH,IAAA,mBAAmB,CAAC,QAA2B,EAAA;AAC3C,QAAA,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC;KACpC;AAED;;AAEG;IACI,MAAM,8BAA8B,CACvC,OAAgC,EAAA;QAEhC,IAAI,CAAC,MAAM,CAAC,IAAI,CACZ,uCAAuC,EACvC,OAAO,CAAC,aAAa,CACxB,CAAC;;AAGF,QAAA,IAA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AO;AACV,SAAA;AAED,QAAA,IAAI,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE;AACpC,YAAA,IAAI,CAAC,eAAe,GAAGQ,+BAAe,CAAC,aAAa,CAChD,aAAa,CAAC,IAAI,CAAC,eAAe,CACrC,CAAC;YACF,OAAO;AACV,SAAA;QAED,IAAI,CAAC,mBAAmB,EAAE;AACtB,YAAA,MAAMR,0BAAe,CAAC,4BAA4B,EAAE,CAAC;AACxD,SAAA;AAAM,aAAA;YACH,IAAI,CAAC,eAAe,GAAGQ,+BAAe,CAAC,eAAe,CAClD,WAAW,CAAC,UAAU,EACtB,WAAW,CAAC,UAAU,EACtB,aAAa,CAAC,IAAI,CAAC,iBAAiB,EAAE,GAAG,CAC5C,CAAC;AACL,SAAA;KACJ;AACJ;;;;"}
1
+ {"version":3,"file":"ConfidentialClientApplication.cjs","sources":["../../src/client/ConfidentialClientApplication.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;AAOA;AACA;AAOA;AAcA;AACA;AAUA;;AAMI;;;;;;;;;;;;;;;;;;AAkBG;AACS;AAMZ;;;;;AAKG,QAAA,IAAA,CAAA,mBAAA,CAAA,IAAA,CAAA,MAAA,CAAA,CAAA;AACH,QAAA,IAAA,CAAA,gBAAoB,GAAQ,SAAE,CAAA;AAI9B,KAAA;;AAEG;;AAuFH;;;;;;;;;;AAUG,QAAA,IAAA,CAAA,MAAA,CAAA,IAAA,CAAA,uCAAA,EAAA,OAAA,CAAA,aAAA,CAAA,CAAA;;AAkCH,QAAA,IAAQ,eAAmB,CAAA;AAqD9B,QAAA,IAAA,OAAA,CAAA,eAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,59 +1,59 @@
1
- import { ClientApplication } from "./ClientApplication";
2
- import { Configuration } from "../config/Configuration";
3
- import { AuthenticationResult, IAppTokenProvider } from "@azure/msal-common";
4
- import { IConfidentialClientApplication } from "./IConfidentialClientApplication";
5
- import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest";
6
- import { ClientCredentialRequest } from "../request/ClientCredentialRequest";
7
- /**
8
- * This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
9
- * will configure application secrets, client certificates/assertions as applicable
10
- * @public
11
- */
12
- export declare class ConfidentialClientApplication extends ClientApplication implements IConfidentialClientApplication {
13
- private appTokenProvider?;
14
- /**
15
- * Constructor for the ConfidentialClientApplication
16
- *
17
- * Required attributes in the Configuration object are:
18
- * - clientID: the application ID of your application. You can obtain one by registering your application with our application registration portal
19
- * - authority: the authority URL for your application.
20
- * - client credential: Must set either client secret, certificate, or assertion for confidential clients. You can obtain a client secret from the application registration portal.
21
- *
22
- * In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
23
- * If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
24
- * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
25
- * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
26
- * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
27
- *
28
- * In Azure B2C, authority is of the form https://\{instance\}/tfp/\{tenant\}/\{policyName\}/
29
- * Full B2C functionality will be available in this library in future versions.
30
- *
31
- * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
32
- */
33
- constructor(configuration: Configuration);
34
- /**
35
- * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
36
- * is meant for Azure SDK to enhance Managed Identity support.
37
- *
38
- * @param IAppTokenProvider - Extensibility interface, which allows the app developer to return a token from a custom source.
39
- */
40
- SetAppTokenProvider(provider: IAppTokenProvider): void;
41
- /**
42
- * Acquires tokens from the authority for the application (not for an end user).
43
- */
44
- acquireTokenByClientCredential(request: ClientCredentialRequest): Promise<AuthenticationResult | null>;
45
- /**
46
- * Acquires tokens from the authority for the application.
47
- *
48
- * Used in scenarios where the current app is a middle-tier service which was called with a token
49
- * representing an end user. The current app can use the token (oboAssertion) to request another
50
- * token to access downstream web API, on behalf of that user.
51
- *
52
- * The current middle-tier app has no user interaction to obtain consent.
53
- * See how to gain consent upfront for your middle-tier app from this article.
54
- * https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#gaining-consent-for-the-middle-tier-application
55
- */
56
- acquireTokenOnBehalfOf(request: OnBehalfOfRequest): Promise<AuthenticationResult | null>;
57
- private setClientCredential;
58
- }
1
+ import { ClientApplication } from "./ClientApplication.js";
2
+ import { Configuration } from "../config/Configuration.js";
3
+ import { AuthenticationResult, IAppTokenProvider } from "@azure/msal-common";
4
+ import { IConfidentialClientApplication } from "./IConfidentialClientApplication.js";
5
+ import { OnBehalfOfRequest } from "../request/OnBehalfOfRequest.js";
6
+ import { ClientCredentialRequest } from "../request/ClientCredentialRequest.js";
7
+ /**
8
+ * This class is to be used to acquire tokens for confidential client applications (webApp, webAPI). Confidential client applications
9
+ * will configure application secrets, client certificates/assertions as applicable
10
+ * @public
11
+ */
12
+ export declare class ConfidentialClientApplication extends ClientApplication implements IConfidentialClientApplication {
13
+ private appTokenProvider?;
14
+ /**
15
+ * Constructor for the ConfidentialClientApplication
16
+ *
17
+ * Required attributes in the Configuration object are:
18
+ * - clientID: the application ID of your application. You can obtain one by registering your application with our application registration portal
19
+ * - authority: the authority URL for your application.
20
+ * - client credential: Must set either client secret, certificate, or assertion for confidential clients. You can obtain a client secret from the application registration portal.
21
+ *
22
+ * In Azure AD, authority is a URL indicating of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
23
+ * If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
24
+ * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
25
+ * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
26
+ * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
27
+ *
28
+ * In Azure B2C, authority is of the form https://\{instance\}/tfp/\{tenant\}/\{policyName\}/
29
+ * Full B2C functionality will be available in this library in future versions.
30
+ *
31
+ * @param Configuration - configuration object for the MSAL ConfidentialClientApplication instance
32
+ */
33
+ constructor(configuration: Configuration);
34
+ /**
35
+ * This extensibility point only works for the client_credential flow, i.e. acquireTokenByClientCredential and
36
+ * is meant for Azure SDK to enhance Managed Identity support.
37
+ *
38
+ * @param IAppTokenProvider - Extensibility interface, which allows the app developer to return a token from a custom source.
39
+ */
40
+ SetAppTokenProvider(provider: IAppTokenProvider): void;
41
+ /**
42
+ * Acquires tokens from the authority for the application (not for an end user).
43
+ */
44
+ acquireTokenByClientCredential(request: ClientCredentialRequest): Promise<AuthenticationResult | null>;
45
+ /**
46
+ * Acquires tokens from the authority for the application.
47
+ *
48
+ * Used in scenarios where the current app is a middle-tier service which was called with a token
49
+ * representing an end user. The current app can use the token (oboAssertion) to request another
50
+ * token to access downstream web API, on behalf of that user.
51
+ *
52
+ * The current middle-tier app has no user interaction to obtain consent.
53
+ * See how to gain consent upfront for your middle-tier app from this article.
54
+ * https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-on-behalf-of-flow#gaining-consent-for-the-middle-tier-application
55
+ */
56
+ acquireTokenOnBehalfOf(request: OnBehalfOfRequest): Promise<AuthenticationResult | null>;
57
+ private setClientCredential;
58
+ }
59
59
  //# sourceMappingURL=ConfidentialClientApplication.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConfidentialClientApplication.d.ts","sourceRoot":"","sources":["../../src/client/ConfidentialClientApplication.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,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