@azure/msal-node 2.12.0 → 2.13.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 (197) hide show
  1. package/dist/cache/ITokenCache.d.ts +15 -15
  2. package/dist/cache/NodeStorage.cjs +425 -423
  3. package/dist/cache/NodeStorage.cjs.map +1 -1
  4. package/dist/cache/NodeStorage.d.ts +193 -193
  5. package/dist/cache/NodeStorage.mjs +423 -423
  6. package/dist/cache/TokenCache.cjs +267 -265
  7. package/dist/cache/TokenCache.cjs.map +1 -1
  8. package/dist/cache/TokenCache.d.ts +90 -90
  9. package/dist/cache/TokenCache.mjs +265 -265
  10. package/dist/cache/distributed/DistributedCachePlugin.cjs +28 -26
  11. package/dist/cache/distributed/DistributedCachePlugin.cjs.map +1 -1
  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 +169 -167
  17. package/dist/cache/serializer/Deserializer.cjs.map +1 -1
  18. package/dist/cache/serializer/Deserializer.d.ts +42 -42
  19. package/dist/cache/serializer/Deserializer.mjs +167 -167
  20. package/dist/cache/serializer/Serializer.cjs +139 -137
  21. package/dist/cache/serializer/Serializer.cjs.map +1 -1
  22. package/dist/cache/serializer/Serializer.d.ts +39 -39
  23. package/dist/cache/serializer/Serializer.mjs +137 -137
  24. package/dist/cache/serializer/SerializerTypes.d.ts +102 -102
  25. package/dist/client/ClientApplication.cjs +336 -334
  26. package/dist/client/ClientApplication.cjs.map +1 -1
  27. package/dist/client/ClientApplication.d.ts +143 -143
  28. package/dist/client/ClientApplication.mjs +334 -334
  29. package/dist/client/ClientAssertion.cjs +149 -143
  30. package/dist/client/ClientAssertion.cjs.map +1 -1
  31. package/dist/client/ClientAssertion.d.ts +55 -55
  32. package/dist/client/ClientAssertion.mjs +143 -143
  33. package/dist/client/ClientCredentialClient.cjs +196 -194
  34. package/dist/client/ClientCredentialClient.cjs.map +1 -1
  35. package/dist/client/ClientCredentialClient.d.ts +33 -33
  36. package/dist/client/ClientCredentialClient.mjs +194 -194
  37. package/dist/client/ConfidentialClientApplication.cjs +170 -169
  38. package/dist/client/ConfidentialClientApplication.cjs.map +1 -1
  39. package/dist/client/ConfidentialClientApplication.d.ts +58 -58
  40. package/dist/client/ConfidentialClientApplication.mjs +168 -169
  41. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  42. package/dist/client/DeviceCodeClient.cjs +209 -207
  43. package/dist/client/DeviceCodeClient.cjs.map +1 -1
  44. package/dist/client/DeviceCodeClient.d.ts +53 -53
  45. package/dist/client/DeviceCodeClient.mjs +207 -207
  46. package/dist/client/IConfidentialClientApplication.d.ts +39 -39
  47. package/dist/client/IPublicClientApplication.d.ts +42 -42
  48. package/dist/client/ManagedIdentityApplication.cjs +86 -84
  49. package/dist/client/ManagedIdentityApplication.cjs.map +1 -1
  50. package/dist/client/ManagedIdentityApplication.d.ts +30 -30
  51. package/dist/client/ManagedIdentityApplication.mjs +84 -84
  52. package/dist/client/ManagedIdentityClient.cjs +62 -60
  53. package/dist/client/ManagedIdentityClient.cjs.map +1 -1
  54. package/dist/client/ManagedIdentityClient.d.ts +27 -27
  55. package/dist/client/ManagedIdentityClient.mjs +60 -60
  56. package/dist/client/ManagedIdentitySources/AppService.cjs +47 -45
  57. package/dist/client/ManagedIdentitySources/AppService.cjs.map +1 -1
  58. package/dist/client/ManagedIdentitySources/AppService.d.ts +17 -17
  59. package/dist/client/ManagedIdentitySources/AppService.mjs +46 -46
  60. package/dist/client/ManagedIdentitySources/AzureArc.cjs +161 -120
  61. package/dist/client/ManagedIdentitySources/AzureArc.cjs.map +1 -1
  62. package/dist/client/ManagedIdentitySources/AzureArc.d.ts +27 -23
  63. package/dist/client/ManagedIdentitySources/AzureArc.d.ts.map +1 -1
  64. package/dist/client/ManagedIdentitySources/AzureArc.mjs +155 -122
  65. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  66. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs +124 -122
  67. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.cjs.map +1 -1
  68. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.d.ts +30 -30
  69. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +122 -122
  70. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  71. package/dist/client/ManagedIdentitySources/CloudShell.cjs +40 -38
  72. package/dist/client/ManagedIdentitySources/CloudShell.cjs.map +1 -1
  73. package/dist/client/ManagedIdentitySources/CloudShell.d.ts +16 -16
  74. package/dist/client/ManagedIdentitySources/CloudShell.mjs +39 -39
  75. package/dist/client/ManagedIdentitySources/Imds.cjs +45 -43
  76. package/dist/client/ManagedIdentitySources/Imds.cjs.map +1 -1
  77. package/dist/client/ManagedIdentitySources/Imds.d.ts +12 -12
  78. package/dist/client/ManagedIdentitySources/Imds.mjs +44 -44
  79. package/dist/client/ManagedIdentitySources/ServiceFabric.cjs +56 -54
  80. package/dist/client/ManagedIdentitySources/ServiceFabric.cjs.map +1 -1
  81. package/dist/client/ManagedIdentitySources/ServiceFabric.d.ts +17 -17
  82. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +55 -55
  83. package/dist/client/OnBehalfOfClient.cjs +204 -202
  84. package/dist/client/OnBehalfOfClient.cjs.map +1 -1
  85. package/dist/client/OnBehalfOfClient.d.ts +47 -47
  86. package/dist/client/OnBehalfOfClient.mjs +202 -202
  87. package/dist/client/PublicClientApplication.cjs +239 -237
  88. package/dist/client/PublicClientApplication.cjs.map +1 -1
  89. package/dist/client/PublicClientApplication.d.ts +72 -72
  90. package/dist/client/PublicClientApplication.mjs +237 -237
  91. package/dist/client/UsernamePasswordClient.cjs +97 -95
  92. package/dist/client/UsernamePasswordClient.cjs.map +1 -1
  93. package/dist/client/UsernamePasswordClient.d.ts +25 -25
  94. package/dist/client/UsernamePasswordClient.mjs +95 -95
  95. package/dist/config/Configuration.cjs +108 -106
  96. package/dist/config/Configuration.cjs.map +1 -1
  97. package/dist/config/Configuration.d.ts +131 -131
  98. package/dist/config/Configuration.mjs +106 -106
  99. package/dist/config/ManagedIdentityId.cjs +50 -48
  100. package/dist/config/ManagedIdentityId.cjs.map +1 -1
  101. package/dist/config/ManagedIdentityId.d.ts +11 -11
  102. package/dist/config/ManagedIdentityId.mjs +48 -48
  103. package/dist/config/ManagedIdentityRequestParameters.cjs +30 -28
  104. package/dist/config/ManagedIdentityRequestParameters.cjs.map +1 -1
  105. package/dist/config/ManagedIdentityRequestParameters.d.ts +11 -11
  106. package/dist/config/ManagedIdentityRequestParameters.mjs +28 -28
  107. package/dist/crypto/CryptoProvider.cjs +91 -89
  108. package/dist/crypto/CryptoProvider.cjs.map +1 -1
  109. package/dist/crypto/CryptoProvider.d.ts +62 -62
  110. package/dist/crypto/CryptoProvider.mjs +89 -89
  111. package/dist/crypto/GuidGenerator.cjs +24 -22
  112. package/dist/crypto/GuidGenerator.cjs.map +1 -1
  113. package/dist/crypto/GuidGenerator.d.ts +14 -14
  114. package/dist/crypto/GuidGenerator.mjs +22 -22
  115. package/dist/crypto/HashUtils.cjs +19 -13
  116. package/dist/crypto/HashUtils.cjs.map +1 -1
  117. package/dist/crypto/HashUtils.d.ts +8 -8
  118. package/dist/crypto/HashUtils.mjs +13 -13
  119. package/dist/crypto/PkceGenerator.cjs +55 -49
  120. package/dist/crypto/PkceGenerator.cjs.map +1 -1
  121. package/dist/crypto/PkceGenerator.d.ts +22 -22
  122. package/dist/crypto/PkceGenerator.mjs +49 -49
  123. package/dist/error/ManagedIdentityError.cjs +43 -41
  124. package/dist/error/ManagedIdentityError.cjs.map +1 -1
  125. package/dist/error/ManagedIdentityError.d.ts +30 -30
  126. package/dist/error/ManagedIdentityError.mjs +41 -41
  127. package/dist/error/ManagedIdentityErrorCodes.cjs +26 -24
  128. package/dist/error/ManagedIdentityErrorCodes.cjs.map +1 -1
  129. package/dist/error/ManagedIdentityErrorCodes.d.ts +22 -22
  130. package/dist/error/ManagedIdentityErrorCodes.mjs +24 -24
  131. package/dist/error/NodeAuthError.cjs +97 -95
  132. package/dist/error/NodeAuthError.cjs.map +1 -1
  133. package/dist/error/NodeAuthError.d.ts +73 -73
  134. package/dist/error/NodeAuthError.mjs +95 -95
  135. package/dist/index.cjs +3 -1
  136. package/dist/index.cjs.map +1 -1
  137. package/dist/index.d.ts +45 -45
  138. package/dist/index.mjs +1 -1
  139. package/dist/internals.cjs +6 -8
  140. package/dist/internals.cjs.map +1 -1
  141. package/dist/internals.d.ts +6 -6
  142. package/dist/internals.mjs +4 -8
  143. package/dist/internals.mjs.map +1 -1
  144. package/dist/network/HttpClient.cjs +288 -281
  145. package/dist/network/HttpClient.cjs.map +1 -1
  146. package/dist/network/HttpClient.d.ts +25 -25
  147. package/dist/network/HttpClient.mjs +281 -281
  148. package/dist/network/HttpClientWithRetries.cjs +36 -34
  149. package/dist/network/HttpClientWithRetries.cjs.map +1 -1
  150. package/dist/network/HttpClientWithRetries.d.ts +11 -11
  151. package/dist/network/HttpClientWithRetries.mjs +34 -34
  152. package/dist/network/ILoopbackClient.d.ts +10 -10
  153. package/dist/network/LoopbackClient.cjs +87 -77
  154. package/dist/network/LoopbackClient.cjs.map +1 -1
  155. package/dist/network/LoopbackClient.d.ts +21 -21
  156. package/dist/network/LoopbackClient.d.ts.map +1 -1
  157. package/dist/network/LoopbackClient.mjs +81 -77
  158. package/dist/network/LoopbackClient.mjs.map +1 -1
  159. package/dist/packageMetadata.cjs +6 -4
  160. package/dist/packageMetadata.cjs.map +1 -1
  161. package/dist/packageMetadata.d.ts +2 -2
  162. package/dist/packageMetadata.mjs +4 -4
  163. package/dist/request/AuthorizationCodeRequest.d.ts +21 -21
  164. package/dist/request/AuthorizationUrlRequest.d.ts +33 -33
  165. package/dist/request/ClientCredentialRequest.d.ts +14 -14
  166. package/dist/request/DeviceCodeRequest.d.ts +15 -15
  167. package/dist/request/InteractiveRequest.d.ts +22 -22
  168. package/dist/request/ManagedIdentityRequest.d.ts +8 -8
  169. package/dist/request/ManagedIdentityRequestParams.d.ts +9 -9
  170. package/dist/request/OnBehalfOfRequest.d.ts +14 -14
  171. package/dist/request/RefreshTokenRequest.d.ts +17 -17
  172. package/dist/request/SignOutRequest.d.ts +5 -5
  173. package/dist/request/SilentFlowRequest.d.ts +16 -16
  174. package/dist/request/UsernamePasswordRequest.d.ts +19 -19
  175. package/dist/response/ManagedIdentityTokenResponse.d.ts +34 -34
  176. package/dist/retry/IHttpRetryPolicy.d.ts +5 -5
  177. package/dist/retry/LinearRetryPolicy.cjs +42 -40
  178. package/dist/retry/LinearRetryPolicy.cjs.map +1 -1
  179. package/dist/retry/LinearRetryPolicy.d.ts +11 -11
  180. package/dist/retry/LinearRetryPolicy.mjs +40 -40
  181. package/dist/utils/Constants.cjs +138 -136
  182. package/dist/utils/Constants.cjs.map +1 -1
  183. package/dist/utils/Constants.d.ts +141 -141
  184. package/dist/utils/Constants.mjs +136 -136
  185. package/dist/utils/EncodingUtils.cjs +46 -44
  186. package/dist/utils/EncodingUtils.cjs.map +1 -1
  187. package/dist/utils/EncodingUtils.d.ts +26 -26
  188. package/dist/utils/EncodingUtils.mjs +44 -44
  189. package/dist/utils/NetworkUtils.cjs +40 -38
  190. package/dist/utils/NetworkUtils.cjs.map +1 -1
  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/client/ConfidentialClientApplication.ts +3 -3
  195. package/src/client/ManagedIdentitySources/AzureArc.ts +80 -25
  196. package/src/network/LoopbackClient.ts +6 -0
  197. package/src/packageMetadata.ts +1 -1
