@azure/msal-browser 3.18.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 +4 -3
- 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.mjs +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 +8 -6
- 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 +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 +5 -4
- 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 +89 -80
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +89 -80
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +59 -59
- package/package.json +1 -1
- package/src/app/IPublicClientApplication.ts +3 -1
- package/src/app/PublicClientApplication.ts +9 -3
- package/src/cache/BrowserCacheManager.ts +5 -2
- package/src/controllers/ControllerFactory.ts +4 -2
- package/src/controllers/IController.ts +3 -1
- package/src/controllers/StandardController.ts +13 -6
- package/src/index.ts +1 -0
- package/src/interaction_client/NativeInteractionClient.ts +7 -3
- package/src/packageMetadata.ts +1 -1
- package/src/request/InitializeApplicationRequest.ts +13 -0
package/package.json
CHANGED
|
@@ -27,9 +27,11 @@ import { BrowserConfiguration } from "../config/Configuration";
|
|
|
27
27
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
28
28
|
import { EventCallbackFunction } from "../event/EventMessage";
|
|
29
29
|
import { ClearCacheRequest } from "../request/ClearCacheRequest";
|
|
30
|
+
import { InitializeApplicationRequest } from "../request/InitializeApplicationRequest";
|
|
30
31
|
|
|
31
32
|
export interface IPublicClientApplication {
|
|
32
|
-
|
|
33
|
+
// TODO: Make request mandatory in the next major version?
|
|
34
|
+
initialize(request?: InitializeApplicationRequest): Promise<void>;
|
|
33
35
|
acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;
|
|
34
36
|
acquireTokenRedirect(request: RedirectRequest): Promise<void>;
|
|
35
37
|
acquireTokenSilent(
|
|
@@ -30,6 +30,7 @@ import { ClearCacheRequest } from "../request/ClearCacheRequest";
|
|
|
30
30
|
import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest";
|
|
31
31
|
import { NestedAppAuthController } from "../controllers/NestedAppAuthController";
|
|
32
32
|
import { NestedAppOperatingContext } from "../operatingcontext/NestedAppOperatingContext";
|
|
33
|
+
import { InitializeApplicationRequest } from "../request/InitializeApplicationRequest";
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications
|
|
@@ -38,7 +39,11 @@ import { NestedAppOperatingContext } from "../operatingcontext/NestedAppOperatin
|
|
|
38
39
|
export class PublicClientApplication implements IPublicClientApplication {
|
|
39
40
|
protected controller: IController;
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Creates StandardController and passes it to the PublicClientApplication
|
|
44
|
+
*
|
|
45
|
+
* @param configuration {Configuration}
|
|
46
|
+
*/
|
|
42
47
|
public static async createPublicClientApplication(
|
|
43
48
|
configuration: Configuration
|
|
44
49
|
): Promise<IPublicClientApplication> {
|
|
@@ -80,9 +85,10 @@ export class PublicClientApplication implements IPublicClientApplication {
|
|
|
80
85
|
|
|
81
86
|
/**
|
|
82
87
|
* Initializer function to perform async startup tasks such as connecting to WAM extension
|
|
88
|
+
* @param request {?InitializeApplicationRequest}
|
|
83
89
|
*/
|
|
84
|
-
async initialize(): Promise<void> {
|
|
85
|
-
return this.controller.initialize();
|
|
90
|
+
async initialize(request?: InitializeApplicationRequest): Promise<void> {
|
|
91
|
+
return this.controller.initialize(request);
|
|
86
92
|
}
|
|
87
93
|
|
|
88
94
|
/**
|
|
@@ -1266,13 +1266,16 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1266
1266
|
/**
|
|
1267
1267
|
* Clears all access tokes that have claims prior to saving the current one
|
|
1268
1268
|
* @param performanceClient {IPerformanceClient}
|
|
1269
|
+
* @param correlationId {string} correlation id
|
|
1269
1270
|
* @returns
|
|
1270
1271
|
*/
|
|
1271
1272
|
async clearTokensAndKeysWithClaims(
|
|
1272
|
-
performanceClient: IPerformanceClient
|
|
1273
|
+
performanceClient: IPerformanceClient,
|
|
1274
|
+
correlationId: string
|
|
1273
1275
|
): Promise<void> {
|
|
1274
1276
|
performanceClient.addQueueMeasurement(
|
|
1275
|
-
PerformanceEvents.ClearTokensAndKeysWithClaims
|
|
1277
|
+
PerformanceEvents.ClearTokensAndKeysWithClaims,
|
|
1278
|
+
correlationId
|
|
1276
1279
|
);
|
|
1277
1280
|
|
|
1278
1281
|
const tokenKeys = this.getTokenKeys();
|
|
@@ -9,14 +9,16 @@ import { IController } from "./IController";
|
|
|
9
9
|
import { Configuration } from "../config/Configuration";
|
|
10
10
|
import { StandardController } from "./StandardController";
|
|
11
11
|
import { NestedAppAuthController } from "./NestedAppAuthController";
|
|
12
|
+
import { InitializeApplicationRequest } from "../request/InitializeApplicationRequest";
|
|
12
13
|
|
|
13
14
|
export async function createV3Controller(
|
|
14
|
-
config: Configuration
|
|
15
|
+
config: Configuration,
|
|
16
|
+
request?: InitializeApplicationRequest
|
|
15
17
|
): Promise<IController> {
|
|
16
18
|
const standard = new StandardOperatingContext(config);
|
|
17
19
|
|
|
18
20
|
await standard.initialize();
|
|
19
|
-
return StandardController.createController(standard);
|
|
21
|
+
return StandardController.createController(standard, request);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export async function createController(
|
|
@@ -25,9 +25,11 @@ import { EventHandler } from "../event/EventHandler";
|
|
|
25
25
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
26
26
|
import { EventCallbackFunction } from "../event/EventMessage";
|
|
27
27
|
import { ClearCacheRequest } from "../request/ClearCacheRequest";
|
|
28
|
+
import { InitializeApplicationRequest } from "../request/InitializeApplicationRequest";
|
|
28
29
|
|
|
29
30
|
export interface IController {
|
|
30
|
-
|
|
31
|
+
// TODO: Make request mandatory in the next major version?
|
|
32
|
+
initialize(request?: InitializeApplicationRequest): Promise<void>;
|
|
31
33
|
|
|
32
34
|
acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;
|
|
33
35
|
|
|
@@ -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;
|
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";
|
|
@@ -288,13 +288,17 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
288
288
|
this.logger.trace(
|
|
289
289
|
"NativeInteractionClient - acquireTokenRedirect called."
|
|
290
290
|
);
|
|
291
|
-
const nativeRequest = await this.initializeNativeRequest(request);
|
|
292
291
|
|
|
293
|
-
const { ...
|
|
292
|
+
const { ...remainingParameters } = request;
|
|
293
|
+
delete remainingParameters.onRedirectNavigate;
|
|
294
|
+
|
|
295
|
+
const nativeRequest = await this.initializeNativeRequest(
|
|
296
|
+
remainingParameters
|
|
297
|
+
);
|
|
294
298
|
|
|
295
299
|
const messageBody: NativeExtensionRequestBody = {
|
|
296
300
|
method: NativeExtensionMethod.GetToken,
|
|
297
|
-
request:
|
|
301
|
+
request: nativeRequest,
|
|
298
302
|
};
|
|
299
303
|
|
|
300
304
|
try {
|
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
|
+
};
|