@azure/msal-browser 3.3.0 → 3.5.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.
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +3 -4
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientNext.d.ts.map +1 -1
- package/dist/app/PublicClientNext.mjs +4 -6
- package/dist/app/PublicClientNext.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +26 -26
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/CryptoKeyStore.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +5 -5
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.d.ts +2 -8
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +21 -38
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +1 -2
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.d.ts +4 -4
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +50 -51
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.d.ts +2 -2
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +4 -3
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts +0 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +2 -3
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +4 -4
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +1 -12
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +28 -111
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +3 -3
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +59 -50
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +3 -5
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +9 -23
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +2 -12
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +1 -6
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +2 -24
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +6 -13
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +30 -61
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +14 -7
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +30 -15
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +2 -2
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +13 -7
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/response/ResponseHandler.d.ts +8 -0
- package/dist/response/ResponseHandler.d.ts.map +1 -0
- package/dist/response/ResponseHandler.mjs +46 -0
- package/dist/response/ResponseHandler.mjs.map +1 -0
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts +7 -14
- package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +17 -30
- package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +18434 -61
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +3037 -3733
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +68 -66
- package/package.json +2 -2
- package/src/app/PublicClientApplication.ts +4 -3
- package/src/app/PublicClientNext.ts +7 -5
- package/src/cache/BrowserCacheManager.ts +29 -50
- package/src/cache/TokenCache.ts +5 -4
- package/src/controllers/ControllerFactory.ts +30 -49
- package/src/controllers/IController.ts +0 -6
- package/src/controllers/StandardController.ts +70 -85
- package/src/crypto/CryptoOps.ts +5 -3
- package/src/index.ts +1 -0
- package/src/interaction_client/BaseInteractionClient.ts +1 -2
- package/src/interaction_client/NativeInteractionClient.ts +4 -3
- package/src/interaction_client/PopupClient.ts +72 -196
- package/src/interaction_client/RedirectClient.ts +111 -100
- package/src/interaction_client/SilentAuthCodeClient.ts +1 -12
- package/src/interaction_client/SilentIframeClient.ts +17 -44
- package/src/interaction_client/SilentRefreshClient.ts +5 -19
- package/src/interaction_client/StandardInteractionClient.ts +2 -48
- package/src/interaction_handler/InteractionHandler.ts +39 -112
- package/src/interaction_handler/RedirectHandler.ts +52 -30
- package/src/interaction_handler/SilentHandler.ts +12 -5
- package/src/packageMetadata.ts +1 -1
- package/src/response/ResponseHandler.ts +73 -0
- package/src/utils/BrowserProtocolUtils.ts +17 -36
|
@@ -11,15 +11,15 @@ import {
|
|
|
11
11
|
UrlString,
|
|
12
12
|
AuthError,
|
|
13
13
|
OIDC_DEFAULT_SCOPES,
|
|
14
|
-
Constants,
|
|
15
14
|
ProtocolUtils,
|
|
16
|
-
ServerAuthorizationCodeResponse,
|
|
17
15
|
PerformanceEvents,
|
|
18
16
|
IPerformanceClient,
|
|
19
17
|
Logger,
|
|
20
18
|
ICrypto,
|
|
21
19
|
ProtocolMode,
|
|
22
20
|
ServerResponseType,
|
|
21
|
+
invokeAsync,
|
|
22
|
+
invoke,
|
|
23
23
|
} from "@azure/msal-common";
|
|
24
24
|
import { StandardInteractionClient } from "./StandardInteractionClient";
|
|
25
25
|
import { EventType } from "../event/EventType";
|
|
@@ -42,15 +42,13 @@ import { INavigationClient } from "../navigation/INavigationClient";
|
|
|
42
42
|
import { EventHandler } from "../event/EventHandler";
|
|
43
43
|
import { BrowserCacheManager } from "../cache/BrowserCacheManager";
|
|
44
44
|
import { BrowserConfiguration } from "../config/Configuration";
|
|
45
|
-
import {
|
|
46
|
-
InteractionHandler,
|
|
47
|
-
InteractionParams,
|
|
48
|
-
} from "../interaction_handler/InteractionHandler";
|
|
45
|
+
import { InteractionHandler } from "../interaction_handler/InteractionHandler";
|
|
49
46
|
import { PopupWindowAttributes } from "../request/PopupWindowAttributes";
|
|
50
47
|
import { EventError } from "../event/EventMessage";
|
|
51
48
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
49
|
+
import * as ResponseHandler from "../response/ResponseHandler";
|
|
52
50
|
|
|
53
|
-
export type PopupParams =
|
|
51
|
+
export type PopupParams = {
|
|
54
52
|
popup?: Window | null;
|
|
55
53
|
popupName: string;
|
|
56
54
|
popupWindowAttributes: PopupWindowAttributes;
|
|
@@ -203,44 +201,39 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
203
201
|
ApiId.acquireTokenPopup
|
|
204
202
|
);
|
|
205
203
|
|
|
206
|
-
|
|
204
|
+
const validRequest = await invokeAsync(
|
|
205
|
+
this.initializeAuthorizationRequest.bind(this),
|
|
207
206
|
PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
);
|
|
207
|
+
this.logger,
|
|
208
|
+
this.performanceClient,
|
|
209
|
+
this.correlationId
|
|
210
|
+
)(request, InteractionType.Popup);
|
|
211
|
+
|
|
214
212
|
BrowserUtils.preconnect(validRequest.authority);
|
|
215
|
-
this.browserStorage.updateCacheEntries(
|
|
216
|
-
validRequest.state,
|
|
217
|
-
validRequest.nonce,
|
|
218
|
-
validRequest.authority,
|
|
219
|
-
validRequest.loginHint || Constants.EMPTY_STRING,
|
|
220
|
-
validRequest.account || null
|
|
221
|
-
);
|
|
222
213
|
|
|
223
214
|
try {
|
|
224
215
|
// Create auth code request and generate PKCE params
|
|
225
|
-
this.performanceClient.setPreQueueTime(
|
|
226
|
-
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
227
|
-
request.correlationId
|
|
228
|
-
);
|
|
229
216
|
const authCodeRequest: CommonAuthorizationCodeRequest =
|
|
230
|
-
await
|
|
217
|
+
await invokeAsync(
|
|
218
|
+
this.initializeAuthorizationCodeRequest.bind(this),
|
|
219
|
+
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
220
|
+
this.logger,
|
|
221
|
+
this.performanceClient,
|
|
222
|
+
this.correlationId
|
|
223
|
+
)(validRequest);
|
|
231
224
|
|
|
232
225
|
// Initialize the client
|
|
233
|
-
|
|
226
|
+
const authClient: AuthorizationCodeClient = await invokeAsync(
|
|
227
|
+
this.createAuthCodeClient.bind(this),
|
|
234
228
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
235
|
-
|
|
229
|
+
this.logger,
|
|
230
|
+
this.performanceClient,
|
|
231
|
+
this.correlationId
|
|
232
|
+
)(
|
|
233
|
+
serverTelemetryManager,
|
|
234
|
+
validRequest.authority,
|
|
235
|
+
validRequest.azureCloudOptions
|
|
236
236
|
);
|
|
237
|
-
const authClient: AuthorizationCodeClient =
|
|
238
|
-
await this.createAuthCodeClient(
|
|
239
|
-
serverTelemetryManager,
|
|
240
|
-
validRequest.authority,
|
|
241
|
-
validRequest.azureCloudOptions
|
|
242
|
-
);
|
|
243
|
-
this.logger.verbose("Auth code client created");
|
|
244
237
|
|
|
245
238
|
const isNativeBroker = NativeMessageHandler.isNativeAvailable(
|
|
246
239
|
this.config,
|
|
@@ -291,14 +284,18 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
291
284
|
);
|
|
292
285
|
|
|
293
286
|
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
const serverParams
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
287
|
+
const responseString = await this.monitorPopupForHash(popupWindow);
|
|
288
|
+
|
|
289
|
+
const serverParams = invoke(
|
|
290
|
+
ResponseHandler.deserializeResponse,
|
|
291
|
+
PerformanceEvents.DeserializeResponse,
|
|
292
|
+
this.logger,
|
|
293
|
+
this.performanceClient,
|
|
294
|
+
this.correlationId
|
|
295
|
+
)(
|
|
296
|
+
responseString,
|
|
297
|
+
this.config.auth.OIDCOptions.serverResponseType,
|
|
298
|
+
this.logger
|
|
302
299
|
);
|
|
303
300
|
// Remove throttle if it exists
|
|
304
301
|
ThrottlingUtils.removeThrottle(
|
|
@@ -340,25 +337,19 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
340
337
|
);
|
|
341
338
|
const { userRequestState } = ProtocolUtils.parseRequestState(
|
|
342
339
|
this.browserCrypto,
|
|
343
|
-
state
|
|
340
|
+
validRequest.state
|
|
344
341
|
);
|
|
345
|
-
return nativeInteractionClient
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
})
|
|
351
|
-
.finally(() => {
|
|
352
|
-
this.browserStorage.cleanRequestByState(state);
|
|
353
|
-
});
|
|
342
|
+
return nativeInteractionClient.acquireToken({
|
|
343
|
+
...validRequest,
|
|
344
|
+
state: userRequestState,
|
|
345
|
+
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
|
346
|
+
});
|
|
354
347
|
}
|
|
355
348
|
|
|
356
349
|
// Handle response from hash string.
|
|
357
|
-
const result = await interactionHandler.
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
authClient.authority,
|
|
361
|
-
this.networkClient
|
|
350
|
+
const result = await interactionHandler.handleCodeResponse(
|
|
351
|
+
serverParams,
|
|
352
|
+
validRequest
|
|
362
353
|
);
|
|
363
354
|
|
|
364
355
|
return result;
|
|
@@ -372,7 +363,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
372
363
|
(e as AuthError).setCorrelationId(this.correlationId);
|
|
373
364
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
374
365
|
}
|
|
375
|
-
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
376
366
|
throw e;
|
|
377
367
|
}
|
|
378
368
|
}
|
|
@@ -410,15 +400,13 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
410
400
|
await this.clearCacheOnLogout(validRequest.account);
|
|
411
401
|
|
|
412
402
|
// Initialize the client
|
|
413
|
-
|
|
403
|
+
const authClient = await invokeAsync(
|
|
404
|
+
this.createAuthCodeClient.bind(this),
|
|
414
405
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
requestAuthority
|
|
420
|
-
);
|
|
421
|
-
this.logger.verbose("Auth code client created");
|
|
406
|
+
this.logger,
|
|
407
|
+
this.performanceClient,
|
|
408
|
+
this.correlationId
|
|
409
|
+
)(serverTelemetryManager, requestAuthority);
|
|
422
410
|
|
|
423
411
|
try {
|
|
424
412
|
authClient.authority.endSessionEndpoint;
|
|
@@ -485,7 +473,9 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
485
473
|
null
|
|
486
474
|
);
|
|
487
475
|
|
|
488
|
-
await this.
|
|
476
|
+
await this.monitorPopupForHash(popupWindow).catch(() => {
|
|
477
|
+
// Swallow any errors related to monitoring the window. Server logout is best effort
|
|
478
|
+
});
|
|
489
479
|
|
|
490
480
|
if (mainWindowRedirectUri) {
|
|
491
481
|
const navigationOptions: NavigationOptions = {
|
|
@@ -566,16 +556,7 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
566
556
|
* @param timeout - timeout for processing hash once popup is redirected back to application
|
|
567
557
|
*/
|
|
568
558
|
monitorPopupForHash(popupWindow: Window): Promise<string> {
|
|
569
|
-
return new Promise((resolve, reject) => {
|
|
570
|
-
/*
|
|
571
|
-
* Polling for popups needs to be tick-based,
|
|
572
|
-
* since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).
|
|
573
|
-
*/
|
|
574
|
-
const maxTicks =
|
|
575
|
-
this.config.system.windowHashTimeout /
|
|
576
|
-
this.config.system.pollIntervalMilliseconds;
|
|
577
|
-
let ticks = 0;
|
|
578
|
-
|
|
559
|
+
return new Promise<string>((resolve, reject) => {
|
|
579
560
|
this.logger.verbose(
|
|
580
561
|
"PopupHandler.monitorPopupForHash - polling started"
|
|
581
562
|
);
|
|
@@ -586,7 +567,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
586
567
|
this.logger.error(
|
|
587
568
|
"PopupHandler.monitorPopupForHash - window closed"
|
|
588
569
|
);
|
|
589
|
-
this.cleanPopup();
|
|
590
570
|
clearInterval(intervalId);
|
|
591
571
|
reject(
|
|
592
572
|
createBrowserAuthError(
|
|
@@ -596,8 +576,7 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
596
576
|
return;
|
|
597
577
|
}
|
|
598
578
|
|
|
599
|
-
let href =
|
|
600
|
-
let serverResponseString = Constants.EMPTY_STRING;
|
|
579
|
+
let href = "";
|
|
601
580
|
try {
|
|
602
581
|
/*
|
|
603
582
|
* Will throw if cross origin,
|
|
@@ -605,117 +584,33 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
605
584
|
* since we need the interval to keep running while on STS UI.
|
|
606
585
|
*/
|
|
607
586
|
href = popupWindow.location.href;
|
|
608
|
-
serverResponseString =
|
|
609
|
-
this.extractServerResponseStringFromPopup(
|
|
610
|
-
popupWindow,
|
|
611
|
-
href
|
|
612
|
-
);
|
|
613
587
|
} catch (e) {}
|
|
614
588
|
|
|
615
589
|
// Don't process blank pages or cross domain
|
|
616
590
|
if (!href || href === "about:blank") {
|
|
617
591
|
return;
|
|
618
592
|
}
|
|
593
|
+
clearInterval(intervalId);
|
|
619
594
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
* as popup operations can take a long time.
|
|
627
|
-
*/
|
|
628
|
-
ticks++;
|
|
629
|
-
|
|
630
|
-
if (serverResponseString) {
|
|
631
|
-
this.logger.verbose(
|
|
632
|
-
"PopupHandler.monitorPopupForHash - found hash in url"
|
|
633
|
-
);
|
|
634
|
-
clearInterval(intervalId);
|
|
635
|
-
this.cleanPopup(popupWindow);
|
|
636
|
-
|
|
637
|
-
if (
|
|
638
|
-
UrlString.hashContainsKnownProperties(
|
|
639
|
-
serverResponseString
|
|
640
|
-
)
|
|
641
|
-
) {
|
|
642
|
-
this.logger.verbose(
|
|
643
|
-
"PopupHandler.monitorPopupForHash - hash contains known properties, returning."
|
|
644
|
-
);
|
|
645
|
-
resolve(serverResponseString);
|
|
595
|
+
let responseString = "";
|
|
596
|
+
const responseType =
|
|
597
|
+
this.config.auth.OIDCOptions.serverResponseType;
|
|
598
|
+
if (popupWindow) {
|
|
599
|
+
if (responseType === ServerResponseType.QUERY) {
|
|
600
|
+
responseString = popupWindow.location.search;
|
|
646
601
|
} else {
|
|
647
|
-
|
|
648
|
-
"PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely."
|
|
649
|
-
);
|
|
650
|
-
this.logger.errorPii(
|
|
651
|
-
`PopupHandler.monitorPopupForHash - hash found: ${serverResponseString}`
|
|
652
|
-
);
|
|
653
|
-
reject(
|
|
654
|
-
createBrowserAuthError(
|
|
655
|
-
BrowserAuthErrorCodes.hashDoesNotContainKnownProperties
|
|
656
|
-
)
|
|
657
|
-
);
|
|
602
|
+
responseString = popupWindow.location.hash;
|
|
658
603
|
}
|
|
659
|
-
} else if (ticks > maxTicks) {
|
|
660
|
-
this.logger.error(
|
|
661
|
-
"PopupHandler.monitorPopupForHash - unable to find hash in url, timing out"
|
|
662
|
-
);
|
|
663
|
-
clearInterval(intervalId);
|
|
664
|
-
reject(
|
|
665
|
-
createBrowserAuthError(
|
|
666
|
-
BrowserAuthErrorCodes.monitorPopupTimeout
|
|
667
|
-
)
|
|
668
|
-
);
|
|
669
|
-
}
|
|
670
|
-
}, this.config.system.pollIntervalMilliseconds);
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
/**
|
|
675
|
-
* Waits for user interaction in logout popup window
|
|
676
|
-
* @param popupWindow
|
|
677
|
-
* @returns
|
|
678
|
-
*/
|
|
679
|
-
waitForLogoutPopup(popupWindow: Window): Promise<void> {
|
|
680
|
-
return new Promise((resolve) => {
|
|
681
|
-
this.logger.verbose(
|
|
682
|
-
"PopupHandler.waitForLogoutPopup - polling started"
|
|
683
|
-
);
|
|
684
|
-
|
|
685
|
-
const intervalId = setInterval(() => {
|
|
686
|
-
// Window is closed
|
|
687
|
-
if (popupWindow.closed) {
|
|
688
|
-
this.logger.error(
|
|
689
|
-
"PopupHandler.waitForLogoutPopup - window closed"
|
|
690
|
-
);
|
|
691
|
-
this.cleanPopup();
|
|
692
|
-
clearInterval(intervalId);
|
|
693
|
-
resolve();
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
let href: string = Constants.EMPTY_STRING;
|
|
697
|
-
try {
|
|
698
|
-
/*
|
|
699
|
-
* Will throw if cross origin,
|
|
700
|
-
* which should be caught and ignored
|
|
701
|
-
* since we need the interval to keep running while on STS UI.
|
|
702
|
-
*/
|
|
703
|
-
href = popupWindow.location.href;
|
|
704
|
-
} catch (e) {}
|
|
705
|
-
|
|
706
|
-
// Don't process blank pages or cross domain
|
|
707
|
-
if (!href || href === "about:blank") {
|
|
708
|
-
return;
|
|
709
604
|
}
|
|
710
605
|
|
|
711
606
|
this.logger.verbose(
|
|
712
|
-
"PopupHandler.
|
|
607
|
+
"PopupHandler.monitorPopupForHash - popup window is on same origin as caller"
|
|
713
608
|
);
|
|
714
609
|
|
|
715
|
-
|
|
716
|
-
this.cleanPopup(popupWindow);
|
|
717
|
-
resolve();
|
|
610
|
+
resolve(responseString);
|
|
718
611
|
}, this.config.system.pollIntervalMilliseconds);
|
|
612
|
+
}).finally(() => {
|
|
613
|
+
this.cleanPopup(popupWindow);
|
|
719
614
|
});
|
|
720
615
|
}
|
|
721
616
|
|
|
@@ -905,23 +800,4 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
905
800
|
const homeAccountId = request.account && request.account.homeAccountId;
|
|
906
801
|
return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${homeAccountId}.${this.correlationId}`;
|
|
907
802
|
}
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* Extracts the server response from the popup window
|
|
911
|
-
*/
|
|
912
|
-
extractServerResponseStringFromPopup(
|
|
913
|
-
popupWindow: Window,
|
|
914
|
-
href: string
|
|
915
|
-
): string {
|
|
916
|
-
let serverResponseString;
|
|
917
|
-
if (
|
|
918
|
-
this.config.auth.OIDCOptions?.serverResponseType ===
|
|
919
|
-
ServerResponseType.QUERY
|
|
920
|
-
) {
|
|
921
|
-
serverResponseString = UrlString.parseQueryServerResponse(href);
|
|
922
|
-
} else {
|
|
923
|
-
serverResponseString = popupWindow.location.hash;
|
|
924
|
-
}
|
|
925
|
-
return serverResponseString;
|
|
926
|
-
}
|
|
927
803
|
}
|