@azure/msal-browser 2.23.0 → 2.25.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 (160) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/_tslib.js +1 -1
  3. package/dist/app/ClientApplication.d.ts +58 -1
  4. package/dist/app/ClientApplication.d.ts.map +1 -1
  5. package/dist/app/ClientApplication.js +290 -75
  6. package/dist/app/ClientApplication.js.map +1 -1
  7. package/dist/app/IPublicClientApplication.d.ts +1 -0
  8. package/dist/app/IPublicClientApplication.d.ts.map +1 -1
  9. package/dist/app/IPublicClientApplication.js +4 -1
  10. package/dist/app/IPublicClientApplication.js.map +1 -1
  11. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  12. package/dist/app/PublicClientApplication.js +48 -42
  13. package/dist/app/PublicClientApplication.js.map +1 -1
  14. package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +49 -0
  15. package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -0
  16. package/dist/broker/nativeBroker/NativeMessageHandler.js +246 -0
  17. package/dist/broker/nativeBroker/NativeMessageHandler.js.map +1 -0
  18. package/dist/broker/nativeBroker/NativeRequest.d.ts +44 -0
  19. package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -0
  20. package/dist/broker/nativeBroker/NativeResponse.d.ts +24 -0
  21. package/dist/broker/nativeBroker/NativeResponse.d.ts.map +1 -0
  22. package/dist/cache/AsyncMemoryStorage.js +1 -1
  23. package/dist/cache/BrowserCacheManager.d.ts +11 -0
  24. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  25. package/dist/cache/BrowserCacheManager.js +44 -2
  26. package/dist/cache/BrowserCacheManager.js.map +1 -1
  27. package/dist/cache/BrowserStorage.js +1 -1
  28. package/dist/cache/DatabaseStorage.js +1 -1
  29. package/dist/cache/MemoryStorage.js +1 -1
  30. package/dist/cache/TokenCache.d.ts +1 -0
  31. package/dist/cache/TokenCache.d.ts.map +1 -1
  32. package/dist/cache/TokenCache.js +2 -2
  33. package/dist/cache/TokenCache.js.map +1 -1
  34. package/dist/config/Configuration.d.ts +99 -38
  35. package/dist/config/Configuration.d.ts.map +1 -1
  36. package/dist/config/Configuration.js +4 -3
  37. package/dist/config/Configuration.js.map +1 -1
  38. package/dist/crypto/BrowserCrypto.js +1 -1
  39. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  40. package/dist/crypto/CryptoOps.js +7 -10
  41. package/dist/crypto/CryptoOps.js.map +1 -1
  42. package/dist/crypto/GuidGenerator.js +1 -1
  43. package/dist/crypto/PkceGenerator.js +1 -1
  44. package/dist/crypto/SignedHttpRequest.js +1 -1
  45. package/dist/encode/Base64Decode.js +1 -1
  46. package/dist/encode/Base64Encode.js +1 -1
  47. package/dist/error/BrowserAuthError.d.ts +58 -0
  48. package/dist/error/BrowserAuthError.d.ts.map +1 -1
  49. package/dist/error/BrowserAuthError.js +75 -3
  50. package/dist/error/BrowserAuthError.js.map +1 -1
  51. package/dist/error/BrowserConfigurationAuthError.js +1 -1
  52. package/dist/error/NativeAuthError.d.ts +47 -0
  53. package/dist/error/NativeAuthError.d.ts.map +1 -0
  54. package/dist/error/NativeAuthError.js +83 -0
  55. package/dist/error/NativeAuthError.js.map +1 -0
  56. package/dist/event/EventHandler.js +1 -1
  57. package/dist/event/EventMessage.js +1 -1
  58. package/dist/event/EventType.d.ts +2 -0
  59. package/dist/event/EventType.d.ts.map +1 -1
  60. package/dist/event/EventType.js +3 -1
  61. package/dist/event/EventType.js.map +1 -1
  62. package/dist/index.cjs.js +6130 -4824
  63. package/dist/index.cjs.js.map +1 -1
  64. package/dist/index.d.ts +6 -13
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +4 -13
  67. package/dist/index.js.map +1 -1
  68. package/dist/interaction_client/BaseInteractionClient.d.ts +12 -2
  69. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  70. package/dist/interaction_client/BaseInteractionClient.js +35 -3
  71. package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
  72. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
  73. package/dist/interaction_client/NativeInteractionClient.d.ts +57 -0
  74. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -0
  75. package/dist/interaction_client/NativeInteractionClient.js +337 -0
  76. package/dist/interaction_client/NativeInteractionClient.js.map +1 -0
  77. package/dist/interaction_client/PopupClient.d.ts +75 -2
  78. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  79. package/dist/interaction_client/PopupClient.js +315 -46
  80. package/dist/interaction_client/PopupClient.js.map +1 -1
  81. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  82. package/dist/interaction_client/RedirectClient.js +38 -9
  83. package/dist/interaction_client/RedirectClient.js.map +1 -1
  84. package/dist/interaction_client/SilentAuthCodeClient.d.ts +2 -1
  85. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  86. package/dist/interaction_client/SilentAuthCodeClient.js +3 -3
  87. package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
  88. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  89. package/dist/interaction_client/SilentCacheClient.js +2 -4
  90. package/dist/interaction_client/SilentCacheClient.js.map +1 -1
  91. package/dist/interaction_client/SilentIframeClient.d.ts +5 -3
  92. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  93. package/dist/interaction_client/SilentIframeClient.js +38 -25
  94. package/dist/interaction_client/SilentIframeClient.js.map +1 -1
  95. package/dist/interaction_client/SilentRefreshClient.js +1 -1
  96. package/dist/interaction_client/StandardInteractionClient.d.ts +2 -8
  97. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  98. package/dist/interaction_client/StandardInteractionClient.js +5 -9
  99. package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
  100. package/dist/interaction_handler/InteractionHandler.d.ts +3 -8
  101. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  102. package/dist/interaction_handler/InteractionHandler.js +19 -8
  103. package/dist/interaction_handler/InteractionHandler.js.map +1 -1
  104. package/dist/interaction_handler/RedirectHandler.d.ts +2 -2
  105. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  106. package/dist/interaction_handler/RedirectHandler.js +27 -20
  107. package/dist/interaction_handler/RedirectHandler.js.map +1 -1
  108. package/dist/interaction_handler/SilentHandler.d.ts +1 -1
  109. package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
  110. package/dist/interaction_handler/SilentHandler.js +5 -5
  111. package/dist/interaction_handler/SilentHandler.js.map +1 -1
  112. package/dist/internals.d.ts +17 -0
  113. package/dist/internals.d.ts.map +1 -0
  114. package/dist/internals.js +19 -0
  115. package/dist/internals.js.map +1 -0
  116. package/dist/navigation/NavigationClient.js +1 -1
  117. package/dist/network/FetchClient.js +1 -1
  118. package/dist/network/XhrClient.js +1 -1
  119. package/dist/packageMetadata.d.ts +1 -1
  120. package/dist/packageMetadata.js +2 -2
  121. package/dist/packageMetadata.js.map +1 -1
  122. package/dist/request/AuthorizationCodeRequest.d.ts +2 -1
  123. package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
  124. package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
  125. package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
  126. package/dist/request/EndSessionPopupRequest.d.ts +1 -1
  127. package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
  128. package/dist/request/PopupRequest.d.ts +2 -2
  129. package/dist/request/PopupRequest.d.ts.map +1 -1
  130. package/dist/request/PopupWindowAttributes.d.ts +16 -0
  131. package/dist/request/PopupWindowAttributes.d.ts.map +1 -0
  132. package/dist/request/RedirectRequest.d.ts +1 -1
  133. package/dist/request/RedirectRequest.d.ts.map +1 -1
  134. package/dist/request/SsoSilentRequest.d.ts +2 -2
  135. package/dist/request/SsoSilentRequest.d.ts.map +1 -1
  136. package/dist/telemetry/BrowserPerformanceClient.js +1 -1
  137. package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
  138. package/dist/utils/BrowserConstants.d.ts +12 -1
  139. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  140. package/dist/utils/BrowserConstants.js +14 -2
  141. package/dist/utils/BrowserConstants.js.map +1 -1
  142. package/dist/utils/BrowserProtocolUtils.js +1 -1
  143. package/dist/utils/BrowserStringUtils.js +1 -1
  144. package/dist/utils/BrowserUtils.d.ts +6 -0
  145. package/dist/utils/BrowserUtils.d.ts.map +1 -1
  146. package/dist/utils/BrowserUtils.js +11 -1
  147. package/dist/utils/BrowserUtils.js.map +1 -1
  148. package/dist/utils/MathUtils.js +1 -1
  149. package/lib/msal-browser.js +6130 -4824
  150. package/lib/msal-browser.js.map +1 -1
  151. package/lib/msal-browser.min.js +40 -40
  152. package/package.json +2 -2
  153. package/dist/interaction_handler/PopupHandler.d.ts +0 -29
  154. package/dist/interaction_handler/PopupHandler.d.ts.map +0 -1
  155. package/dist/interaction_handler/PopupHandler.js +0 -69
  156. package/dist/interaction_handler/PopupHandler.js.map +0 -1
  157. package/dist/utils/PopupUtils.d.ts +0 -73
  158. package/dist/utils/PopupUtils.d.ts.map +0 -1
  159. package/dist/utils/PopupUtils.js +0 -185
  160. package/dist/utils/PopupUtils.js.map +0 -1
