@azure/msal-browser 4.8.0 → 4.9.1
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.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +4 -41
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +18 -143
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/CacheHelpers.mjs +1 -1
- package/dist/cache/CookieStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/LocalStorage.mjs +2 -2
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +5 -5
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts +2 -2
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +28 -16
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts +2 -2
- package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +11 -0
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +68 -5
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.mjs +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.d.ts +3 -5
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.mjs +5 -7
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +3 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +6 -4
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +2 -2
- 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.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +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 +1 -3
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +14 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +65 -64
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +20 -3
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +132 -76
- 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 +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +13 -3
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +57 -44
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +2 -3
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +4 -5
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +4 -2
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +15 -5
- 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 +2 -2
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.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/protocol/Authorize.d.ts +53 -1
- package/dist/protocol/Authorize.d.ts.map +1 -1
- package/dist/protocol/Authorize.mjs +147 -4
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts +2 -4
- package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/PopupRequest.d.ts +1 -1
- package/dist/request/PopupRequest.d.ts.map +1 -1
- package/dist/request/RedirectRequest.d.ts +1 -1
- package/dist/request/RedirectRequest.d.ts.map +1 -1
- package/dist/request/RequestHelpers.mjs +1 -1
- package/dist/request/SsoSilentRequest.d.ts +1 -1
- package/dist/request/SsoSilentRequest.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.d.ts +1 -10
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.mjs +2 -15
- package/dist/utils/BrowserConstants.mjs.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +1588 -1555
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +1588 -1555
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +68 -67
- package/lib/types/cache/BrowserCacheManager.d.ts +4 -41
- package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/types/controllers/NestedAppAuthController.d.ts +2 -2
- package/lib/types/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/lib/types/controllers/StandardController.d.ts.map +1 -1
- package/lib/types/controllers/UnknownOperatingContextController.d.ts +2 -2
- package/lib/types/controllers/UnknownOperatingContextController.d.ts.map +1 -1
- package/lib/types/crypto/BrowserCrypto.d.ts +11 -0
- package/lib/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/lib/types/error/BrowserAuthError.d.ts +3 -5
- package/lib/types/error/BrowserAuthError.d.ts.map +1 -1
- package/lib/types/error/BrowserAuthErrorCodes.d.ts +3 -1
- package/lib/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/lib/types/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/PopupClient.d.ts +14 -1
- package/lib/types/interaction_client/PopupClient.d.ts.map +1 -1
- package/lib/types/interaction_client/RedirectClient.d.ts +20 -3
- package/lib/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/lib/types/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/lib/types/interaction_client/SilentIframeClient.d.ts +13 -3
- package/lib/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/lib/types/interaction_client/StandardInteractionClient.d.ts +2 -3
- package/lib/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_handler/InteractionHandler.d.ts +4 -5
- package/lib/types/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/lib/types/interaction_handler/SilentHandler.d.ts +4 -2
- package/lib/types/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/protocol/Authorize.d.ts +53 -1
- package/lib/types/protocol/Authorize.d.ts.map +1 -1
- package/lib/types/request/AuthorizationUrlRequest.d.ts +2 -4
- package/lib/types/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/lib/types/request/PopupRequest.d.ts +1 -1
- package/lib/types/request/PopupRequest.d.ts.map +1 -1
- package/lib/types/request/RedirectRequest.d.ts +1 -1
- package/lib/types/request/RedirectRequest.d.ts.map +1 -1
- package/lib/types/request/SsoSilentRequest.d.ts +1 -1
- package/lib/types/request/SsoSilentRequest.d.ts.map +1 -1
- package/lib/types/utils/BrowserConstants.d.ts +1 -10
- package/lib/types/utils/BrowserConstants.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/cache/BrowserCacheManager.ts +30 -205
- package/src/config/Configuration.ts +2 -2
- package/src/controllers/NestedAppAuthController.ts +2 -0
- package/src/controllers/StandardController.ts +35 -24
- package/src/controllers/UnknownOperatingContextController.ts +2 -0
- package/src/crypto/BrowserCrypto.ts +91 -2
- package/src/error/BrowserAuthError.ts +6 -8
- package/src/error/BrowserAuthErrorCodes.ts +3 -1
- package/src/interaction_client/NativeInteractionClient.ts +0 -2
- package/src/interaction_client/PopupClient.ts +163 -119
- package/src/interaction_client/RedirectClient.ts +258 -140
- package/src/interaction_client/SilentAuthCodeClient.ts +2 -2
- package/src/interaction_client/SilentIframeClient.ts +154 -99
- package/src/interaction_client/StandardInteractionClient.ts +3 -3
- package/src/interaction_handler/InteractionHandler.ts +4 -4
- package/src/interaction_handler/SilentHandler.ts +31 -2
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +356 -2
- package/src/request/AuthorizationUrlRequest.ts +3 -5
- package/src/request/PopupRequest.ts +1 -0
- package/src/request/RedirectRequest.ts +1 -0
- package/src/request/SsoSilentRequest.ts +1 -0
- package/src/utils/BrowserConstants.ts +1 -10
- package/dist/interaction_handler/RedirectHandler.d.ts +0 -33
- package/dist/interaction_handler/RedirectHandler.d.ts.map +0 -1
- package/dist/interaction_handler/RedirectHandler.mjs +0 -144
- package/dist/interaction_handler/RedirectHandler.mjs.map +0 -1
- package/lib/types/interaction_handler/RedirectHandler.d.ts +0 -33
- package/lib/types/interaction_handler/RedirectHandler.d.ts.map +0 -1
- package/src/interaction_handler/RedirectHandler.ts +0 -252
|
@@ -4,14 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
CommonAuthorizationCodeRequest,
|
|
8
7
|
AuthorizationCodeClient,
|
|
9
|
-
ThrottlingUtils,
|
|
10
8
|
CommonEndSessionRequest,
|
|
11
9
|
UrlString,
|
|
12
10
|
AuthError,
|
|
13
11
|
OIDC_DEFAULT_SCOPES,
|
|
14
|
-
ProtocolUtils,
|
|
15
12
|
PerformanceEvents,
|
|
16
13
|
IPerformanceClient,
|
|
17
14
|
Logger,
|
|
@@ -21,6 +18,7 @@ import {
|
|
|
21
18
|
invokeAsync,
|
|
22
19
|
invoke,
|
|
23
20
|
PkceCodes,
|
|
21
|
+
CommonAuthorizationUrlRequest,
|
|
24
22
|
} from "@azure/msal-common/browser";
|
|
25
23
|
import { StandardInteractionClient } from "./StandardInteractionClient.js";
|
|
26
24
|
import { EventType } from "../event/EventType.js";
|
|
@@ -33,7 +31,6 @@ import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest.js";
|
|
|
33
31
|
import { NavigationOptions } from "../navigation/NavigationOptions.js";
|
|
34
32
|
import * as BrowserUtils from "../utils/BrowserUtils.js";
|
|
35
33
|
import { PopupRequest } from "../request/PopupRequest.js";
|
|
36
|
-
import { NativeInteractionClient } from "./NativeInteractionClient.js";
|
|
37
34
|
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler.js";
|
|
38
35
|
import {
|
|
39
36
|
createBrowserAuthError,
|
|
@@ -43,13 +40,13 @@ import { INavigationClient } from "../navigation/INavigationClient.js";
|
|
|
43
40
|
import { EventHandler } from "../event/EventHandler.js";
|
|
44
41
|
import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
|
|
45
42
|
import { BrowserConfiguration } from "../config/Configuration.js";
|
|
46
|
-
import { InteractionHandler } from "../interaction_handler/InteractionHandler.js";
|
|
47
43
|
import { PopupWindowAttributes } from "../request/PopupWindowAttributes.js";
|
|
48
44
|
import { EventError } from "../event/EventMessage.js";
|
|
49
45
|
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
|
50
46
|
import * as ResponseHandler from "../response/ResponseHandler.js";
|
|
51
|
-
import
|
|
47
|
+
import * as Authorize from "../protocol/Authorize.js";
|
|
52
48
|
import { generatePkceCodes } from "../crypto/PkceGenerator.js";
|
|
49
|
+
import { generateEarKey } from "../crypto/BrowserCrypto.js";
|
|
53
50
|
|
|
54
51
|
export type PopupParams = {
|
|
55
52
|
popup?: Window | null;
|
|
@@ -88,6 +85,7 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
88
85
|
// Properly sets this reference for the unload event.
|
|
89
86
|
this.unloadWindow = this.unloadWindow.bind(this);
|
|
90
87
|
this.nativeStorage = nativeStorageImpl;
|
|
88
|
+
this.eventHandler = eventHandler;
|
|
91
89
|
}
|
|
92
90
|
|
|
93
91
|
/**
|
|
@@ -207,9 +205,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
207
205
|
pkceCodes?: PkceCodes
|
|
208
206
|
): Promise<AuthenticationResult> {
|
|
209
207
|
this.logger.verbose("acquireTokenPopupAsync called");
|
|
210
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
211
|
-
ApiId.acquireTokenPopup
|
|
212
|
-
);
|
|
213
208
|
|
|
214
209
|
const validRequest = await invokeAsync(
|
|
215
210
|
this.initializeAuthorizationRequest.bind(this),
|
|
@@ -219,6 +214,46 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
219
214
|
this.correlationId
|
|
220
215
|
)(request, InteractionType.Popup);
|
|
221
216
|
|
|
217
|
+
/*
|
|
218
|
+
* Skip pre-connect for async popups to reduce time between user interaction and popup window creation to avoid
|
|
219
|
+
* popup from being blocked by browsers with shorter popup timers
|
|
220
|
+
*/
|
|
221
|
+
if (popupParams.popup) {
|
|
222
|
+
BrowserUtils.preconnect(validRequest.authority);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const isPlatformBroker = NativeMessageHandler.isPlatformBrokerAvailable(
|
|
226
|
+
this.config,
|
|
227
|
+
this.logger,
|
|
228
|
+
this.nativeMessageHandler,
|
|
229
|
+
request.authenticationScheme
|
|
230
|
+
);
|
|
231
|
+
validRequest.platformBroker = isPlatformBroker;
|
|
232
|
+
|
|
233
|
+
if (this.config.auth.protocolMode === ProtocolMode.EAR) {
|
|
234
|
+
return this.executeEarFlow(validRequest, popupParams);
|
|
235
|
+
} else {
|
|
236
|
+
return this.executeCodeFlow(validRequest, popupParams, pkceCodes);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Executes auth code + PKCE flow
|
|
242
|
+
* @param request
|
|
243
|
+
* @param popupParams
|
|
244
|
+
* @param pkceCodes
|
|
245
|
+
* @returns
|
|
246
|
+
*/
|
|
247
|
+
async executeCodeFlow(
|
|
248
|
+
request: CommonAuthorizationUrlRequest,
|
|
249
|
+
popupParams: PopupParams,
|
|
250
|
+
pkceCodes?: PkceCodes
|
|
251
|
+
): Promise<AuthenticationResult> {
|
|
252
|
+
const correlationId = request.correlationId;
|
|
253
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
254
|
+
ApiId.acquireTokenPopup
|
|
255
|
+
);
|
|
256
|
+
|
|
222
257
|
const pkce =
|
|
223
258
|
pkceCodes ||
|
|
224
259
|
(await invokeAsync(
|
|
@@ -226,17 +261,13 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
226
261
|
PerformanceEvents.GeneratePkceCodes,
|
|
227
262
|
this.logger,
|
|
228
263
|
this.performanceClient,
|
|
229
|
-
|
|
230
|
-
)(this.performanceClient, this.logger,
|
|
231
|
-
validRequest.codeChallenge = pkce.challenge;
|
|
264
|
+
correlationId
|
|
265
|
+
)(this.performanceClient, this.logger, correlationId));
|
|
232
266
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (popupParams.popup) {
|
|
238
|
-
BrowserUtils.preconnect(validRequest.authority);
|
|
239
|
-
}
|
|
267
|
+
const popupRequest = {
|
|
268
|
+
...request,
|
|
269
|
+
codeChallenge: pkce.challenge,
|
|
270
|
+
};
|
|
240
271
|
|
|
241
272
|
try {
|
|
242
273
|
// Initialize the client
|
|
@@ -245,46 +276,26 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
245
276
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
246
277
|
this.logger,
|
|
247
278
|
this.performanceClient,
|
|
248
|
-
|
|
279
|
+
correlationId
|
|
249
280
|
)({
|
|
250
281
|
serverTelemetryManager,
|
|
251
|
-
requestAuthority:
|
|
252
|
-
requestAzureCloudOptions:
|
|
253
|
-
requestExtraQueryParameters:
|
|
254
|
-
account:
|
|
282
|
+
requestAuthority: popupRequest.authority,
|
|
283
|
+
requestAzureCloudOptions: popupRequest.azureCloudOptions,
|
|
284
|
+
requestExtraQueryParameters: popupRequest.extraQueryParameters,
|
|
285
|
+
account: popupRequest.account,
|
|
255
286
|
});
|
|
256
287
|
|
|
257
|
-
const isPlatformBroker =
|
|
258
|
-
NativeMessageHandler.isPlatformBrokerAvailable(
|
|
259
|
-
this.config,
|
|
260
|
-
this.logger,
|
|
261
|
-
this.nativeMessageHandler,
|
|
262
|
-
request.authenticationScheme
|
|
263
|
-
);
|
|
264
|
-
// Start measurement for server calls with native brokering enabled
|
|
265
|
-
let fetchNativeAccountIdMeasurement;
|
|
266
|
-
if (isPlatformBroker) {
|
|
267
|
-
fetchNativeAccountIdMeasurement =
|
|
268
|
-
this.performanceClient.startMeasurement(
|
|
269
|
-
PerformanceEvents.FetchAccountIdWithNativeBroker,
|
|
270
|
-
request.correlationId
|
|
271
|
-
);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
288
|
// Create acquire token url.
|
|
275
289
|
const navigateUrl = await invokeAsync(
|
|
276
|
-
getAuthCodeRequestUrl,
|
|
290
|
+
Authorize.getAuthCodeRequestUrl,
|
|
277
291
|
PerformanceEvents.GetAuthCodeUrl,
|
|
278
292
|
this.logger,
|
|
279
293
|
this.performanceClient,
|
|
280
|
-
|
|
294
|
+
correlationId
|
|
281
295
|
)(
|
|
282
296
|
this.config,
|
|
283
297
|
authClient.authority,
|
|
284
|
-
|
|
285
|
-
...validRequest,
|
|
286
|
-
platformBroker: isPlatformBroker,
|
|
287
|
-
},
|
|
298
|
+
popupRequest,
|
|
288
299
|
this.logger,
|
|
289
300
|
this.performanceClient
|
|
290
301
|
);
|
|
@@ -318,75 +329,27 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
318
329
|
this.config.auth.OIDCOptions.serverResponseType,
|
|
319
330
|
this.logger
|
|
320
331
|
);
|
|
321
|
-
// Remove throttle if it exists
|
|
322
|
-
ThrottlingUtils.removeThrottle(
|
|
323
|
-
this.browserStorage,
|
|
324
|
-
this.config.auth.clientId,
|
|
325
|
-
validRequest
|
|
326
|
-
);
|
|
327
|
-
|
|
328
|
-
if (serverParams.accountId) {
|
|
329
|
-
this.logger.verbose(
|
|
330
|
-
"Account id found in hash, calling WAM for token"
|
|
331
|
-
);
|
|
332
|
-
// end measurement for server call with native brokering enabled
|
|
333
|
-
if (fetchNativeAccountIdMeasurement) {
|
|
334
|
-
fetchNativeAccountIdMeasurement.end({
|
|
335
|
-
success: true,
|
|
336
|
-
isNativeBroker: true,
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
if (!this.nativeMessageHandler) {
|
|
341
|
-
throw createBrowserAuthError(
|
|
342
|
-
BrowserAuthErrorCodes.nativeConnectionNotEstablished
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
const nativeInteractionClient = new NativeInteractionClient(
|
|
346
|
-
this.config,
|
|
347
|
-
this.browserStorage,
|
|
348
|
-
this.browserCrypto,
|
|
349
|
-
this.logger,
|
|
350
|
-
this.eventHandler,
|
|
351
|
-
this.navigationClient,
|
|
352
|
-
ApiId.acquireTokenPopup,
|
|
353
|
-
this.performanceClient,
|
|
354
|
-
this.nativeMessageHandler,
|
|
355
|
-
serverParams.accountId,
|
|
356
|
-
this.nativeStorage,
|
|
357
|
-
validRequest.correlationId
|
|
358
|
-
);
|
|
359
|
-
const { userRequestState } = ProtocolUtils.parseRequestState(
|
|
360
|
-
this.browserCrypto,
|
|
361
|
-
validRequest.state
|
|
362
|
-
);
|
|
363
|
-
return await nativeInteractionClient.acquireToken({
|
|
364
|
-
...validRequest,
|
|
365
|
-
state: userRequestState,
|
|
366
|
-
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
|
367
|
-
});
|
|
368
|
-
}
|
|
369
332
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
333
|
+
return await invokeAsync(
|
|
334
|
+
Authorize.handleResponseCode,
|
|
335
|
+
PerformanceEvents.HandleResponseCode,
|
|
336
|
+
this.logger,
|
|
337
|
+
this.performanceClient,
|
|
338
|
+
correlationId
|
|
339
|
+
)(
|
|
340
|
+
request,
|
|
341
|
+
serverParams,
|
|
342
|
+
pkce.verifier,
|
|
343
|
+
ApiId.acquireTokenPopup,
|
|
344
|
+
this.config,
|
|
377
345
|
authClient,
|
|
378
346
|
this.browserStorage,
|
|
379
|
-
|
|
347
|
+
this.nativeStorage,
|
|
348
|
+
this.eventHandler,
|
|
380
349
|
this.logger,
|
|
381
|
-
this.performanceClient
|
|
382
|
-
|
|
383
|
-
// Handle response from hash string.
|
|
384
|
-
const result = await interactionHandler.handleCodeResponse(
|
|
385
|
-
serverParams,
|
|
386
|
-
validRequest
|
|
350
|
+
this.performanceClient,
|
|
351
|
+
this.nativeMessageHandler
|
|
387
352
|
);
|
|
388
|
-
|
|
389
|
-
return result;
|
|
390
353
|
} catch (e) {
|
|
391
354
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
392
355
|
popupParams.popup?.close();
|
|
@@ -399,6 +362,95 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
399
362
|
}
|
|
400
363
|
}
|
|
401
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Executes EAR flow
|
|
367
|
+
* @param request
|
|
368
|
+
*/
|
|
369
|
+
async executeEarFlow(
|
|
370
|
+
request: CommonAuthorizationUrlRequest,
|
|
371
|
+
popupParams: PopupParams
|
|
372
|
+
): Promise<AuthenticationResult> {
|
|
373
|
+
const correlationId = request.correlationId;
|
|
374
|
+
// Get the frame handle for the silent request
|
|
375
|
+
const discoveredAuthority = await invokeAsync(
|
|
376
|
+
this.getDiscoveredAuthority.bind(this),
|
|
377
|
+
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
|
|
378
|
+
this.logger,
|
|
379
|
+
this.performanceClient,
|
|
380
|
+
correlationId
|
|
381
|
+
)({
|
|
382
|
+
requestAuthority: request.authority,
|
|
383
|
+
requestAzureCloudOptions: request.azureCloudOptions,
|
|
384
|
+
requestExtraQueryParameters: request.extraQueryParameters,
|
|
385
|
+
account: request.account,
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
const earJwk = await invokeAsync(
|
|
389
|
+
generateEarKey,
|
|
390
|
+
PerformanceEvents.GenerateEarKey,
|
|
391
|
+
this.logger,
|
|
392
|
+
this.performanceClient,
|
|
393
|
+
correlationId
|
|
394
|
+
)();
|
|
395
|
+
const popupRequest = {
|
|
396
|
+
...request,
|
|
397
|
+
earJwk: earJwk,
|
|
398
|
+
};
|
|
399
|
+
const popupWindow =
|
|
400
|
+
popupParams.popup || this.openPopup("about:blank", popupParams);
|
|
401
|
+
|
|
402
|
+
const form = await Authorize.getEARForm(
|
|
403
|
+
popupWindow.document,
|
|
404
|
+
this.config,
|
|
405
|
+
discoveredAuthority,
|
|
406
|
+
popupRequest,
|
|
407
|
+
this.logger,
|
|
408
|
+
this.performanceClient
|
|
409
|
+
);
|
|
410
|
+
form.submit();
|
|
411
|
+
|
|
412
|
+
// Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
413
|
+
const responseString = await invokeAsync(
|
|
414
|
+
this.monitorPopupForHash.bind(this),
|
|
415
|
+
PerformanceEvents.SilentHandlerMonitorIframeForHash,
|
|
416
|
+
this.logger,
|
|
417
|
+
this.performanceClient,
|
|
418
|
+
correlationId
|
|
419
|
+
)(popupWindow, popupParams.popupWindowParent);
|
|
420
|
+
|
|
421
|
+
const serverParams = invoke(
|
|
422
|
+
ResponseHandler.deserializeResponse,
|
|
423
|
+
PerformanceEvents.DeserializeResponse,
|
|
424
|
+
this.logger,
|
|
425
|
+
this.performanceClient,
|
|
426
|
+
this.correlationId
|
|
427
|
+
)(
|
|
428
|
+
responseString,
|
|
429
|
+
this.config.auth.OIDCOptions.serverResponseType,
|
|
430
|
+
this.logger
|
|
431
|
+
);
|
|
432
|
+
|
|
433
|
+
return invokeAsync(
|
|
434
|
+
Authorize.handleResponseEAR,
|
|
435
|
+
PerformanceEvents.HandleResponseEar,
|
|
436
|
+
this.logger,
|
|
437
|
+
this.performanceClient,
|
|
438
|
+
correlationId
|
|
439
|
+
)(
|
|
440
|
+
popupRequest,
|
|
441
|
+
serverParams,
|
|
442
|
+
ApiId.acquireTokenPopup,
|
|
443
|
+
this.config,
|
|
444
|
+
discoveredAuthority,
|
|
445
|
+
this.browserStorage,
|
|
446
|
+
this.nativeStorage,
|
|
447
|
+
this.eventHandler,
|
|
448
|
+
this.logger,
|
|
449
|
+
this.performanceClient,
|
|
450
|
+
this.nativeMessageHandler
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
|
|
402
454
|
/**
|
|
403
455
|
*
|
|
404
456
|
* @param validRequest
|
|
@@ -540,7 +592,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
540
592
|
(e as AuthError).setCorrelationId(this.correlationId);
|
|
541
593
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
542
594
|
}
|
|
543
|
-
this.browserStorage.setInteractionInProgress(false);
|
|
544
595
|
this.eventHandler.emitEvent(
|
|
545
596
|
EventType.LOGOUT_FAILURE,
|
|
546
597
|
InteractionType.Popup,
|
|
@@ -697,7 +748,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
697
748
|
this.logger.error(
|
|
698
749
|
"error opening popup " + (e as AuthError).message
|
|
699
750
|
);
|
|
700
|
-
this.browserStorage.setInteractionInProgress(false);
|
|
701
751
|
throw createBrowserAuthError(
|
|
702
752
|
BrowserAuthErrorCodes.popupWindowError
|
|
703
753
|
);
|
|
@@ -788,9 +838,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
788
838
|
* Event callback to unload main window.
|
|
789
839
|
*/
|
|
790
840
|
unloadWindow(e: Event): void {
|
|
791
|
-
this.browserStorage.cleanRequestByInteractionType(
|
|
792
|
-
InteractionType.Popup
|
|
793
|
-
);
|
|
794
841
|
if (this.currentWindow) {
|
|
795
842
|
this.currentWindow.close();
|
|
796
843
|
}
|
|
@@ -811,9 +858,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
811
858
|
"beforeunload",
|
|
812
859
|
this.unloadWindow
|
|
813
860
|
);
|
|
814
|
-
|
|
815
|
-
// Interaction is completed - remove interaction status.
|
|
816
|
-
this.browserStorage.setInteractionInProgress(false);
|
|
817
861
|
}
|
|
818
862
|
|
|
819
863
|
/**
|