@@ -1,7 +1,9 @@
1
- /*! @azure/msal-node v2.12.0 2024-07-23 */
1
+ /*! @azure/msal-node v2.13.0 2024-08-13 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
5
+ Object.defineProperty(exports, '__esModule', { value: true });
6
+
5
7
  var Constants = require('../utils/Constants.cjs');
6
8
  var msalCommon = require('@azure/msal-common');
7
9
  var ClientApplication = require('./ClientApplication.cjs');
@@ -10,242 +12,242 @@ var LoopbackClient = require('../network/LoopbackClient.cjs');
10
12
  var DeviceCodeClient = require('./DeviceCodeClient.cjs');
11
13
  var packageMetadata = require('../packageMetadata.cjs');
12
14
 
13
- /*
14
- * Copyright (c) Microsoft Corporation. All rights reserved.
15
- * Licensed under the MIT License.
16
- */
17
- /**
18
- * This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
19
- * are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
20
- * @public
21
- */
22
- class PublicClientApplication extends ClientApplication.ClientApplication {
23
- /**
24
- * Important attributes in the Configuration object for auth are:
25
- * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal.
26
- * - authority: the authority URL for your application.
27
- *
28
- * AAD authorities are of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
29
- * - 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).
30
- * - If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
31
- * - If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
32
- * - To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
33
- *
34
- * Azure B2C authorities are of the form https://\{instance\}/\{tenant\}/\{policy\}. Each policy is considered
35
- * its own authority. You will have to set the all of the knownAuthorities at the time of the client application
36
- * construction.
37
- *
38
- * ADFS authorities are of the form https://\{instance\}/adfs.
39
- */
40
- constructor(configuration) {
41
- super(configuration);
42
- if (this.config.broker.nativeBrokerPlugin) {
43
- if (this.config.broker.nativeBrokerPlugin.isBrokerAvailable) {
44
- this.nativeBrokerPlugin = this.config.broker.nativeBrokerPlugin;
45
- this.nativeBrokerPlugin.setLogger(this.config.system.loggerOptions);
46
- }
47
- else {
48
- this.logger.warning("NativeBroker implementation was provided but the broker is unavailable.");
49
- }
50
- }
51
- this.skus = msalCommon.ServerTelemetryManager.makeExtraSkuString({
52
- libraryName: Constants.Constants.MSAL_SKU,
53
- libraryVersion: packageMetadata.version,
54
- });
55
- }
56
- /**
57
- * Acquires a token from the authority using OAuth2.0 device code flow.
58
- * This flow is designed for devices that do not have access to a browser or have input constraints.
59
- * The authorization server issues a DeviceCode object with a verification code, an end-user code,
60
- * and the end-user verification URI. The DeviceCode object is provided through a callback, and the end-user should be
61
- * instructed to use another device to navigate to the verification URI to input credentials.
62
- * Since the client cannot receive incoming requests, it polls the authorization server repeatedly
63
- * until the end-user completes input of credentials.
64
- */
65
- async acquireTokenByDeviceCode(request) {
66
- this.logger.info("acquireTokenByDeviceCode called", request.correlationId);
67
- const validRequest = Object.assign(request, await this.initializeBaseRequest(request));
68
- const serverTelemetryManager = this.initializeServerTelemetryManager(Constants.ApiId.acquireTokenByDeviceCode, validRequest.correlationId);
69
- try {
70
- const deviceCodeConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
71
- const deviceCodeClient = new DeviceCodeClient.DeviceCodeClient(deviceCodeConfig);
72
- this.logger.verbose("Device code client created", validRequest.correlationId);
73
- return await deviceCodeClient.acquireToken(validRequest);
74
- }
75
- catch (e) {
76
- if (e instanceof msalCommon.AuthError) {
77
- e.setCorrelationId(validRequest.correlationId);
78
- }
79
- serverTelemetryManager.cacheFailedRequest(e);
80
- throw e;
81
- }
82
- }
83
- /**
84
- * Acquires a token interactively via the browser by requesting an authorization code then exchanging it for a token.
85
- */
86
- async acquireTokenInteractive(request) {
87
- const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
88
- this.logger.trace("acquireTokenInteractive called", correlationId);
89
- const { openBrowser, successTemplate, errorTemplate, windowHandle, loopbackClient: customLoopbackClient, ...remainingProperties } = request;
90
- if (this.nativeBrokerPlugin) {
91
- const brokerRequest = {
92
- ...remainingProperties,
93
- clientId: this.config.auth.clientId,
94
- scopes: request.scopes || msalCommon.OIDC_DEFAULT_SCOPES,
95
- redirectUri: `${Constants.Constants.HTTP_PROTOCOL}${Constants.Constants.LOCALHOST}`,
96
- authority: request.authority || this.config.auth.authority,
97
- correlationId: correlationId,
98
- extraParameters: {
99
- ...remainingProperties.extraQueryParameters,
100
- ...remainingProperties.tokenQueryParameters,
101
- [msalCommon.AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
102
- },
103
- accountId: remainingProperties.account?.nativeAccountId,
104
- };
105
- return this.nativeBrokerPlugin.acquireTokenInteractive(brokerRequest, windowHandle);
106
- }
107
- const { verifier, challenge } = await this.cryptoProvider.generatePkceCodes();
108
- const loopbackClient = customLoopbackClient || new LoopbackClient.LoopbackClient();
109
- let authCodeResponse = {};
110
- let authCodeListenerError = null;
111
- try {
112
- const authCodeListener = loopbackClient
113
- .listenForAuthCode(successTemplate, errorTemplate)
114
- .then((response) => {
115
- authCodeResponse = response;
116
- })
117
- .catch((e) => {
118
- // Store the promise instead of throwing so we can control when its thrown
119
- authCodeListenerError = e;
120
- });
121
- // Wait for server to be listening
122
- const redirectUri = await this.waitForRedirectUri(loopbackClient);
123
- const validRequest = {
124
- ...remainingProperties,
125
- correlationId: correlationId,
126
- scopes: request.scopes || msalCommon.OIDC_DEFAULT_SCOPES,
127
- redirectUri: redirectUri,
128
- responseMode: msalCommon.ResponseMode.QUERY,
129
- codeChallenge: challenge,
130
- codeChallengeMethod: msalCommon.CodeChallengeMethodValues.S256,
131
- };
132
- const authCodeUrl = await this.getAuthCodeUrl(validRequest);
133
- await openBrowser(authCodeUrl);
134
- await authCodeListener;
135
- if (authCodeListenerError) {
136
- throw authCodeListenerError;
137
- }
138
- if (authCodeResponse.error) {
139
- throw new msalCommon.ServerError(authCodeResponse.error, authCodeResponse.error_description, authCodeResponse.suberror);
140
- }
141
- else if (!authCodeResponse.code) {
142
- throw NodeAuthError.NodeAuthError.createNoAuthCodeInResponseError();
143
- }
144
- const clientInfo = authCodeResponse.client_info;
145
- const tokenRequest = {
146
- code: authCodeResponse.code,
147
- codeVerifier: verifier,
148
- clientInfo: clientInfo || msalCommon.Constants.EMPTY_STRING,
149
- ...validRequest,
150
- };
151
- return await this.acquireTokenByCode(tokenRequest); // Await this so the server doesn't close prematurely
152
- }
153
- finally {
154
- loopbackClient.closeServer();
155
- }
156
- }
157
- /**
158
- * Returns a token retrieved either from the cache or by exchanging the refresh token for a fresh access token. If brokering is enabled the token request will be serviced by the broker.
159
- * @param request
160
- * @returns
161
- */
162
- async acquireTokenSilent(request) {
163
- const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
164
- this.logger.trace("acquireTokenSilent called", correlationId);
165
- if (this.nativeBrokerPlugin) {
166
- const brokerRequest = {
167
- ...request,
168
- clientId: this.config.auth.clientId,
169
- scopes: request.scopes || msalCommon.OIDC_DEFAULT_SCOPES,
170
- redirectUri: `${Constants.Constants.HTTP_PROTOCOL}${Constants.Constants.LOCALHOST}`,
171
- authority: request.authority || this.config.auth.authority,
172
- correlationId: correlationId,
173
- extraParameters: {
174
- ...request.tokenQueryParameters,
175
- [msalCommon.AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
176
- },
177
- accountId: request.account.nativeAccountId,
178
- forceRefresh: request.forceRefresh || false,
179
- };
180
- return this.nativeBrokerPlugin.acquireTokenSilent(brokerRequest);
181
- }
182
- return super.acquireTokenSilent(request);
183
- }
184
- /**
185
- * Removes cache artifacts associated with the given account
186
- * @param request
187
- * @returns
188
- */
189
- async signOut(request) {
190
- if (this.nativeBrokerPlugin && request.account.nativeAccountId) {
191
- const signoutRequest = {
192
- clientId: this.config.auth.clientId,
193
- accountId: request.account.nativeAccountId,
194
- correlationId: request.correlationId ||
195
- this.cryptoProvider.createNewGuid(),
196
- };
197
- await this.nativeBrokerPlugin.signOut(signoutRequest);
198
- }
199
- await this.getTokenCache().removeAccount(request.account);
200
- }
201
- /**
202
- * Returns all cached accounts for this application. If brokering is enabled this request will be serviced by the broker.
203
- * @returns
204
- */
205
- async getAllAccounts() {
206
- if (this.nativeBrokerPlugin) {
207
- const correlationId = this.cryptoProvider.createNewGuid();
208
- return this.nativeBrokerPlugin.getAllAccounts(this.config.auth.clientId, correlationId);
209
- }
210
- return this.getTokenCache().getAllAccounts();
211
- }
212
- /**
213
- * Attempts to retrieve the redirectUri from the loopback server. If the loopback server does not start listening for requests within the timeout this will throw.
214
- * @param loopbackClient
215
- * @returns
216
- */
217
- async waitForRedirectUri(loopbackClient) {
218
- return new Promise((resolve, reject) => {
219
- let ticks = 0;
220
- const id = setInterval(() => {
221
- if (Constants.LOOPBACK_SERVER_CONSTANTS.TIMEOUT_MS /
222
- Constants.LOOPBACK_SERVER_CONSTANTS.INTERVAL_MS <
223
- ticks) {
224
- clearInterval(id);
225
- reject(NodeAuthError.NodeAuthError.createLoopbackServerTimeoutError());
226
- return;
227
- }
228
- try {
229
- const r = loopbackClient.getRedirectUri();
230
- clearInterval(id);
231
- resolve(r);
232
- return;
233
- }
234
- catch (e) {
235
- if (e instanceof msalCommon.AuthError &&
236
- e.errorCode ===
237
- NodeAuthError.NodeAuthErrorMessage.noLoopbackServerExists.code) {
238
- // Loopback server is not listening yet
239
- ticks++;
240
- return;
241
- }
242
- clearInterval(id);
243
- reject(e);
244
- return;
245
- }
246
- }, Constants.LOOPBACK_SERVER_CONSTANTS.INTERVAL_MS);
247
- });
248
- }
15
+ /*
16
+ * Copyright (c) Microsoft Corporation. All rights reserved.
17
+ * Licensed under the MIT License.
18
+ */
19
+ /**
20
+ * This class is to be used to acquire tokens for public client applications (desktop, mobile). Public client applications
21
+ * are not trusted to safely store application secrets, and therefore can only request tokens in the name of an user.
22
+ * @public
23
+ */
24
+ class PublicClientApplication extends ClientApplication.ClientApplication {
25
+ /**
26
+ * Important attributes in the Configuration object for auth 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
+ *
30
+ * AAD authorities are of the form https://login.microsoftonline.com/\{Enter_the_Tenant_Info_Here\}.
31
+ * - 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).
32
+ * - If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
33
+ * - If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
34
+ * - To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
35
+ *
36
+ * Azure B2C authorities are of the form https://\{instance\}/\{tenant\}/\{policy\}. Each policy is considered
37
+ * its own authority. You will have to set the all of the knownAuthorities at the time of the client application
38
+ * construction.
39
+ *
40
+ * ADFS authorities are of the form https://\{instance\}/adfs.
41
+ */
42
+ constructor(configuration) {
43
+ super(configuration);
44
+ if (this.config.broker.nativeBrokerPlugin) {
45
+ if (this.config.broker.nativeBrokerPlugin.isBrokerAvailable) {
46
+ this.nativeBrokerPlugin = this.config.broker.nativeBrokerPlugin;
47
+ this.nativeBrokerPlugin.setLogger(this.config.system.loggerOptions);
48
+ }
49
+ else {
50
+ this.logger.warning("NativeBroker implementation was provided but the broker is unavailable.");
51
+ }
52
+ }
53
+ this.skus = msalCommon.ServerTelemetryManager.makeExtraSkuString({
54
+ libraryName: Constants.Constants.MSAL_SKU,
55
+ libraryVersion: packageMetadata.version,
56
+ });
57
+ }
58
+ /**
59
+ * Acquires a token from the authority using OAuth2.0 device code flow.
60
+ * This flow is designed for devices that do not have access to a browser or have input constraints.
61
+ * The authorization server issues a DeviceCode object with a verification code, an end-user code,
62
+ * and the end-user verification URI. The DeviceCode object is provided through a callback, and the end-user should be
63
+ * instructed to use another device to navigate to the verification URI to input credentials.
64
+ * Since the client cannot receive incoming requests, it polls the authorization server repeatedly
65
+ * until the end-user completes input of credentials.
66
+ */
67
+ async acquireTokenByDeviceCode(request) {
68
+ this.logger.info("acquireTokenByDeviceCode called", request.correlationId);
69
+ const validRequest = Object.assign(request, await this.initializeBaseRequest(request));
70
+ const serverTelemetryManager = this.initializeServerTelemetryManager(Constants.ApiId.acquireTokenByDeviceCode, validRequest.correlationId);
71
+ try {
72
+ const deviceCodeConfig = await this.buildOauthClientConfiguration(validRequest.authority, validRequest.correlationId, serverTelemetryManager, undefined, request.azureCloudOptions);
73
+ const deviceCodeClient = new DeviceCodeClient.DeviceCodeClient(deviceCodeConfig);
74
+ this.logger.verbose("Device code client created", validRequest.correlationId);
75
+ return await deviceCodeClient.acquireToken(validRequest);
76
+ }
77
+ catch (e) {
78
+ if (e instanceof msalCommon.AuthError) {
79
+ e.setCorrelationId(validRequest.correlationId);
80
+ }
81
+ serverTelemetryManager.cacheFailedRequest(e);
82
+ throw e;
83
+ }
84
+ }
85
+ /**
86
+ * Acquires a token interactively via the browser by requesting an authorization code then exchanging it for a token.
87
+ */
88
+ async acquireTokenInteractive(request) {
89
+ const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
90
+ this.logger.trace("acquireTokenInteractive called", correlationId);
91
+ const { openBrowser, successTemplate, errorTemplate, windowHandle, loopbackClient: customLoopbackClient, ...remainingProperties } = request;
92
+ if (this.nativeBrokerPlugin) {
93
+ const brokerRequest = {
94
+ ...remainingProperties,
95
+ clientId: this.config.auth.clientId,
96
+ scopes: request.scopes || msalCommon.OIDC_DEFAULT_SCOPES,
97
+ redirectUri: `${Constants.Constants.HTTP_PROTOCOL}${Constants.Constants.LOCALHOST}`,
98
+ authority: request.authority || this.config.auth.authority,
99
+ correlationId: correlationId,
100
+ extraParameters: {
101
+ ...remainingProperties.extraQueryParameters,
102
+ ...remainingProperties.tokenQueryParameters,
103
+ [msalCommon.AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
104
+ },
105
+ accountId: remainingProperties.account?.nativeAccountId,
106
+ };
107
+ return this.nativeBrokerPlugin.acquireTokenInteractive(brokerRequest, windowHandle);
108
+ }
109
+ const { verifier, challenge } = await this.cryptoProvider.generatePkceCodes();
110
+ const loopbackClient = customLoopbackClient || new LoopbackClient.LoopbackClient();
111
+ let authCodeResponse = {};
112
+ let authCodeListenerError = null;
113
+ try {
114
+ const authCodeListener = loopbackClient
115
+ .listenForAuthCode(successTemplate, errorTemplate)
116
+ .then((response) => {
117
+ authCodeResponse = response;
118
+ })
119
+ .catch((e) => {
120
+ // Store the promise instead of throwing so we can control when its thrown
121
+ authCodeListenerError = e;
122
+ });
123
+ // Wait for server to be listening
124
+ const redirectUri = await this.waitForRedirectUri(loopbackClient);
125
+ const validRequest = {
126
+ ...remainingProperties,
127
+ correlationId: correlationId,
128
+ scopes: request.scopes || msalCommon.OIDC_DEFAULT_SCOPES,
129
+ redirectUri: redirectUri,
130
+ responseMode: msalCommon.ResponseMode.QUERY,
131
+ codeChallenge: challenge,
132
+ codeChallengeMethod: msalCommon.CodeChallengeMethodValues.S256,
133
+ };
134
+ const authCodeUrl = await this.getAuthCodeUrl(validRequest);
135
+ await openBrowser(authCodeUrl);
136
+ await authCodeListener;
137
+ if (authCodeListenerError) {
138
+ throw authCodeListenerError;
139
+ }
140
+ if (authCodeResponse.error) {
141
+ throw new msalCommon.ServerError(authCodeResponse.error, authCodeResponse.error_description, authCodeResponse.suberror);
142
+ }
143
+ else if (!authCodeResponse.code) {
144
+ throw NodeAuthError.NodeAuthError.createNoAuthCodeInResponseError();
145
+ }
146
+ const clientInfo = authCodeResponse.client_info;
147
+ const tokenRequest = {
148
+ code: authCodeResponse.code,
149
+ codeVerifier: verifier,
150
+ clientInfo: clientInfo || msalCommon.Constants.EMPTY_STRING,
151
+ ...validRequest,
152
+ };
153
+ return await this.acquireTokenByCode(tokenRequest); // Await this so the server doesn't close prematurely
154
+ }
155
+ finally {
156
+ loopbackClient.closeServer();
157
+ }
158
+ }
159
+ /**
160
+ * Returns a token retrieved either from the cache or by exchanging the refresh token for a fresh access token. If brokering is enabled the token request will be serviced by the broker.
161
+ * @param request
162
+ * @returns
163
+ */
164
+ async acquireTokenSilent(request) {
165
+ const correlationId = request.correlationId || this.cryptoProvider.createNewGuid();
166
+ this.logger.trace("acquireTokenSilent called", correlationId);
167
+ if (this.nativeBrokerPlugin) {
168
+ const brokerRequest = {
169
+ ...request,
170
+ clientId: this.config.auth.clientId,
171
+ scopes: request.scopes || msalCommon.OIDC_DEFAULT_SCOPES,
172
+ redirectUri: `${Constants.Constants.HTTP_PROTOCOL}${Constants.Constants.LOCALHOST}`,
173
+ authority: request.authority || this.config.auth.authority,
174
+ correlationId: correlationId,
175
+ extraParameters: {
176
+ ...request.tokenQueryParameters,
177
+ [msalCommon.AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
178
+ },
179
+ accountId: request.account.nativeAccountId,
180
+ forceRefresh: request.forceRefresh || false,
181
+ };
182
+ return this.nativeBrokerPlugin.acquireTokenSilent(brokerRequest);
183
+ }
184
+ return super.acquireTokenSilent(request);
185
+ }
186
+ /**
187
+ * Removes cache artifacts associated with the given account
188
+ * @param request
189
+ * @returns
190
+ */
191
+ async signOut(request) {
192
+ if (this.nativeBrokerPlugin && request.account.nativeAccountId) {
193
+ const signoutRequest = {
194
+ clientId: this.config.auth.clientId,
195
+ accountId: request.account.nativeAccountId,
196
+ correlationId: request.correlationId ||
197
+ this.cryptoProvider.createNewGuid(),
198
+ };
199
+ await this.nativeBrokerPlugin.signOut(signoutRequest);
200
+ }
201
+ await this.getTokenCache().removeAccount(request.account);
202
+ }
203
+ /**
204
+ * Returns all cached accounts for this application. If brokering is enabled this request will be serviced by the broker.
205
+ * @returns
206
+ */
207
+ async getAllAccounts() {
208
+ if (this.nativeBrokerPlugin) {
209
+ const correlationId = this.cryptoProvider.createNewGuid();
210
+ return this.nativeBrokerPlugin.getAllAccounts(this.config.auth.clientId, correlationId);
211
+ }
212
+ return this.getTokenCache().getAllAccounts();
213
+ }
214
+ /**
215
+ * Attempts to retrieve the redirectUri from the loopback server. If the loopback server does not start listening for requests within the timeout this will throw.
216
+ * @param loopbackClient
217
+ * @returns
218
+ */
219
+ async waitForRedirectUri(loopbackClient) {
220
+ return new Promise((resolve, reject) => {
221
+ let ticks = 0;
222
+ const id = setInterval(() => {
223
+ if (Constants.LOOPBACK_SERVER_CONSTANTS.TIMEOUT_MS /
224
+ Constants.LOOPBACK_SERVER_CONSTANTS.INTERVAL_MS <
225
+ ticks) {
226
+ clearInterval(id);
227
+ reject(NodeAuthError.NodeAuthError.createLoopbackServerTimeoutError());
228
+ return;
229
+ }
230
+ try {
231
+ const r = loopbackClient.getRedirectUri();
232
+ clearInterval(id);
233
+ resolve(r);
234
+ return;
235
+ }
236
+ catch (e) {
237
+ if (e instanceof msalCommon.AuthError &&
238
+ e.errorCode ===
239
+ NodeAuthError.NodeAuthErrorMessage.noLoopbackServerExists.code) {
240
+ // Loopback server is not listening yet
241
+ ticks++;
242
+ return;
243
+ }
244
+ clearInterval(id);
245
+ reject(e);
246
+ return;
247
+ }
248
+ }, Constants.LOOPBACK_SERVER_CONSTANTS.INTERVAL_MS);
249
+ });
250
+ }
249
251
  }
250
252
 
251
253
  exports.PublicClientApplication = PublicClientApplication;
@@ -1 +1 @@
1
- {"version":3,"file":"PublicClientApplication.cjs","sources":["../../src/client/PublicClientApplication.ts"],"sourcesContent":[null],"names":["ClientApplication","ServerTelemetryManager","Constants","version","ApiId","DeviceCodeClient","AuthError","OIDC_DEFAULT_SCOPES","AADServerParamKeys","LoopbackClient","ResponseMode","CodeChallengeMethodValues","ServerError","NodeAuthError","CommonConstants","LOOPBACK_SERVER_CONSTANTS","NodeAuthErrorMessage"],"mappings":";;;;;;;;;;;;AAAA;;;AAGG;AAuCH;;;;AAIG;AACG,MAAO,uBACT,SAAQA,mCAAiB,CAAA;AAKzB;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,WAAA,CAAY,aAA4B,EAAA;QACpC,KAAK,CAAC,aAAa,CAA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AI,EACtD;;AAEE,wBAAA,KAAK,EAAE,CAAC;wBACR,OAAO;AACV,qBAAA;oBACD,aAAa,CAAC,EAAE,CAAC,CAAC;oBAClB,MAAM,CAAC,CAAC,CAAC,CAAC;oBACV,OAAO;AACV,iBAAA;AACL,aAAC,EAAED,mCAAyB,CAAC,WAAW,CAAC,CAAC;AAC9C,SAAC,CAAC,CAAC;KACN;AACJ;;;;"}
1
+ {"version":3,"file":"PublicClientApplication.cjs","sources":["../../src/client/PublicClientApplication.ts"],"sourcesContent":[null],"names":["ClientApplication","ServerTelemetryManager","Constants","version","ApiId","DeviceCodeClient","AuthError","OIDC_DEFAULT_SCOPES","AADServerParamKeys","LoopbackClient","ResponseMode","CodeChallengeMethodValues","ServerError","NodeAuthError","CommonConstants","LOOPBACK_SERVER_CONSTANTS","NodeAuthErrorMessage"],"mappings":";;;;;;;;;;;;;;AAAA;;;AAGG;AAuCH;;;;AAIG;AACG,MAAO,uBACT,SAAQA,mCAAiB,CAAA;AAKzB;;;;;;;;;;;;;;;;AAgBG;AACH,IAAA,WAAA,CAAY,aAA4B,EAAA;QACpC,KAAK,CAAC,aAAa,CAAC,CAAC;AACrB,QAAA,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE;YACvC,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,iBAAiB,EAAE;gBACzD,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC;AAChE,gBAAA,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAC7B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CACnC,CAAC;AACL,aAAA;AAAM,iBAAA;AACH,gBAAA,IAAI,CAAC,MAAM,CAAC,OAAO,CACf,yEAAyE,CAC5E,CAAC;AACL,aAAA;AACJ,SAAA;AACD,QAAA,IAAI,CAAC,IAAI,GAAGC,iCAAsB,CAAC,kBAAkB,CA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