@@ -1,13 +1,15 @@
1
- /*! @azure/msal-browser v2.23.0 2022-04-04 */
1
+ /*! @azure/msal-browser v2.25.0 2022-06-06 */
2
2
  'use strict';
3
- import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
4
- import { OIDC_DEFAULT_SCOPES, AuthError, ThrottlingUtils, Constants, UrlString } from '@azure/msal-common';
3
+ import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
4
+ import { OIDC_DEFAULT_SCOPES, StringUtils, UrlString, Constants, AuthError, ThrottlingUtils, ProtocolUtils, PerformanceEvents } from '@azure/msal-common';
5
5
  import { StandardInteractionClient } from './StandardInteractionClient.js';
6
- import { PopupUtils } from '../utils/PopupUtils.js';
7
6
  import { EventType } from '../event/EventType.js';
8
- import { InteractionType, ApiId } from '../utils/BrowserConstants.js';
9
- import { PopupHandler } from '../interaction_handler/PopupHandler.js';
7
+ import { BrowserConstants, InteractionType, ApiId } from '../utils/BrowserConstants.js';
10
8
  import { BrowserUtils } from '../utils/BrowserUtils.js';
9
+ import { NativeInteractionClient } from './NativeInteractionClient.js';
10
+ import { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.js';
11
+ import { BrowserAuthError } from '../error/BrowserAuthError.js';
12
+ import { InteractionHandler } from '../interaction_handler/InteractionHandler.js';
11
13
 
12
14
  /*
13
15
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -15,8 +17,11 @@ import { BrowserUtils } from '../utils/BrowserUtils.js';
15
17
  */
16
18
  var PopupClient = /** @class */ (function (_super) {
17
19
  __extends(PopupClient, _super);
18
- function PopupClient() {
19
- return _super !== null && _super.apply(this, arguments) || this;
20
+ function PopupClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) {
21
+ var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;
22
+ // Properly sets this reference for the unload event.
23
+ _this.unloadWindow = _this.unloadWindow.bind(_this);
24
+ return _this;
20
25
  }
21
26
  /**
22
27
  * Acquires tokens by opening a popup window to the /authorize endpoint of the authority
@@ -24,7 +29,7 @@ var PopupClient = /** @class */ (function (_super) {
24
29
  */
25
30
  PopupClient.prototype.acquireToken = function (request) {
26
31
  try {
27
- var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority, this.correlationId);
32
+ var popupName = this.generatePopupName(request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority);
28
33
  var popupWindowAttributes = request.popupWindowAttributes || {};
29
34
  // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
30
35
  if (this.config.system.asyncPopups) {
@@ -35,7 +40,7 @@ var PopupClient = /** @class */ (function (_super) {
35
40
  else {
36
41
  // asyncPopups flag is set to false. Opens popup before acquiring token.
37
42
  this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
38
- var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
43
+ var popup = this.openSizedPopup("about:blank", popupName, popupWindowAttributes);
39
44
  return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);
40
45
  }
41
46
  }
@@ -51,7 +56,7 @@ var PopupClient = /** @class */ (function (_super) {
51
56
  try {
52
57
  this.logger.verbose("logoutPopup called");
53
58
  var validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
54
- var popupName = PopupUtils.generateLogoutPopupName(this.config.auth.clientId, validLogoutRequest);
59
+ var popupName = this.generateLogoutPopupName(validLogoutRequest);
55
60
  var authority = logoutRequest && logoutRequest.authority;
56
61
  var mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;
57
62
  var popupWindowAttributes = (logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.popupWindowAttributes) || {};
@@ -64,7 +69,7 @@ var PopupClient = /** @class */ (function (_super) {
64
69
  else {
65
70
  // asyncPopups flag is set to false. Opens popup before logging out.
66
71
  this.logger.verbose("asyncPopup set to false, opening popup");
67
- var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
72
+ var popup = this.openSizedPopup("about:blank", popupName, popupWindowAttributes);
68
73
  return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, popup, mainWindowRedirectUri);
69
74
  }
70
75
  }
@@ -84,7 +89,8 @@ var PopupClient = /** @class */ (function (_super) {
84
89
  */
85
90
  PopupClient.prototype.acquireTokenPopupAsync = function (request, popupName, popupWindowAttributes, popup) {
86
91
  return __awaiter(this, void 0, void 0, function () {
87
- var serverTelemetryManager, validRequest, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_1;
92
+ var serverTelemetryManager, validRequest, authCodeRequest, authClient, isNativeBroker, fetchNativeAccountIdMeasurement, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, serverParams, state_1, nativeInteractionClient, userRequestState, result, e_1;
93
+ var _this = this;
88
94
  return __generator(this, function (_a) {
89
95
  switch (_a.label) {
90
96
  case 0:
@@ -104,24 +110,49 @@ var PopupClient = /** @class */ (function (_super) {
104
110
  case 4:
105
111
  authClient = _a.sent();
106
112
  this.logger.verbose("Auth code client created");
107
- return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
113
+ isNativeBroker = NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme);
114
+ fetchNativeAccountIdMeasurement = void 0;
115
+ if (isNativeBroker) {
116
+ fetchNativeAccountIdMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.FetchAccountIdWithNativeBroker, request.correlationId);
117
+ }
118
+ return [4 /*yield*/, authClient.getAuthCodeUrl(__assign(__assign({}, validRequest), { nativeBroker: isNativeBroker }))];
108
119
  case 5:
109
120
  navigateUrl = _a.sent();
110
- interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
121
+ interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
111
122
  popupParameters = {
112
123
  popup: popup,
113
124
  popupName: popupName,
114
125
  popupWindowAttributes: popupWindowAttributes
115
126
  };
116
- popupWindow = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);
127
+ popupWindow = this.initiateAuthRequest(navigateUrl, popupParameters);
117
128
  this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, { popupWindow: popupWindow }, null);
118
- return [4 /*yield*/, interactionHandler.monitorPopupForHash(popupWindow)];
129
+ return [4 /*yield*/, this.monitorPopupForHash(popupWindow)];
119
130
  case 6:
120
131
  hash = _a.sent();
121
- state = this.validateAndExtractStateFromHash(hash, InteractionType.Popup, validRequest.correlationId);
132
+ serverParams = UrlString.getDeserializedHash(hash);
133
+ state_1 = this.validateAndExtractStateFromHash(serverParams, InteractionType.Popup, validRequest.correlationId);
122
134
  // Remove throttle if it exists
123
135
  ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
124
- return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
136
+ if (serverParams.accountId) {
137
+ this.logger.verbose("Account id found in hash, calling WAM for token");
138
+ // end measurement for server call with native brokering enabled
139
+ if (fetchNativeAccountIdMeasurement) {
140
+ fetchNativeAccountIdMeasurement.endMeasurement({
141
+ success: true,
142
+ isNativeBroker: true
143
+ });
144
+ }
145
+ if (!this.nativeMessageHandler) {
146
+ throw BrowserAuthError.createNativeConnectionNotEstablishedError();
147
+ }
148
+ nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, validRequest.correlationId);
149
+ userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state_1).userRequestState;
150
+ return [2 /*return*/, nativeInteractionClient.acquireToken(__assign(__assign({}, validRequest), { state: userRequestState, prompt: undefined // Server should handle the prompt, ideally native broker can do this part silently
151
+ })).finally(function () {
152
+ _this.browserStorage.cleanRequestByState(state_1);
153
+ })];
154
+ }
155
+ return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state_1, authClient.authority, this.networkClient)];
125
156
  case 7:
126
157
  result = _a.sent();
127
158
  return [2 /*return*/, result];
@@ -153,7 +184,7 @@ var PopupClient = /** @class */ (function (_super) {
153
184
  */
154
185
  PopupClient.prototype.logoutPopupAsync = function (validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {
155
186
  return __awaiter(this, void 0, void 0, function () {
156
- var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow, e_2, navigationOptions, absoluteUrl, e_3;
187
+ var serverTelemetryManager, authClient, logoutUri, popupWindow, navigationOptions, absoluteUrl, e_2;
157
188
  return __generator(this, function (_a) {
158
189
  switch (_a.label) {
159
190
  case 0:
@@ -162,7 +193,7 @@ var PopupClient = /** @class */ (function (_super) {
162
193
  serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);
163
194
  _a.label = 1;
164
195
  case 1:
165
- _a.trys.push([1, 8, , 9]);
196
+ _a.trys.push([1, 5, , 6]);
166
197
  // Clear cache on logout
167
198
  return [4 /*yield*/, this.clearCacheOnLogout(validRequest.account)];
168
199
  case 2:
@@ -174,25 +205,11 @@ var PopupClient = /** @class */ (function (_super) {
174
205
  this.logger.verbose("Auth code client created");
175
206
  logoutUri = authClient.getLogoutUri(validRequest);
176
207
  this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Popup, validRequest);
177
- popupUtils = new PopupUtils(this.browserStorage, this.logger);
178
- popupWindow = popupUtils.openPopup(logoutUri, { popupName: popupName, popupWindowAttributes: popupWindowAttributes, popup: popup });
208
+ popupWindow = this.openPopup(logoutUri, { popupName: popupName, popupWindowAttributes: popupWindowAttributes, popup: popup });
179
209
  this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, { popupWindow: popupWindow }, null);
180
- _a.label = 4;
210
+ return [4 /*yield*/, this.waitForLogoutPopup(popupWindow)];
181
211
  case 4:
182
- _a.trys.push([4, 6, , 7]);
183
- // Don't care if this throws an error (User Cancelled)
184
- return [4 /*yield*/, popupUtils.monitorPopupForSameOrigin(popupWindow)];
185
- case 5:
186
- // Don't care if this throws an error (User Cancelled)
187
212
  _a.sent();
188
- this.logger.verbose("Popup successfully redirected to postLogoutRedirectUri");
189
- return [3 /*break*/, 7];
190
- case 6:
191
- e_2 = _a.sent();
192
- this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " + e_2);
193
- return [3 /*break*/, 7];
194
- case 7:
195
- popupUtils.cleanPopup(popupWindow);
196
213
  if (mainWindowRedirectUri) {
197
214
  navigationOptions = {
198
215
  apiId: ApiId.logoutPopup,
@@ -207,28 +224,280 @@ var PopupClient = /** @class */ (function (_super) {
207
224
  else {
208
225
  this.logger.verbose("No main window navigation requested");
209
226
  }
210
- return [3 /*break*/, 9];
211
- case 8:
212
- e_3 = _a.sent();
227
+ return [3 /*break*/, 6];
228
+ case 5:
229
+ e_2 = _a.sent();
213
230
  if (popup) {
214
231
  // Close the synchronous popup if an error is thrown before the window unload event is registered
215
232
  popup.close();
216
233
  }
217
- if (e_3 instanceof AuthError) {
218
- e_3.setCorrelationId(this.correlationId);
234
+ if (e_2 instanceof AuthError) {
235
+ e_2.setCorrelationId(this.correlationId);
219
236
  }
220
237
  this.browserStorage.setInteractionInProgress(false);
221
- this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e_3);
238
+ this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e_2);
222
239
  this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);
223
- serverTelemetryManager.cacheFailedRequest(e_3);
224
- throw e_3;
225
- case 9:
240
+ serverTelemetryManager.cacheFailedRequest(e_2);
241
+ throw e_2;
242
+ case 6:
226
243
  this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);
227
244
  return [2 /*return*/];
228
245
  }
229
246
  });
230
247
  });
231
248
  };
249
+ /**
250
+ * Opens a popup window with given request Url.
251
+ * @param requestUrl
252
+ */
253
+ PopupClient.prototype.initiateAuthRequest = function (requestUrl, params) {
254
+ // Check that request url is not empty.
255
+ if (!StringUtils.isEmpty(requestUrl)) {
256
+ this.logger.infoPii("Navigate to: " + requestUrl);
257
+ // Open the popup window to requestUrl.
258
+ return this.openPopup(requestUrl, params);
259
+ }
260
+ else {
261
+ // Throw error if request URL is empty.
262
+ this.logger.error("Navigate url is empty");
263
+ throw BrowserAuthError.createEmptyNavigationUriError();
264
+ }
265
+ };
266
+ /**
267
+ * Monitors a window until it loads a url with the same origin.
268
+ * @param popupWindow - window that is being monitored
269
+ * @param timeout - timeout for processing hash once popup is redirected back to application
270
+ */
271
+ PopupClient.prototype.monitorPopupForHash = function (popupWindow) {
272
+ var _this = this;
273
+ return new Promise(function (resolve, reject) {
274
+ /*
275
+ * Polling for popups needs to be tick-based,
276
+ * since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).
277
+ */
278
+ var maxTicks = _this.config.system.windowHashTimeout / BrowserConstants.POLL_INTERVAL_MS;
279
+ var ticks = 0;
280
+ _this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");
281
+ var intervalId = setInterval(function () {
282
+ // Window is closed
283
+ if (popupWindow.closed) {
284
+ _this.logger.error("PopupHandler.monitorPopupForHash - window closed");
285
+ _this.cleanPopup();
286
+ clearInterval(intervalId);
287
+ reject(BrowserAuthError.createUserCancelledError());
288
+ return;
289
+ }
290
+ var href = Constants.EMPTY_STRING;
291
+ var hash = Constants.EMPTY_STRING;
292
+ try {
293
+ /*
294
+ * Will throw if cross origin,
295
+ * which should be caught and ignored
296
+ * since we need the interval to keep running while on STS UI.
297
+ */
298
+ href = popupWindow.location.href;
299
+ hash = popupWindow.location.hash;
300
+ }
301
+ catch (e) { }
302
+ // Don't process blank pages or cross domain
303
+ if (StringUtils.isEmpty(href) || href === "about:blank") {
304
+ return;
305
+ }
306
+ _this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller");
307
+ /*
308
+ * Only run clock when we are on same domain for popups
309
+ * as popup operations can take a long time.
310
+ */
311
+ ticks++;
312
+ if (hash) {
313
+ _this.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url");
314
+ clearInterval(intervalId);
315
+ _this.cleanPopup(popupWindow);
316
+ if (UrlString.hashContainsKnownProperties(hash)) {
317
+ _this.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning.");
318
+ resolve(hash);
319
+ }
320
+ else {
321
+ _this.logger.error("PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely.");
322
+ _this.logger.errorPii("PopupHandler.monitorPopupForHash - hash found: " + hash);
323
+ reject(BrowserAuthError.createHashDoesNotContainKnownPropertiesError());
324
+ }
325
+ }
326
+ else if (ticks > maxTicks) {
327
+ _this.logger.error("PopupHandler.monitorPopupForHash - unable to find hash in url, timing out");
328
+ clearInterval(intervalId);
329
+ reject(BrowserAuthError.createMonitorPopupTimeoutError());
330
+ }
331
+ }, BrowserConstants.POLL_INTERVAL_MS);
332
+ });
333
+ };
334
+ /**
335
+ * Waits for user interaction in logout popup window
336
+ * @param popupWindow
337
+ * @returns
338
+ */
339
+ PopupClient.prototype.waitForLogoutPopup = function (popupWindow) {
340
+ var _this = this;
341
+ return new Promise(function (resolve) {
342
+ _this.logger.verbose("PopupHandler.waitForLogoutPopup - polling started");
343
+ var intervalId = setInterval(function () {
344
+ // Window is closed
345
+ if (popupWindow.closed) {
346
+ _this.logger.error("PopupHandler.waitForLogoutPopup - window closed");
347
+ _this.cleanPopup();
348
+ clearInterval(intervalId);
349
+ resolve();
350
+ }
351
+ var href = Constants.EMPTY_STRING;
352
+ try {
353
+ /*
354
+ * Will throw if cross origin,
355
+ * which should be caught and ignored
356
+ * since we need the interval to keep running while on STS UI.
357
+ */
358
+ href = popupWindow.location.href;
359
+ }
360
+ catch (e) { }
361
+ // Don't process blank pages or cross domain
362
+ if (StringUtils.isEmpty(href) || href === "about:blank") {
363
+ return;
364
+ }
365
+ _this.logger.verbose("PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing.");
366
+ clearInterval(intervalId);
367
+ _this.cleanPopup(popupWindow);
368
+ resolve();
369
+ }, BrowserConstants.POLL_INTERVAL_MS);
370
+ });
371
+ };
372
+ /**
373
+ * @hidden
374
+ *
375
+ * Configures popup window for login.
376
+ *
377
+ * @param urlNavigate
378
+ * @param title
379
+ * @param popUpWidth
380
+ * @param popUpHeight
381
+ * @param popupWindowAttributes
382
+ * @ignore
383
+ * @hidden
384
+ */
385
+ PopupClient.prototype.openPopup = function (urlNavigate, popupParams) {
386
+ try {
387
+ var popupWindow = void 0;
388
+ // Popup window passed in, setting url to navigate to
389
+ if (popupParams.popup) {
390
+ popupWindow = popupParams.popup;
391
+ this.logger.verbosePii("Navigating popup window to: " + urlNavigate);
392
+ popupWindow.location.assign(urlNavigate);
393
+ }
394
+ else if (typeof popupParams.popup === "undefined") {
395
+ // Popup will be undefined if it was not passed in
396
+ this.logger.verbosePii("Opening popup window to: " + urlNavigate);
397
+ popupWindow = this.openSizedPopup(urlNavigate, popupParams.popupName, popupParams.popupWindowAttributes);
398
+ }
399
+ // Popup will be null if popups are blocked
400
+ if (!popupWindow) {
401
+ throw BrowserAuthError.createEmptyWindowCreatedError();
402
+ }
403
+ if (popupWindow.focus) {
404
+ popupWindow.focus();
405
+ }
406
+ this.currentWindow = popupWindow;
407
+ window.addEventListener("beforeunload", this.unloadWindow);
408
+ return popupWindow;
409
+ }
410
+ catch (e) {
411
+ this.logger.error("error opening popup " + e.message);
412
+ this.browserStorage.setInteractionInProgress(false);
413
+ throw BrowserAuthError.createPopupWindowError(e.toString());
414
+ }
415
+ };
416
+ /**
417
+ * Helper function to set popup window dimensions and position
418
+ * @param urlNavigate
419
+ * @param popupName
420
+ * @param popupWindowAttributes
421
+ * @returns
422
+ */
423
+ PopupClient.prototype.openSizedPopup = function (urlNavigate, popupName, popupWindowAttributes) {
424
+ var _a, _b, _c, _d;
425
+ /**
426
+ * adding winLeft and winTop to account for dual monitor
427
+ * using screenLeft and screenTop for IE8 and earlier
428
+ */
429
+ var winLeft = window.screenLeft ? window.screenLeft : window.screenX;
430
+ var winTop = window.screenTop ? window.screenTop : window.screenY;
431
+ /**
432
+ * window.innerWidth displays browser window"s height and width excluding toolbars
433
+ * using document.documentElement.clientWidth for IE8 and earlier
434
+ */
435
+ var winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
436
+ var winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
437
+ var width = (_a = popupWindowAttributes.popupSize) === null || _a === void 0 ? void 0 : _a.width;
438
+ var height = (_b = popupWindowAttributes.popupSize) === null || _b === void 0 ? void 0 : _b.height;
439
+ var top = (_c = popupWindowAttributes.popupPosition) === null || _c === void 0 ? void 0 : _c.top;
440
+ var left = (_d = popupWindowAttributes.popupPosition) === null || _d === void 0 ? void 0 : _d.left;
441
+ if (!width || width < 0 || width > winWidth) {
442
+ this.logger.verbose("Default popup window width used. Window width not configured or invalid.");
443
+ width = BrowserConstants.POPUP_WIDTH;
444
+ }
445
+ if (!height || height < 0 || height > winHeight) {
446
+ this.logger.verbose("Default popup window height used. Window height not configured or invalid.");
447
+ height = BrowserConstants.POPUP_HEIGHT;
448
+ }
449
+ if (!top || top < 0 || top > winHeight) {
450
+ this.logger.verbose("Default popup window top position used. Window top not configured or invalid.");
451
+ top = Math.max(0, ((winHeight / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop);
452
+ }
453
+ if (!left || left < 0 || left > winWidth) {
454
+ this.logger.verbose("Default popup window left position used. Window left not configured or invalid.");
455
+ left = Math.max(0, ((winWidth / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft);
456
+ }
457
+ return window.open(urlNavigate, popupName, "width=" + width + ", height=" + height + ", top=" + top + ", left=" + left + ", scrollbars=yes");
458
+ };
459
+ /**
460
+ * Event callback to unload main window.
461
+ */
462
+ PopupClient.prototype.unloadWindow = function (e) {
463
+ this.browserStorage.cleanRequestByInteractionType(InteractionType.Popup);
464
+ if (this.currentWindow) {
465
+ this.currentWindow.close();
466
+ }
467
+ // Guarantees browser unload will happen, so no other errors will be thrown.
468
+ e.preventDefault();
469
+ };
470
+ /**
471
+ * Closes popup, removes any state vars created during popup calls.
472
+ * @param popupWindow
473
+ */
474
+ PopupClient.prototype.cleanPopup = function (popupWindow) {
475
+ if (popupWindow) {
476
+ // Close window.
477
+ popupWindow.close();
478
+ }
479
+ // Remove window unload function
480
+ window.removeEventListener("beforeunload", this.unloadWindow);
481
+ // Interaction is completed - remove interaction status.
482
+ this.browserStorage.setInteractionInProgress(false);
483
+ };
484
+ /**
485
+ * Generates the name for the popup based on the client id and request
486
+ * @param clientId
487
+ * @param request
488
+ */
489
+ PopupClient.prototype.generatePopupName = function (scopes, authority) {
490
+ return BrowserConstants.POPUP_NAME_PREFIX + "." + this.config.auth.clientId + "." + scopes.join("-") + "." + authority + "." + this.correlationId;
491
+ };
492
+ /**
493
+ * Generates the name for the popup based on the client id and request for logouts
494
+ * @param clientId
495
+ * @param request
496
+ */
497
+ PopupClient.prototype.generateLogoutPopupName = function (request) {
498
+ var homeAccountId = request.account && request.account.homeAccountId;
499
+ return BrowserConstants.POPUP_NAME_PREFIX + "." + this.config.auth.clientId + "." + homeAccountId + "." + this.correlationId;
500
+ };
232
501
  return PopupClient;
233
502
  }(StandardInteractionClient));
234
503
 
@@ -1 +1 @@
1
- {"version":3,"file":"PopupClient.js","sources":["../../src/interaction_client/PopupClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthenticationResult, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ThrottlingUtils, CommonEndSessionRequest, UrlString, AuthError, OIDC_DEFAULT_SCOPES, Constants } from \"@azure/msal-common\";\nimport { StandardInteractionClient } from \"./StandardInteractionClient\";\nimport { PopupWindowAttributes, PopupUtils } from \"../utils/PopupUtils\";\nimport { EventType } from \"../event/EventType\";\nimport { InteractionType, ApiId } from \"../utils/BrowserConstants\";\nimport { PopupHandler, PopupParams } from \"../interaction_handler/PopupHandler\";\nimport { EndSessionPopupRequest } from \"../request/EndSessionPopupRequest\";\nimport { NavigationOptions } from \"../navigation/NavigationOptions\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { PopupRequest } from \"../request/PopupRequest\";\n\nexport class PopupClient extends StandardInteractionClient {\n /**\n * Acquires tokens by opening a popup window to the /authorize endpoint of the authority\n * @param request\n */\n acquireToken(request: PopupRequest): Promise<AuthenticationResult> {\n try {\n const popupName = PopupUtils.generatePopupName(this.config.auth.clientId, request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority, this.correlationId);\n const popupWindowAttributes = request.popupWindowAttributes || {};\n\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\n if (this.config.system.asyncPopups) {\n this.logger.verbose(\"asyncPopups set to true, acquiring token\");\n // Passes on popup position and dimensions if in request\n return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);\n } else {\n // asyncPopups flag is set to false. Opens popup before acquiring token.\n this.logger.verbose(\"asyncPopup set to false, opening popup before acquiring token\");\n const popup = PopupUtils.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes, this.logger);\n return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);\n }\n } catch (e) {\n return Promise.reject(e);\n }\n }\n\n /**\n * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server\n * @param logoutRequest\n */\n logout(logoutRequest?: EndSessionPopupRequest): Promise<void> {\n try {\n this.logger.verbose(\"logoutPopup called\");\n const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);\n\n const popupName = PopupUtils.generateLogoutPopupName(this.config.auth.clientId, validLogoutRequest);\n const authority = logoutRequest && logoutRequest.authority;\n const mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;\n const popupWindowAttributes = logoutRequest?.popupWindowAttributes || {};\n\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\n if (this.config.system.asyncPopups) {\n this.logger.verbose(\"asyncPopups set to true\");\n // Passes on popup position and dimensions if in request\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, undefined, mainWindowRedirectUri);\n } else {\n // asyncPopups flag is set to false. Opens popup before logging out.\n this.logger.verbose(\"asyncPopup set to false, opening popup\");\n const popup = PopupUtils.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes, this.logger);\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, popup, mainWindowRedirectUri);\n }\n } catch (e) {\n // Since this function is synchronous we need to reject\n return Promise.reject(e);\n }\n }\n\n /**\n * Helper which obtains an access_token for your API via opening a popup window in the user's browser\n * @param validRequest\n * @param popupName\n * @param popup\n * @param popupWindowAttributes\n *\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n protected async acquireTokenPopupAsync(request: PopupRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, popup?: Window|null): Promise<AuthenticationResult> {\n this.logger.verbose(\"acquireTokenPopupAsync called\");\n const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);\n const validRequest = await this.initializeAuthorizationRequest(request, InteractionType.Popup);\n this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);\n\n try {\n // Create auth code request and generate PKCE params\n const authCodeRequest: CommonAuthorizationCodeRequest = await this.initializeAuthorizationCodeRequest(validRequest);\n\n // Initialize the client\n const authClient: AuthorizationCodeClient = await this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions);\n this.logger.verbose(\"Auth code client created\");\n\n // Create acquire token url.\n const navigateUrl = await authClient.getAuthCodeUrl(validRequest);\n\n // Create popup interaction handler.\n const interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest, this.logger);\n\n // Show the UI once the url has been created. Get the window handle for the popup.\n const popupParameters: PopupParams = {\n popup,\n popupName,\n popupWindowAttributes\n };\n const popupWindow: Window = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, {popupWindow}, null);\n\n // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.\n const hash = await interactionHandler.monitorPopupForHash(popupWindow);\n const state = this.validateAndExtractStateFromHash(hash, InteractionType.Popup, validRequest.correlationId);\n\n // Remove throttle if it exists\n ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);\n\n // Handle response from hash string.\n const result = await interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient);\n\n return result;\n } catch (e) {\n if (popup) {\n // Close the synchronous popup if an error is thrown before the window unload event is registered\n popup.close();\n }\n\n if (e instanceof AuthError) {\n (e as AuthError).setCorrelationId(this.correlationId);\n }\n\n serverTelemetryManager.cacheFailedRequest(e);\n this.browserStorage.cleanRequestByState(validRequest.state);\n throw e;\n }\n }\n\n /**\n *\n * @param validRequest\n * @param popupName\n * @param requestAuthority\n * @param popup\n * @param mainWindowRedirectUri\n * @param popupWindowAttributes\n */\n protected async logoutPopupAsync(validRequest: CommonEndSessionRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, requestAuthority?: string, popup?: Window|null, mainWindowRedirectUri?: string): Promise<void> {\n this.logger.verbose(\"logoutPopupAsync called\");\n this.eventHandler.emitEvent(EventType.LOGOUT_START, InteractionType.Popup, validRequest);\n\n const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);\n\n try {\n // Clear cache on logout\n await this.clearCacheOnLogout(validRequest.account);\n\n // Initialize the client\n const authClient = await this.createAuthCodeClient(serverTelemetryManager, requestAuthority);\n this.logger.verbose(\"Auth code client created\");\n\n // Create logout string and navigate user window to logout.\n const logoutUri: string = authClient.getLogoutUri(validRequest);\n\n this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Popup, validRequest);\n\n const popupUtils = new PopupUtils(this.browserStorage, this.logger);\n // Open the popup window to requestUrl.\n const popupWindow = popupUtils.openPopup(logoutUri, {popupName, popupWindowAttributes, popup});\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, {popupWindow}, null);\n\n try {\n // Don't care if this throws an error (User Cancelled)\n await popupUtils.monitorPopupForSameOrigin(popupWindow);\n this.logger.verbose(\"Popup successfully redirected to postLogoutRedirectUri\");\n } catch (e) {\n this.logger.verbose(`Error occurred while monitoring popup for same origin. Session on server may remain active. Error: ${e}`);\n }\n\n popupUtils.cleanPopup(popupWindow);\n\n if (mainWindowRedirectUri) {\n const navigationOptions: NavigationOptions = {\n apiId: ApiId.logoutPopup,\n timeout: this.config.system.redirectNavigationTimeout,\n noHistory: false\n };\n const absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());\n\n this.logger.verbose(\"Redirecting main window to url specified in the request\");\n this.logger.verbosePii(`Redirecting main window to: ${absoluteUrl}`);\n this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);\n } else {\n this.logger.verbose(\"No main window navigation requested\");\n }\n } catch (e) {\n if (popup) {\n // Close the synchronous popup if an error is thrown before the window unload event is registered\n popup.close();\n }\n\n if (e instanceof AuthError) {\n (e as AuthError).setCorrelationId(this.correlationId);\n }\n\n this.browserStorage.setInteractionInProgress(false);\n this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e);\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\n serverTelemetryManager.cacheFailedRequest(e);\n throw e;\n }\n\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;IAgBiC,+BAAyB;IAA1D;;KAsMC;;;;;IAjMG,kCAAY,GAAZ,UAAa,OAAqB;QAC9B,IAAI;YACA,IAAM,SAAS,GAAG,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,IAAI,mBAAmB,EAAE,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;YACtL,IAAM,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,IAAI,EAAE,CAAC;;YAGlE,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,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S,EAAE;4BACvB,GAAe,CAAC,gBAAgB,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;yBACzD;wBAED,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC;wBACpD,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC,KAAK,EAAE,IAAI,EAAE,GAAC,CAAC,CAAC;wBACtF,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;wBACzE,sBAAsB,CAAC,kBAAkB,CAAC,GAAC,CAAC,CAAC;wBAC7C,MAAM,GAAC,CAAC;;wBAGZ,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC;;;;;KAC5E;IACL,kBAAC;AAAD,CAtMA,CAAiC,yBAAyB;;;;"}
1
+ {"version":3,"file":"PopupClient.js","sources":["../../src/interaction_client/PopupClient.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthenticationResult, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ThrottlingUtils, CommonEndSessionRequest, UrlString, AuthError, OIDC_DEFAULT_SCOPES, Constants, ProtocolUtils, ServerAuthorizationCodeResponse, PerformanceEvents, StringUtils, IPerformanceClient, Logger, ICrypto } from \"@azure/msal-common\";\nimport { StandardInteractionClient } from \"./StandardInteractionClient\";\nimport { EventType } from \"../event/EventType\";\nimport { InteractionType, ApiId, BrowserConstants } from \"../utils/BrowserConstants\";\nimport { EndSessionPopupRequest } from \"../request/EndSessionPopupRequest\";\nimport { NavigationOptions } from \"../navigation/NavigationOptions\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { NativeInteractionClient } from \"./NativeInteractionClient\";\nimport { NativeMessageHandler } from \"../broker/nativeBroker/NativeMessageHandler\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { EventHandler } from \"../event/EventHandler\";\nimport { BrowserCacheManager } from \"../cache/BrowserCacheManager\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\nimport { InteractionHandler, InteractionParams } from \"../interaction_handler/InteractionHandler\";\nimport { PopupWindowAttributes } from \"../request/PopupWindowAttributes\";\n\nexport type PopupParams = InteractionParams & {\n popup?: Window|null;\n popupName: string;\n popupWindowAttributes: PopupWindowAttributes\n};\n\nexport class PopupClient extends StandardInteractionClient {\n private currentWindow: Window|undefined;\n\n constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, performanceClient: IPerformanceClient, nativeMessageHandler?: NativeMessageHandler, correlationId?: string) {\n super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);\n // Properly sets this reference for the unload event.\n this.unloadWindow = this.unloadWindow.bind(this);\n }\n\n /**\n * Acquires tokens by opening a popup window to the /authorize endpoint of the authority\n * @param request\n */\n acquireToken(request: PopupRequest): Promise<AuthenticationResult> {\n try {\n const popupName = this.generatePopupName(request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority);\n const popupWindowAttributes = request.popupWindowAttributes || {};\n\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\n if (this.config.system.asyncPopups) {\n this.logger.verbose(\"asyncPopups set to true, acquiring token\");\n // Passes on popup position and dimensions if in request\n return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);\n } else {\n // asyncPopups flag is set to false. Opens popup before acquiring token.\n this.logger.verbose(\"asyncPopup set to false, opening popup before acquiring token\");\n const popup = this.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes);\n return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);\n }\n } catch (e) {\n return Promise.reject(e);\n }\n }\n\n /**\n * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server\n * @param logoutRequest\n */\n logout(logoutRequest?: EndSessionPopupRequest): Promise<void> {\n try {\n this.logger.verbose(\"logoutPopup called\");\n const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);\n\n const popupName = this.generateLogoutPopupName(validLogoutRequest);\n const authority = logoutRequest && logoutRequest.authority;\n const mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;\n const popupWindowAttributes = logoutRequest?.popupWindowAttributes || {};\n\n // asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.\n if (this.config.system.asyncPopups) {\n this.logger.verbose(\"asyncPopups set to true\");\n // Passes on popup position and dimensions if in request\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, undefined, mainWindowRedirectUri);\n } else {\n // asyncPopups flag is set to false. Opens popup before logging out.\n this.logger.verbose(\"asyncPopup set to false, opening popup\");\n const popup = this.openSizedPopup(\"about:blank\", popupName, popupWindowAttributes);\n return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, popup, mainWindowRedirectUri);\n }\n } catch (e) {\n // Since this function is synchronous we need to reject\n return Promise.reject(e);\n }\n }\n\n /**\n * Helper which obtains an access_token for your API via opening a popup window in the user's browser\n * @param validRequest\n * @param popupName\n * @param popup\n * @param popupWindowAttributes\n *\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n protected async acquireTokenPopupAsync(request: PopupRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, popup?: Window|null): Promise<AuthenticationResult> {\n this.logger.verbose(\"acquireTokenPopupAsync called\");\n const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);\n const validRequest = await this.initializeAuthorizationRequest(request, InteractionType.Popup);\n this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);\n\n try {\n // Create auth code request and generate PKCE params\n const authCodeRequest: CommonAuthorizationCodeRequest = await this.initializeAuthorizationCodeRequest(validRequest);\n\n // Initialize the client\n const authClient: AuthorizationCodeClient = await this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions);\n this.logger.verbose(\"Auth code client created\");\n\n const isNativeBroker = NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme);\n // Start measurement for server calls with native brokering enabled\n let fetchNativeAccountIdMeasurement;\n if (isNativeBroker) {\n fetchNativeAccountIdMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.FetchAccountIdWithNativeBroker, request.correlationId);\n }\n\n // Create acquire token url.\n const navigateUrl = await authClient.getAuthCodeUrl({\n ...validRequest,\n nativeBroker: isNativeBroker\n });\n\n // Create popup interaction handler.\n const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger);\n\n // Show the UI once the url has been created. Get the window handle for the popup.\n const popupParameters: PopupParams = {\n popup,\n popupName,\n popupWindowAttributes\n };\n const popupWindow: Window = this.initiateAuthRequest(navigateUrl, popupParameters);\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, {popupWindow}, null);\n\n // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.\n const hash = await this.monitorPopupForHash(popupWindow);\n // Deserialize hash fragment response parameters.\n const serverParams: ServerAuthorizationCodeResponse = UrlString.getDeserializedHash(hash);\n const state = this.validateAndExtractStateFromHash(serverParams, InteractionType.Popup, validRequest.correlationId);\n // Remove throttle if it exists\n ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);\n\n if (serverParams.accountId) {\n this.logger.verbose(\"Account id found in hash, calling WAM for token\");\n // end measurement for server call with native brokering enabled\n if (fetchNativeAccountIdMeasurement) {\n fetchNativeAccountIdMeasurement.endMeasurement({\n success: true,\n isNativeBroker: true\n });\n }\n\n if (!this.nativeMessageHandler) {\n throw BrowserAuthError.createNativeConnectionNotEstablishedError();\n }\n const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, validRequest.correlationId);\n const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, state);\n return nativeInteractionClient.acquireToken({\n ...validRequest,\n state: userRequestState,\n prompt: undefined // Server should handle the prompt, ideally native broker can do this part silently\n }).finally(() => {\n this.browserStorage.cleanRequestByState(state);\n });\n }\n\n // Handle response from hash string.\n const result = await interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient);\n\n return result;\n } catch (e) {\n if (popup) {\n // Close the synchronous popup if an error is thrown before the window unload event is registered\n popup.close();\n }\n\n if (e instanceof AuthError) {\n (e as AuthError).setCorrelationId(this.correlationId);\n }\n\n serverTelemetryManager.cacheFailedRequest(e);\n this.browserStorage.cleanRequestByState(validRequest.state);\n throw e;\n }\n }\n\n /**\n *\n * @param validRequest\n * @param popupName\n * @param requestAuthority\n * @param popup\n * @param mainWindowRedirectUri\n * @param popupWindowAttributes\n */\n protected async logoutPopupAsync(validRequest: CommonEndSessionRequest, popupName: string, popupWindowAttributes: PopupWindowAttributes, requestAuthority?: string, popup?: Window|null, mainWindowRedirectUri?: string): Promise<void> {\n this.logger.verbose(\"logoutPopupAsync called\");\n this.eventHandler.emitEvent(EventType.LOGOUT_START, InteractionType.Popup, validRequest);\n\n const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);\n\n try {\n // Clear cache on logout\n await this.clearCacheOnLogout(validRequest.account);\n\n // Initialize the client\n const authClient = await this.createAuthCodeClient(serverTelemetryManager, requestAuthority);\n this.logger.verbose(\"Auth code client created\");\n\n // Create logout string and navigate user window to logout.\n const logoutUri: string = authClient.getLogoutUri(validRequest);\n\n this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Popup, validRequest);\n\n // Open the popup window to requestUrl.\n const popupWindow = this.openPopup(logoutUri, {popupName, popupWindowAttributes, popup});\n this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, {popupWindow}, null);\n\n await this.waitForLogoutPopup(popupWindow);\n\n if (mainWindowRedirectUri) {\n const navigationOptions: NavigationOptions = {\n apiId: ApiId.logoutPopup,\n timeout: this.config.system.redirectNavigationTimeout,\n noHistory: false\n };\n const absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());\n\n this.logger.verbose(\"Redirecting main window to url specified in the request\");\n this.logger.verbosePii(`Redirecting main window to: ${absoluteUrl}`);\n this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);\n } else {\n this.logger.verbose(\"No main window navigation requested\");\n }\n } catch (e) {\n if (popup) {\n // Close the synchronous popup if an error is thrown before the window unload event is registered\n popup.close();\n }\n\n if (e instanceof AuthError) {\n (e as AuthError).setCorrelationId(this.correlationId);\n }\n\n this.browserStorage.setInteractionInProgress(false);\n this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e);\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\n serverTelemetryManager.cacheFailedRequest(e);\n throw e;\n }\n\n this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);\n }\n\n /**\n * Opens a popup window with given request Url.\n * @param requestUrl\n */\n initiateAuthRequest(requestUrl: string, params: PopupParams): Window {\n // Check that request url is not empty.\n if (!StringUtils.isEmpty(requestUrl)) {\n this.logger.infoPii(`Navigate to: ${requestUrl}`);\n // Open the popup window to requestUrl.\n return this.openPopup(requestUrl, params);\n } else {\n // Throw error if request URL is empty.\n this.logger.error(\"Navigate url is empty\");\n throw BrowserAuthError.createEmptyNavigationUriError();\n }\n }\n\n /**\n * Monitors a window until it loads a url with the same origin.\n * @param popupWindow - window that is being monitored\n * @param timeout - timeout for processing hash once popup is redirected back to application\n */\n monitorPopupForHash(popupWindow: Window): Promise<string> {\n return new Promise((resolve, reject) => {\n /*\n * Polling for popups needs to be tick-based,\n * since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).\n */\n const maxTicks = this.config.system.windowHashTimeout / BrowserConstants.POLL_INTERVAL_MS;\n let ticks = 0;\n\n this.logger.verbose(\"PopupHandler.monitorPopupForHash - polling started\");\n\n const intervalId = setInterval(() => {\n // Window is closed\n if (popupWindow.closed) {\n this.logger.error(\"PopupHandler.monitorPopupForHash - window closed\");\n this.cleanPopup();\n clearInterval(intervalId);\n reject(BrowserAuthError.createUserCancelledError());\n return;\n }\n\n let href: string = Constants.EMPTY_STRING;\n let hash: string = Constants.EMPTY_STRING;\n try {\n /*\n * Will throw if cross origin,\n * which should be caught and ignored\n * since we need the interval to keep running while on STS UI.\n */\n href = popupWindow.location.href;\n hash = popupWindow.location.hash;\n } catch (e) {}\n \n // Don't process blank pages or cross domain\n if (StringUtils.isEmpty(href) || href === \"about:blank\") {\n return;\n }\n\n this.logger.verbose(\"PopupHandler.monitorPopupForHash - popup window is on same origin as caller\");\n\n /*\n * Only run clock when we are on same domain for popups\n * as popup operations can take a long time.\n */\n ticks++;\n\n if (hash) {\n this.logger.verbose(\"PopupHandler.monitorPopupForHash - found hash in url\");\n clearInterval(intervalId);\n this.cleanPopup(popupWindow);\n \n if (UrlString.hashContainsKnownProperties(hash)) {\n this.logger.verbose(\"PopupHandler.monitorPopupForHash - hash contains known properties, returning.\");\n resolve(hash);\n } else {\n this.logger.error(\"PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely.\");\n this.logger.errorPii(`PopupHandler.monitorPopupForHash - hash found: ${hash}`);\n reject(BrowserAuthError.createHashDoesNotContainKnownPropertiesError());\n }\n } else if (ticks > maxTicks) {\n this.logger.error(\"PopupHandler.monitorPopupForHash - unable to find hash in url, timing out\");\n clearInterval(intervalId);\n reject(BrowserAuthError.createMonitorPopupTimeoutError());\n }\n }, BrowserConstants.POLL_INTERVAL_MS);\n });\n }\n\n /**\n * Waits for user interaction in logout popup window\n * @param popupWindow \n * @returns \n */\n waitForLogoutPopup(popupWindow: Window): Promise<void> {\n return new Promise((resolve) => {\n this.logger.verbose(\"PopupHandler.waitForLogoutPopup - polling started\");\n\n const intervalId = setInterval(() => {\n // Window is closed\n if (popupWindow.closed) {\n this.logger.error(\"PopupHandler.waitForLogoutPopup - window closed\");\n this.cleanPopup();\n clearInterval(intervalId);\n resolve();\n }\n\n let href: string = Constants.EMPTY_STRING;\n try {\n /*\n * Will throw if cross origin,\n * which should be caught and ignored\n * since we need the interval to keep running while on STS UI.\n */\n href = popupWindow.location.href;\n } catch (e) {}\n \n // Don't process blank pages or cross domain\n if (StringUtils.isEmpty(href) || href === \"about:blank\") {\n return;\n }\n\n this.logger.verbose(\"PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing.\");\n\n clearInterval(intervalId);\n this.cleanPopup(popupWindow);\n resolve();\n }, BrowserConstants.POLL_INTERVAL_MS);\n });\n }\n\n /**\n * @hidden\n *\n * Configures popup window for login.\n *\n * @param urlNavigate\n * @param title\n * @param popUpWidth\n * @param popUpHeight\n * @param popupWindowAttributes\n * @ignore\n * @hidden\n */\n openPopup(urlNavigate: string, popupParams: PopupParams): Window {\n try {\n let popupWindow;\n // Popup window passed in, setting url to navigate to\n if (popupParams.popup) {\n popupWindow = popupParams.popup;\n this.logger.verbosePii(`Navigating popup window to: ${urlNavigate}`);\n popupWindow.location.assign(urlNavigate);\n } else if (typeof popupParams.popup === \"undefined\") {\n // Popup will be undefined if it was not passed in\n this.logger.verbosePii(`Opening popup window to: ${urlNavigate}`);\n popupWindow = this.openSizedPopup(urlNavigate, popupParams.popupName, popupParams.popupWindowAttributes);\n }\n\n // Popup will be null if popups are blocked\n if (!popupWindow) {\n throw BrowserAuthError.createEmptyWindowCreatedError();\n }\n if (popupWindow.focus) {\n popupWindow.focus();\n }\n this.currentWindow = popupWindow;\n window.addEventListener(\"beforeunload\", this.unloadWindow);\n\n return popupWindow;\n } catch (e) {\n this.logger.error(\"error opening popup \" + (e as AuthError).message);\n this.browserStorage.setInteractionInProgress(false);\n throw BrowserAuthError.createPopupWindowError((e as AuthError).toString());\n }\n }\n\n /**\n * Helper function to set popup window dimensions and position\n * @param urlNavigate \n * @param popupName \n * @param popupWindowAttributes \n * @returns \n */\n openSizedPopup(urlNavigate: string, popupName: string, popupWindowAttributes: PopupWindowAttributes): Window|null {\n /**\n * adding winLeft and winTop to account for dual monitor\n * using screenLeft and screenTop for IE8 and earlier\n */\n const winLeft = window.screenLeft ? window.screenLeft : window.screenX;\n const winTop = window.screenTop ? window.screenTop : window.screenY;\n /**\n * window.innerWidth displays browser window\"s height and width excluding toolbars\n * using document.documentElement.clientWidth for IE8 and earlier\n */\n const winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;\n const winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;\n\n let width = popupWindowAttributes.popupSize?.width;\n let height = popupWindowAttributes.popupSize?.height;\n let top = popupWindowAttributes.popupPosition?.top;\n let left = popupWindowAttributes.popupPosition?.left;\n\n if (!width || width < 0 || width > winWidth) {\n this.logger.verbose(\"Default popup window width used. Window width not configured or invalid.\");\n width = BrowserConstants.POPUP_WIDTH;\n }\n\n if (!height || height < 0 || height > winHeight) {\n this.logger.verbose(\"Default popup window height used. Window height not configured or invalid.\");\n height = BrowserConstants.POPUP_HEIGHT;\n }\n\n if (!top || top < 0 || top > winHeight) {\n this.logger.verbose(\"Default popup window top position used. Window top not configured or invalid.\");\n top = Math.max(0, ((winHeight / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop);\n }\n\n if (!left || left < 0 || left > winWidth) {\n this.logger.verbose(\"Default popup window left position used. Window left not configured or invalid.\");\n left = Math.max(0, ((winWidth / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft);\n }\n\n return window.open(urlNavigate, popupName, `width=${width}, height=${height}, top=${top}, left=${left}, scrollbars=yes`);\n }\n\n /**\n * Event callback to unload main window.\n */\n unloadWindow(e: Event): void {\n this.browserStorage.cleanRequestByInteractionType(InteractionType.Popup);\n if (this.currentWindow) {\n this.currentWindow.close();\n }\n // Guarantees browser unload will happen, so no other errors will be thrown.\n e.preventDefault();\n }\n\n /**\n * Closes popup, removes any state vars created during popup calls.\n * @param popupWindow\n */\n cleanPopup(popupWindow?: Window): void {\n if (popupWindow) {\n // Close window.\n popupWindow.close();\n }\n // Remove window unload function\n window.removeEventListener(\"beforeunload\", this.unloadWindow);\n\n // Interaction is completed - remove interaction status.\n this.browserStorage.setInteractionInProgress(false);\n }\n\n /**\n * Generates the name for the popup based on the client id and request\n * @param clientId\n * @param request\n */\n generatePopupName(scopes: Array<string>, authority: string): string {\n return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${scopes.join(\"-\")}.${authority}.${this.correlationId}`;\n }\n\n /**\n * Generates the name for the popup based on the client id and request for logouts\n * @param clientId \n * @param request \n */\n generateLogoutPopupName(request: CommonEndSessionRequest): string {\n const homeAccountId = request.account && request.account.homeAccountId;\n return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${homeAccountId}.${this.correlationId}`;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;IA6BiC,+BAAyB;IAGtD,qBAAY,MAA4B,EAAE,WAAgC,EAAE,aAAsB,EAAE,MAAc,EAAE,YAA0B,EAAE,gBAAmC,EAAE,iBAAqC,EAAE,oBAA2C,EAAE,aAAsB;QAA/R,YACI,kBAAM,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,aAAa,CAAC,SAG5I;;QADG,KAAI,CAAC,YAAY,GAAG,KAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAI,CAAC,CAAC;;KACpD;;;;;IAMD,kCAAY,GAAZ,UAAa,OAAqB;QAC9B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