@azure/msal-browser 4.0.0-alpha.0 → 4.0.2
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 +4 -2
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +8 -8
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeResponse.d.ts +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 +10 -15
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +42 -43
- 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/CookieStorage.mjs.map +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/IWindowStorage.d.ts +2 -2
- package/dist/cache/IWindowStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.d.ts +7 -3
- package/dist/cache/LocalStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.mjs +48 -34
- package/dist/cache/LocalStorage.mjs.map +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.mjs +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +15 -14
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +2 -2
- package/dist/config/Configuration.d.ts.map +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 +6 -3
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +34 -18
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts +2 -2
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +27 -23
- 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 +3 -3
- package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +1 -1
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +3 -3
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +1 -1
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +3 -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/NativeAuthError.mjs.map +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 +2 -3
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +11 -9
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +4 -4
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +2 -2
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +2 -2
- package/dist/interaction_client/SilentIframeClient.mjs.map +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.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
- 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.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +4 -2
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +298 -249
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +298 -249
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +63 -63
- package/lib/types/app/PublicClientApplication.d.ts.map +1 -1
- package/lib/types/broker/nativeBroker/NativeMessageHandler.d.ts +1 -1
- package/lib/types/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/lib/types/broker/nativeBroker/NativeResponse.d.ts +1 -1
- package/lib/types/cache/BrowserCacheManager.d.ts +10 -15
- package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/types/cache/IWindowStorage.d.ts +2 -2
- package/lib/types/cache/IWindowStorage.d.ts.map +1 -1
- package/lib/types/cache/LocalStorage.d.ts +7 -3
- package/lib/types/cache/LocalStorage.d.ts.map +1 -1
- package/lib/types/cache/TokenCache.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +2 -2
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/controllers/NestedAppAuthController.d.ts +6 -3
- package/lib/types/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/lib/types/controllers/StandardController.d.ts +2 -2
- 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 +1 -1
- package/lib/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/lib/types/crypto/CryptoOps.d.ts +1 -1
- package/lib/types/crypto/CryptoOps.d.ts.map +1 -1
- package/lib/types/interaction_client/NativeInteractionClient.d.ts +2 -3
- package/lib/types/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/PopupClient.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/packageMetadata.d.ts.map +1 -1
- package/lib/types/request/AuthorizationUrlRequest.d.ts +1 -1
- 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/BrowserUtils.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/app/PublicClientApplication.ts +6 -1
- package/src/broker/nativeBroker/NativeMessageHandler.ts +7 -7
- package/src/broker/nativeBroker/NativeResponse.ts +1 -1
- package/src/cache/BrowserCacheManager.ts +88 -57
- package/src/cache/IWindowStorage.ts +2 -2
- package/src/cache/LocalStorage.ts +142 -43
- package/src/cache/TokenCache.ts +28 -11
- package/src/config/Configuration.ts +6 -6
- package/src/controllers/NestedAppAuthController.ts +51 -23
- package/src/controllers/StandardController.ts +41 -24
- package/src/controllers/UnknownOperatingContextController.ts +6 -5
- package/src/crypto/BrowserCrypto.ts +4 -2
- package/src/crypto/CryptoOps.ts +8 -2
- package/src/interaction_client/NativeInteractionClient.ts +16 -16
- package/src/interaction_client/PopupClient.ts +9 -8
- package/src/interaction_client/RedirectClient.ts +1 -1
- package/src/interaction_client/SilentIframeClient.ts +1 -1
- package/src/packageMetadata.ts +1 -1
- package/src/request/AuthorizationUrlRequest.ts +1 -1
- package/src/request/PopupRequest.ts +1 -1
- package/src/request/RedirectRequest.ts +1 -1
- package/src/request/SsoSilentRequest.ts +1 -1
- package/src/utils/BrowserUtils.ts +3 -1
|
@@ -83,7 +83,6 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
83
83
|
protected silentCacheClient: SilentCacheClient;
|
|
84
84
|
protected nativeStorageManager: BrowserCacheManager;
|
|
85
85
|
protected skus: string;
|
|
86
|
-
protected serverTelemetryManager: ServerTelemetryManager;
|
|
87
86
|
|
|
88
87
|
constructor(
|
|
89
88
|
config: BrowserConfiguration,
|
|
@@ -125,9 +124,6 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
125
124
|
provider,
|
|
126
125
|
correlationId
|
|
127
126
|
);
|
|
128
|
-
this.serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
129
|
-
this.apiId
|
|
130
|
-
);
|
|
131
127
|
|
|
132
128
|
const extensionName =
|
|
133
129
|
this.nativeMessageHandler.getExtensionId() ===
|
|
@@ -176,6 +172,9 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
176
172
|
);
|
|
177
173
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
178
174
|
|
|
175
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
176
|
+
this.apiId
|
|
177
|
+
);
|
|
179
178
|
try {
|
|
180
179
|
// initialize native request
|
|
181
180
|
const nativeRequest = await this.initializeNativeRequest(request);
|
|
@@ -223,7 +222,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
223
222
|
isNativeBroker: true,
|
|
224
223
|
requestId: result.requestId,
|
|
225
224
|
});
|
|
226
|
-
|
|
225
|
+
serverTelemetryManager.clearNativeBrokerErrorCode();
|
|
227
226
|
return result;
|
|
228
227
|
})
|
|
229
228
|
.catch((error: AuthError) => {
|
|
@@ -237,9 +236,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
237
236
|
});
|
|
238
237
|
} catch (e) {
|
|
239
238
|
if (e instanceof NativeAuthError) {
|
|
240
|
-
|
|
241
|
-
e.errorCode
|
|
242
|
-
);
|
|
239
|
+
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
243
240
|
}
|
|
244
241
|
throw e;
|
|
245
242
|
}
|
|
@@ -346,9 +343,9 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
346
343
|
} catch (e) {
|
|
347
344
|
// Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
|
|
348
345
|
if (e instanceof NativeAuthError) {
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
);
|
|
346
|
+
const serverTelemetryManager =
|
|
347
|
+
this.initializeServerTelemetryManager(this.apiId);
|
|
348
|
+
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
352
349
|
if (isFatalNativeAuthError(e)) {
|
|
353
350
|
throw e;
|
|
354
351
|
}
|
|
@@ -443,7 +440,9 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
443
440
|
);
|
|
444
441
|
this.browserStorage.setInteractionInProgress(false);
|
|
445
442
|
const res = await result;
|
|
446
|
-
|
|
443
|
+
const serverTelemetryManager =
|
|
444
|
+
this.initializeServerTelemetryManager(this.apiId);
|
|
445
|
+
serverTelemetryManager.clearNativeBrokerErrorCode();
|
|
447
446
|
return res;
|
|
448
447
|
} catch (e) {
|
|
449
448
|
this.browserStorage.setInteractionInProgress(false);
|
|
@@ -530,7 +529,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
530
529
|
|
|
531
530
|
// cache accounts and tokens in the appropriate storage
|
|
532
531
|
await this.cacheAccount(baseAccount);
|
|
533
|
-
this.cacheNativeTokens(
|
|
532
|
+
await this.cacheNativeTokens(
|
|
534
533
|
response,
|
|
535
534
|
request,
|
|
536
535
|
homeAccountIdentifier,
|
|
@@ -724,7 +723,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
724
723
|
*/
|
|
725
724
|
async cacheAccount(accountEntity: AccountEntity): Promise<void> {
|
|
726
725
|
// Store the account info and hence `nativeAccountId` in browser cache
|
|
727
|
-
await this.browserStorage.setAccount(accountEntity);
|
|
726
|
+
await this.browserStorage.setAccount(accountEntity, this.correlationId);
|
|
728
727
|
|
|
729
728
|
// Remove any existing cached tokens for this account in browser storage
|
|
730
729
|
this.browserStorage.removeAccountContext(accountEntity).catch((e) => {
|
|
@@ -752,7 +751,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
752
751
|
responseAccessToken: string,
|
|
753
752
|
tenantId: string,
|
|
754
753
|
reqTimestamp: number
|
|
755
|
-
): void {
|
|
754
|
+
): Promise<void> {
|
|
756
755
|
const cachedIdToken: IdTokenEntity | null =
|
|
757
756
|
CacheHelpers.createIdTokenEntity(
|
|
758
757
|
homeAccountIdentifier,
|
|
@@ -794,8 +793,9 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
794
793
|
accessToken: cachedAccessToken,
|
|
795
794
|
};
|
|
796
795
|
|
|
797
|
-
|
|
796
|
+
return this.nativeStorageManager.saveCacheRecord(
|
|
798
797
|
nativeCacheRecord,
|
|
798
|
+
this.correlationId,
|
|
799
799
|
request.storeInCache
|
|
800
800
|
);
|
|
801
801
|
}
|
|
@@ -227,15 +227,16 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
227
227
|
account: validRequest.account,
|
|
228
228
|
});
|
|
229
229
|
|
|
230
|
-
const
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
230
|
+
const isPlatformBroker =
|
|
231
|
+
NativeMessageHandler.isPlatformBrokerAvailable(
|
|
232
|
+
this.config,
|
|
233
|
+
this.logger,
|
|
234
|
+
this.nativeMessageHandler,
|
|
235
|
+
request.authenticationScheme
|
|
236
|
+
);
|
|
236
237
|
// Start measurement for server calls with native brokering enabled
|
|
237
238
|
let fetchNativeAccountIdMeasurement;
|
|
238
|
-
if (
|
|
239
|
+
if (isPlatformBroker) {
|
|
239
240
|
fetchNativeAccountIdMeasurement =
|
|
240
241
|
this.performanceClient.startMeasurement(
|
|
241
242
|
PerformanceEvents.FetchAccountIdWithNativeBroker,
|
|
@@ -246,7 +247,7 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
246
247
|
// Create acquire token url.
|
|
247
248
|
const navigateUrl = await authClient.getAuthCodeUrl({
|
|
248
249
|
...validRequest,
|
|
249
|
-
|
|
250
|
+
platformBroker: isPlatformBroker,
|
|
250
251
|
});
|
|
251
252
|
|
|
252
253
|
// Create popup interaction handler.
|
|
@@ -170,7 +170,7 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
170
170
|
// Create acquire token url.
|
|
171
171
|
const navigateUrl = await authClient.getAuthCodeUrl({
|
|
172
172
|
...validRequest,
|
|
173
|
-
|
|
173
|
+
platformBroker: NativeMessageHandler.isPlatformBrokerAvailable(
|
|
174
174
|
this.config,
|
|
175
175
|
this.logger,
|
|
176
176
|
this.nativeMessageHandler,
|
|
@@ -239,7 +239,7 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
239
239
|
correlationId
|
|
240
240
|
)({
|
|
241
241
|
...silentRequest,
|
|
242
|
-
|
|
242
|
+
platformBroker: NativeMessageHandler.isPlatformBrokerAvailable(
|
|
243
243
|
this.config,
|
|
244
244
|
this.logger,
|
|
245
245
|
this.nativeMessageHandler,
|
package/src/packageMetadata.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { CommonAuthorizationUrlRequest } from "@azure/msal-common/browser";
|
|
|
10
10
|
*/
|
|
11
11
|
export type AuthorizationUrlRequest = Omit<
|
|
12
12
|
CommonAuthorizationUrlRequest,
|
|
13
|
-
"state" | "nonce" | "requestedClaimsHash" | "
|
|
13
|
+
"state" | "nonce" | "requestedClaimsHash" | "platformBroker"
|
|
14
14
|
> & {
|
|
15
15
|
state: string;
|
|
16
16
|
nonce: string;
|
|
@@ -67,7 +67,9 @@ export function isInPopup(): boolean {
|
|
|
67
67
|
* Returns current window URL as redirect uri
|
|
68
68
|
*/
|
|
69
69
|
export function getCurrentUri(): string {
|
|
70
|
-
return window
|
|
70
|
+
return typeof window !== "undefined" && window.location
|
|
71
|
+
? window.location.href.split("?")[0].split("#")[0]
|
|
72
|
+
: "";
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
/**
|