@azure/msal-browser 3.17.0 → 3.19.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.d.ts +2 -1
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/IPublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientApplication.d.ts +8 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +9 -4
- package/dist/app/PublicClientApplication.mjs.map +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 +2 -1
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +9 -5
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.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 +90 -117
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.d.ts +2 -1
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +3 -3
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +2 -1
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.d.ts +4 -2
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +11 -8
- 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.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.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 +2 -2
- package/dist/error/NestedAppAuthError.mjs.map +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 -0
- package/dist/index.d.ts.map +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 +11 -7
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -1
- package/dist/interaction_client/RedirectClient.mjs +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +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/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/request/InitializeApplicationRequest.d.ts +9 -0
- package/dist/request/InitializeApplicationRequest.d.ts.map +1 -0
- package/dist/request/RequestHelpers.mjs +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.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +214 -248
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +214 -248
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +63 -64
- package/package.json +3 -2
- package/src/app/IPublicClientApplication.ts +3 -1
- package/src/app/PublicClientApplication.ts +9 -3
- package/src/cache/BrowserCacheManager.ts +9 -7
- package/src/cache/TokenCache.ts +158 -243
- package/src/controllers/ControllerFactory.ts +4 -2
- package/src/controllers/IController.ts +3 -1
- package/src/controllers/StandardController.ts +19 -11
- package/src/error/NestedAppAuthError.ts +1 -1
- package/src/index.ts +1 -0
- package/src/interaction_client/NativeInteractionClient.ts +12 -10
- package/src/packageMetadata.ts +1 -1
- package/src/request/InitializeApplicationRequest.ts +13 -0
|
@@ -84,6 +84,7 @@ import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
|
84
84
|
import { ClearCacheRequest } from "../request/ClearCacheRequest";
|
|
85
85
|
import { createNewGuid } from "../crypto/BrowserCrypto";
|
|
86
86
|
import { initializeSilentRequest } from "../request/RequestHelpers";
|
|
87
|
+
import { InitializeApplicationRequest } from "../request/InitializeApplicationRequest";
|
|
87
88
|
|
|
88
89
|
function getAccountType(
|
|
89
90
|
account?: AccountInfo
|
|
@@ -281,10 +282,11 @@ export class StandardController implements IController {
|
|
|
281
282
|
}
|
|
282
283
|
|
|
283
284
|
static async createController(
|
|
284
|
-
operatingContext: BaseOperatingContext
|
|
285
|
+
operatingContext: BaseOperatingContext,
|
|
286
|
+
request?: InitializeApplicationRequest
|
|
285
287
|
): Promise<IController> {
|
|
286
288
|
const controller = new StandardController(operatingContext);
|
|
287
|
-
await controller.initialize();
|
|
289
|
+
await controller.initialize(request);
|
|
288
290
|
return controller;
|
|
289
291
|
}
|
|
290
292
|
|
|
@@ -301,8 +303,9 @@ export class StandardController implements IController {
|
|
|
301
303
|
|
|
302
304
|
/**
|
|
303
305
|
* Initializer function to perform async startup tasks such as connecting to WAM extension
|
|
306
|
+
* @param request {?InitializeApplicationRequest} correlation id
|
|
304
307
|
*/
|
|
305
|
-
async initialize(): Promise<void> {
|
|
308
|
+
async initialize(request?: InitializeApplicationRequest): Promise<void> {
|
|
306
309
|
this.logger.trace("initialize called");
|
|
307
310
|
if (this.initialized) {
|
|
308
311
|
this.logger.info(
|
|
@@ -311,9 +314,12 @@ export class StandardController implements IController {
|
|
|
311
314
|
return;
|
|
312
315
|
}
|
|
313
316
|
|
|
317
|
+
const initCorrelationId =
|
|
318
|
+
request?.correlationId || this.getRequestCorrelationId();
|
|
314
319
|
const allowNativeBroker = this.config.system.allowNativeBroker;
|
|
315
320
|
const initMeasurement = this.performanceClient.startMeasurement(
|
|
316
|
-
PerformanceEvents.InitializeClientApplication
|
|
321
|
+
PerformanceEvents.InitializeClientApplication,
|
|
322
|
+
initCorrelationId
|
|
317
323
|
);
|
|
318
324
|
this.eventHandler.emitEvent(EventType.INITIALIZE_START);
|
|
319
325
|
|
|
@@ -341,8 +347,9 @@ export class StandardController implements IController {
|
|
|
341
347
|
),
|
|
342
348
|
PerformanceEvents.ClearTokensAndKeysWithClaims,
|
|
343
349
|
this.logger,
|
|
344
|
-
this.performanceClient
|
|
345
|
-
|
|
350
|
+
this.performanceClient,
|
|
351
|
+
initCorrelationId
|
|
352
|
+
)(this.performanceClient, initCorrelationId);
|
|
346
353
|
}
|
|
347
354
|
|
|
348
355
|
this.initialized = true;
|
|
@@ -1963,6 +1970,8 @@ export class StandardController implements IController {
|
|
|
1963
1970
|
request: SilentRequest & { correlationId: string },
|
|
1964
1971
|
account: AccountInfo
|
|
1965
1972
|
): Promise<AuthenticationResult> {
|
|
1973
|
+
const trackPageVisibility = () =>
|
|
1974
|
+
this.trackPageVisibility(request.correlationId);
|
|
1966
1975
|
this.performanceClient.addQueueMeasurement(
|
|
1967
1976
|
PerformanceEvents.AcquireTokenSilentAsync,
|
|
1968
1977
|
request.correlationId
|
|
@@ -1981,9 +1990,7 @@ export class StandardController implements IController {
|
|
|
1981
1990
|
);
|
|
1982
1991
|
}
|
|
1983
1992
|
|
|
1984
|
-
document.addEventListener("visibilitychange",
|
|
1985
|
-
this.trackPageVisibility(request.correlationId)
|
|
1986
|
-
);
|
|
1993
|
+
document.addEventListener("visibilitychange", trackPageVisibility);
|
|
1987
1994
|
|
|
1988
1995
|
const silentRequest = await invokeAsync(
|
|
1989
1996
|
initializeSilentRequest,
|
|
@@ -2124,8 +2131,9 @@ export class StandardController implements IController {
|
|
|
2124
2131
|
throw tokenRenewalError;
|
|
2125
2132
|
})
|
|
2126
2133
|
.finally(() => {
|
|
2127
|
-
document.removeEventListener(
|
|
2128
|
-
|
|
2134
|
+
document.removeEventListener(
|
|
2135
|
+
"visibilitychange",
|
|
2136
|
+
trackPageVisibility
|
|
2129
2137
|
);
|
|
2130
2138
|
});
|
|
2131
2139
|
}
|
|
@@ -11,7 +11,7 @@ import { AuthError } from "@azure/msal-common";
|
|
|
11
11
|
export const NestedAppAuthErrorMessage = {
|
|
12
12
|
unsupportedMethod: {
|
|
13
13
|
code: "unsupported_method",
|
|
14
|
-
desc: "
|
|
14
|
+
desc: "This method is not supported in nested app environment.",
|
|
15
15
|
},
|
|
16
16
|
};
|
|
17
17
|
|
package/src/index.ts
CHANGED
|
@@ -66,6 +66,7 @@ export { AuthorizationUrlRequest } from "./request/AuthorizationUrlRequest";
|
|
|
66
66
|
export { AuthorizationCodeRequest } from "./request/AuthorizationCodeRequest";
|
|
67
67
|
export { AuthenticationResult } from "./response/AuthenticationResult";
|
|
68
68
|
export { ClearCacheRequest } from "./request/ClearCacheRequest";
|
|
69
|
+
export { InitializeApplicationRequest } from "./request/InitializeApplicationRequest";
|
|
69
70
|
|
|
70
71
|
// Cache
|
|
71
72
|
export { LoadTokenOptions } from "./cache/TokenCache";
|
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
AuthError,
|
|
26
26
|
CommonSilentFlowRequest,
|
|
27
27
|
AccountInfo,
|
|
28
|
-
CacheRecord,
|
|
29
28
|
AADServerParamKeys,
|
|
30
29
|
TokenClaims,
|
|
31
30
|
createClientAuthError,
|
|
@@ -289,13 +288,17 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
289
288
|
this.logger.trace(
|
|
290
289
|
"NativeInteractionClient - acquireTokenRedirect called."
|
|
291
290
|
);
|
|
292
|
-
const nativeRequest = await this.initializeNativeRequest(request);
|
|
293
291
|
|
|
294
|
-
const { ...
|
|
292
|
+
const { ...remainingParameters } = request;
|
|
293
|
+
delete remainingParameters.onRedirectNavigate;
|
|
294
|
+
|
|
295
|
+
const nativeRequest = await this.initializeNativeRequest(
|
|
296
|
+
remainingParameters
|
|
297
|
+
);
|
|
295
298
|
|
|
296
299
|
const messageBody: NativeExtensionRequestBody = {
|
|
297
300
|
method: NativeExtensionMethod.GetToken,
|
|
298
|
-
request:
|
|
301
|
+
request: nativeRequest,
|
|
299
302
|
};
|
|
300
303
|
|
|
301
304
|
try {
|
|
@@ -458,8 +461,8 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
458
461
|
this.browserStorage,
|
|
459
462
|
authority,
|
|
460
463
|
homeAccountIdentifier,
|
|
461
|
-
idTokenClaims,
|
|
462
464
|
base64Decode,
|
|
465
|
+
idTokenClaims,
|
|
463
466
|
response.client_info,
|
|
464
467
|
undefined, // environment
|
|
465
468
|
idTokenClaims.tid,
|
|
@@ -739,11 +742,10 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
739
742
|
request.keyId
|
|
740
743
|
);
|
|
741
744
|
|
|
742
|
-
const nativeCacheRecord =
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
);
|
|
745
|
+
const nativeCacheRecord = {
|
|
746
|
+
idToken: cachedIdToken,
|
|
747
|
+
accessToken: cachedAccessToken,
|
|
748
|
+
};
|
|
747
749
|
|
|
748
750
|
void this.nativeStorageManager.saveCacheRecord(
|
|
749
751
|
nativeCacheRecord,
|
package/src/packageMetadata.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* InitializeApplicationRequest: Request object passed by user to initialize application
|
|
8
|
+
*
|
|
9
|
+
* - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
|
|
10
|
+
*/
|
|
11
|
+
export type InitializeApplicationRequest = {
|
|
12
|
+
correlationId?: string;
|
|
13
|
+
};
|