@azure/msal-browser 4.7.0 → 4.9.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.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 +1 -1
- 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.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +12 -3
- 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 +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.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 +9 -4
- 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 +66 -57
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +21 -4
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +133 -70
- 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 +64 -41
- 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 -9
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +2 -22
- 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 +3 -3
- 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 +13 -3
- 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.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +2 -3
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +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/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 +65 -0
- package/dist/protocol/Authorize.d.ts.map +1 -0
- package/dist/protocol/Authorize.mjs +217 -0
- package/dist/protocol/Authorize.mjs.map +1 -0
- 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.d.ts +3 -3
- package/dist/response/ResponseHandler.d.ts.map +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/response/ResponseHandler.mjs.map +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 -11
- 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 +2402 -2345
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +2402 -2345
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +68 -66
- package/lib/types/cache/BrowserCacheManager.d.ts +4 -41
- package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/types/config/Configuration.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 +21 -4
- 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 -9
- 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/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/protocol/Authorize.d.ts +65 -0
- package/lib/types/protocol/Authorize.d.ts.map +1 -0
- 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/response/ResponseHandler.d.ts +3 -3
- package/lib/types/response/ResponseHandler.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 +14 -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 +11 -2
- package/src/interaction_client/PopupClient.ts +174 -111
- package/src/interaction_client/RedirectClient.ts +269 -132
- package/src/interaction_client/SilentAuthCodeClient.ts +2 -2
- package/src/interaction_client/SilentIframeClient.ts +168 -100
- package/src/interaction_client/StandardInteractionClient.ts +3 -43
- package/src/interaction_handler/InteractionHandler.ts +8 -7
- package/src/interaction_handler/SilentHandler.ts +31 -2
- package/src/naa/mapping/NestedAppAuthAdapter.ts +1 -2
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +490 -0
- 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/response/ResponseHandler.ts +3 -3
- 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 -251
|
@@ -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,11 +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";
|
|
47
|
+
import * as Authorize from "../protocol/Authorize.js";
|
|
48
|
+
import { generatePkceCodes } from "../crypto/PkceGenerator.js";
|
|
49
|
+
import { generateEarKey } from "../crypto/BrowserCrypto.js";
|
|
51
50
|
|
|
52
51
|
export type PopupParams = {
|
|
53
52
|
popup?: Window | null;
|
|
@@ -86,6 +85,7 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
86
85
|
// Properly sets this reference for the unload event.
|
|
87
86
|
this.unloadWindow = this.unloadWindow.bind(this);
|
|
88
87
|
this.nativeStorage = nativeStorageImpl;
|
|
88
|
+
this.eventHandler = eventHandler;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
@@ -205,9 +205,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
205
205
|
pkceCodes?: PkceCodes
|
|
206
206
|
): Promise<AuthenticationResult> {
|
|
207
207
|
this.logger.verbose("acquireTokenPopupAsync called");
|
|
208
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
209
|
-
ApiId.acquireTokenPopup
|
|
210
|
-
);
|
|
211
208
|
|
|
212
209
|
const validRequest = await invokeAsync(
|
|
213
210
|
this.initializeAuthorizationRequest.bind(this),
|
|
@@ -225,60 +222,80 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
225
222
|
BrowserUtils.preconnect(validRequest.authority);
|
|
226
223
|
}
|
|
227
224
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
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
|
+
|
|
257
|
+
const pkce =
|
|
258
|
+
pkceCodes ||
|
|
259
|
+
(await invokeAsync(
|
|
260
|
+
generatePkceCodes,
|
|
261
|
+
PerformanceEvents.GeneratePkceCodes,
|
|
262
|
+
this.logger,
|
|
263
|
+
this.performanceClient,
|
|
264
|
+
correlationId
|
|
265
|
+
)(this.performanceClient, this.logger, correlationId));
|
|
266
|
+
|
|
267
|
+
const popupRequest = {
|
|
268
|
+
...request,
|
|
269
|
+
codeChallenge: pkce.challenge,
|
|
270
|
+
};
|
|
238
271
|
|
|
272
|
+
try {
|
|
239
273
|
// Initialize the client
|
|
240
274
|
const authClient: AuthorizationCodeClient = await invokeAsync(
|
|
241
275
|
this.createAuthCodeClient.bind(this),
|
|
242
276
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
243
277
|
this.logger,
|
|
244
278
|
this.performanceClient,
|
|
245
|
-
|
|
279
|
+
correlationId
|
|
246
280
|
)({
|
|
247
281
|
serverTelemetryManager,
|
|
248
|
-
requestAuthority:
|
|
249
|
-
requestAzureCloudOptions:
|
|
250
|
-
requestExtraQueryParameters:
|
|
251
|
-
account:
|
|
282
|
+
requestAuthority: popupRequest.authority,
|
|
283
|
+
requestAzureCloudOptions: popupRequest.azureCloudOptions,
|
|
284
|
+
requestExtraQueryParameters: popupRequest.extraQueryParameters,
|
|
285
|
+
account: popupRequest.account,
|
|
252
286
|
});
|
|
253
287
|
|
|
254
|
-
const isPlatformBroker =
|
|
255
|
-
NativeMessageHandler.isPlatformBrokerAvailable(
|
|
256
|
-
this.config,
|
|
257
|
-
this.logger,
|
|
258
|
-
this.nativeMessageHandler,
|
|
259
|
-
request.authenticationScheme
|
|
260
|
-
);
|
|
261
|
-
// Start measurement for server calls with native brokering enabled
|
|
262
|
-
let fetchNativeAccountIdMeasurement;
|
|
263
|
-
if (isPlatformBroker) {
|
|
264
|
-
fetchNativeAccountIdMeasurement =
|
|
265
|
-
this.performanceClient.startMeasurement(
|
|
266
|
-
PerformanceEvents.FetchAccountIdWithNativeBroker,
|
|
267
|
-
request.correlationId
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
288
|
// Create acquire token url.
|
|
272
|
-
const navigateUrl = await
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
289
|
+
const navigateUrl = await invokeAsync(
|
|
290
|
+
Authorize.getAuthCodeRequestUrl,
|
|
291
|
+
PerformanceEvents.GetAuthCodeUrl,
|
|
292
|
+
this.logger,
|
|
293
|
+
this.performanceClient,
|
|
294
|
+
correlationId
|
|
295
|
+
)(
|
|
296
|
+
this.config,
|
|
297
|
+
authClient.authority,
|
|
298
|
+
popupRequest,
|
|
282
299
|
this.logger,
|
|
283
300
|
this.performanceClient
|
|
284
301
|
);
|
|
@@ -312,62 +329,27 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
312
329
|
this.config.auth.OIDCOptions.serverResponseType,
|
|
313
330
|
this.logger
|
|
314
331
|
);
|
|
315
|
-
// Remove throttle if it exists
|
|
316
|
-
ThrottlingUtils.removeThrottle(
|
|
317
|
-
this.browserStorage,
|
|
318
|
-
this.config.auth.clientId,
|
|
319
|
-
authCodeRequest
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
if (serverParams.accountId) {
|
|
323
|
-
this.logger.verbose(
|
|
324
|
-
"Account id found in hash, calling WAM for token"
|
|
325
|
-
);
|
|
326
|
-
// end measurement for server call with native brokering enabled
|
|
327
|
-
if (fetchNativeAccountIdMeasurement) {
|
|
328
|
-
fetchNativeAccountIdMeasurement.end({
|
|
329
|
-
success: true,
|
|
330
|
-
isNativeBroker: true,
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
if (!this.nativeMessageHandler) {
|
|
335
|
-
throw createBrowserAuthError(
|
|
336
|
-
BrowserAuthErrorCodes.nativeConnectionNotEstablished
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
|
-
const nativeInteractionClient = new NativeInteractionClient(
|
|
340
|
-
this.config,
|
|
341
|
-
this.browserStorage,
|
|
342
|
-
this.browserCrypto,
|
|
343
|
-
this.logger,
|
|
344
|
-
this.eventHandler,
|
|
345
|
-
this.navigationClient,
|
|
346
|
-
ApiId.acquireTokenPopup,
|
|
347
|
-
this.performanceClient,
|
|
348
|
-
this.nativeMessageHandler,
|
|
349
|
-
serverParams.accountId,
|
|
350
|
-
this.nativeStorage,
|
|
351
|
-
validRequest.correlationId
|
|
352
|
-
);
|
|
353
|
-
const { userRequestState } = ProtocolUtils.parseRequestState(
|
|
354
|
-
this.browserCrypto,
|
|
355
|
-
validRequest.state
|
|
356
|
-
);
|
|
357
|
-
return await nativeInteractionClient.acquireToken({
|
|
358
|
-
...validRequest,
|
|
359
|
-
state: userRequestState,
|
|
360
|
-
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
332
|
|
|
364
|
-
|
|
365
|
-
|
|
333
|
+
return await invokeAsync(
|
|
334
|
+
Authorize.handleResponseCode,
|
|
335
|
+
PerformanceEvents.HandleResponseCode,
|
|
336
|
+
this.logger,
|
|
337
|
+
this.performanceClient,
|
|
338
|
+
correlationId
|
|
339
|
+
)(
|
|
340
|
+
request,
|
|
366
341
|
serverParams,
|
|
367
|
-
|
|
342
|
+
pkce.verifier,
|
|
343
|
+
ApiId.acquireTokenPopup,
|
|
344
|
+
this.config,
|
|
345
|
+
authClient,
|
|
346
|
+
this.browserStorage,
|
|
347
|
+
this.nativeStorage,
|
|
348
|
+
this.eventHandler,
|
|
349
|
+
this.logger,
|
|
350
|
+
this.performanceClient,
|
|
351
|
+
this.nativeMessageHandler
|
|
368
352
|
);
|
|
369
|
-
|
|
370
|
-
return result;
|
|
371
353
|
} catch (e) {
|
|
372
354
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
373
355
|
popupParams.popup?.close();
|
|
@@ -380,6 +362,95 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
380
362
|
}
|
|
381
363
|
}
|
|
382
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
|
+
|
|
383
454
|
/**
|
|
384
455
|
*
|
|
385
456
|
* @param validRequest
|
|
@@ -521,7 +592,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
521
592
|
(e as AuthError).setCorrelationId(this.correlationId);
|
|
522
593
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
523
594
|
}
|
|
524
|
-
this.browserStorage.setInteractionInProgress(false);
|
|
525
595
|
this.eventHandler.emitEvent(
|
|
526
596
|
EventType.LOGOUT_FAILURE,
|
|
527
597
|
InteractionType.Popup,
|
|
@@ -678,7 +748,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
678
748
|
this.logger.error(
|
|
679
749
|
"error opening popup " + (e as AuthError).message
|
|
680
750
|
);
|
|
681
|
-
this.browserStorage.setInteractionInProgress(false);
|
|
682
751
|
throw createBrowserAuthError(
|
|
683
752
|
BrowserAuthErrorCodes.popupWindowError
|
|
684
753
|
);
|
|
@@ -769,9 +838,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
769
838
|
* Event callback to unload main window.
|
|
770
839
|
*/
|
|
771
840
|
unloadWindow(e: Event): void {
|
|
772
|
-
this.browserStorage.cleanRequestByInteractionType(
|
|
773
|
-
InteractionType.Popup
|
|
774
|
-
);
|
|
775
841
|
if (this.currentWindow) {
|
|
776
842
|
this.currentWindow.close();
|
|
777
843
|
}
|
|
@@ -792,9 +858,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
792
858
|
"beforeunload",
|
|
793
859
|
this.unloadWindow
|
|
794
860
|
);
|
|
795
|
-
|
|
796
|
-
// Interaction is completed - remove interaction status.
|
|
797
|
-
this.browserStorage.setInteractionInProgress(false);
|
|
798
861
|
}
|
|
799
862
|
|
|
800
863
|
/**
|