@azure/msal-browser 3.28.1 → 4.0.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.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 +11 -51
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +42 -291
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/CacheHelpers.d.ts +16 -0
- package/dist/cache/CacheHelpers.d.ts.map +1 -0
- package/dist/cache/CacheHelpers.mjs +46 -0
- package/dist/cache/CacheHelpers.mjs.map +1 -0
- package/dist/cache/CookieStorage.d.ts +3 -0
- package/dist/cache/CookieStorage.d.ts.map +1 -1
- package/dist/cache/CookieStorage.mjs +12 -1
- package/dist/cache/CookieStorage.mjs.map +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/ITokenCache.d.ts +1 -1
- package/dist/cache/ITokenCache.d.ts.map +1 -1
- package/dist/cache/IWindowStorage.d.ts +12 -0
- package/dist/cache/IWindowStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.d.ts +38 -1
- package/dist/cache/LocalStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.mjs +183 -2
- package/dist/cache/LocalStorage.mjs.map +1 -1
- package/dist/cache/MemoryStorage.d.ts +3 -0
- package/dist/cache/MemoryStorage.d.ts.map +1 -1
- package/dist/cache/MemoryStorage.mjs +10 -1
- package/dist/cache/MemoryStorage.mjs.map +1 -1
- package/dist/cache/SessionStorage.d.ts +3 -0
- package/dist/cache/SessionStorage.d.ts.map +1 -1
- package/dist/cache/SessionStorage.mjs +10 -1
- package/dist/cache/SessionStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.d.ts +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +16 -15
- 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 +4 -3
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +8 -6
- 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 -22
- 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 +27 -0
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +83 -3
- 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.d.ts +5 -0
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.mjs +2 -2
- package/dist/encode/Base64Decode.mjs.map +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.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +1 -2
- package/dist/index.mjs.map +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 -2
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +6 -6
- 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.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -8
- package/dist/interaction_client/StandardInteractionClient.mjs.map +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.mjs +1 -1
- package/lib/msal-browser.cjs +630 -650
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +630 -650
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +65 -66
- 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 +11 -51
- package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/types/cache/CacheHelpers.d.ts +16 -0
- package/lib/types/cache/CacheHelpers.d.ts.map +1 -0
- package/lib/types/cache/CookieStorage.d.ts +3 -0
- package/lib/types/cache/CookieStorage.d.ts.map +1 -1
- package/lib/types/cache/ITokenCache.d.ts +1 -1
- package/lib/types/cache/ITokenCache.d.ts.map +1 -1
- package/lib/types/cache/IWindowStorage.d.ts +12 -0
- package/lib/types/cache/IWindowStorage.d.ts.map +1 -1
- package/lib/types/cache/LocalStorage.d.ts +38 -1
- package/lib/types/cache/LocalStorage.d.ts.map +1 -1
- package/lib/types/cache/MemoryStorage.d.ts +3 -0
- package/lib/types/cache/MemoryStorage.d.ts.map +1 -1
- package/lib/types/cache/SessionStorage.d.ts +3 -0
- package/lib/types/cache/SessionStorage.d.ts.map +1 -1
- package/lib/types/cache/TokenCache.d.ts +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 +4 -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 +27 -0
- package/lib/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/lib/types/encode/Base64Decode.d.ts +5 -0
- package/lib/types/encode/Base64Decode.d.ts.map +1 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/interaction_client/NativeInteractionClient.d.ts +2 -2
- 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/interaction_client/StandardInteractionClient.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/package.json +2 -2
- package/src/broker/nativeBroker/NativeMessageHandler.ts +7 -7
- package/src/broker/nativeBroker/NativeResponse.ts +1 -1
- package/src/cache/BrowserCacheManager.ts +95 -422
- package/src/cache/CacheHelpers.ts +52 -0
- package/src/cache/CookieStorage.ts +18 -0
- package/src/cache/ITokenCache.ts +1 -1
- package/src/cache/IWindowStorage.ts +14 -0
- package/src/cache/LocalStorage.ts +330 -1
- package/src/cache/MemoryStorage.ts +12 -0
- package/src/cache/SessionStorage.ts +12 -0
- package/src/cache/TokenCache.ts +42 -25
- package/src/config/Configuration.ts +6 -6
- package/src/controllers/NestedAppAuthController.ts +14 -6
- package/src/controllers/StandardController.ts +41 -22
- package/src/controllers/UnknownOperatingContextController.ts +6 -5
- package/src/crypto/BrowserCrypto.ts +120 -1
- package/src/encode/Base64Decode.ts +1 -1
- package/src/index.ts +0 -1
- package/src/interaction_client/NativeInteractionClient.ts +7 -6
- 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/interaction_client/StandardInteractionClient.ts +0 -8
- 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/dist/cache/BrowserStorage.d.ts +0 -14
- package/dist/cache/BrowserStorage.d.ts.map +0 -1
- package/dist/cache/BrowserStorage.mjs +0 -46
- package/dist/cache/BrowserStorage.mjs.map +0 -1
- package/lib/types/cache/BrowserStorage.d.ts +0 -14
- package/lib/types/cache/BrowserStorage.d.ts.map +0 -1
- package/src/cache/BrowserStorage.ts +0 -52
|
@@ -529,8 +529,8 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
529
529
|
);
|
|
530
530
|
|
|
531
531
|
// cache accounts and tokens in the appropriate storage
|
|
532
|
-
this.cacheAccount(baseAccount);
|
|
533
|
-
this.cacheNativeTokens(
|
|
532
|
+
await this.cacheAccount(baseAccount);
|
|
533
|
+
await this.cacheNativeTokens(
|
|
534
534
|
response,
|
|
535
535
|
request,
|
|
536
536
|
homeAccountIdentifier,
|
|
@@ -722,9 +722,9 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
722
722
|
* cache the account entity in browser storage
|
|
723
723
|
* @param accountEntity
|
|
724
724
|
*/
|
|
725
|
-
cacheAccount(accountEntity: AccountEntity): void {
|
|
725
|
+
async cacheAccount(accountEntity: AccountEntity): Promise<void> {
|
|
726
726
|
// Store the account info and hence `nativeAccountId` in browser cache
|
|
727
|
-
this.browserStorage.setAccount(accountEntity);
|
|
727
|
+
await this.browserStorage.setAccount(accountEntity, this.correlationId);
|
|
728
728
|
|
|
729
729
|
// Remove any existing cached tokens for this account in browser storage
|
|
730
730
|
this.browserStorage.removeAccountContext(accountEntity).catch((e) => {
|
|
@@ -752,7 +752,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
752
752
|
responseAccessToken: string,
|
|
753
753
|
tenantId: string,
|
|
754
754
|
reqTimestamp: number
|
|
755
|
-
): void {
|
|
755
|
+
): Promise<void> {
|
|
756
756
|
const cachedIdToken: IdTokenEntity | null =
|
|
757
757
|
CacheHelpers.createIdTokenEntity(
|
|
758
758
|
homeAccountIdentifier,
|
|
@@ -794,8 +794,9 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
794
794
|
accessToken: cachedAccessToken,
|
|
795
795
|
};
|
|
796
796
|
|
|
797
|
-
|
|
797
|
+
return this.nativeStorageManager.saveCacheRecord(
|
|
798
798
|
nativeCacheRecord,
|
|
799
|
+
this.correlationId,
|
|
799
800
|
request.storeInCache
|
|
800
801
|
);
|
|
801
802
|
}
|
|
@@ -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,
|
|
@@ -381,14 +381,6 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
381
381
|
validatedRequest.account = account;
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
// Check for ADAL/MSAL v1 SSO
|
|
385
|
-
if (!validatedRequest.loginHint && !account) {
|
|
386
|
-
const legacyLoginHint = this.browserStorage.getLegacyLoginHint();
|
|
387
|
-
if (legacyLoginHint) {
|
|
388
|
-
validatedRequest.loginHint = legacyLoginHint;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
384
|
return validatedRequest;
|
|
393
385
|
}
|
|
394
386
|
}
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IWindowStorage } from "./IWindowStorage.js";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated This class will be removed in a future major version
|
|
4
|
-
*/
|
|
5
|
-
export declare class BrowserStorage implements IWindowStorage<string> {
|
|
6
|
-
private windowStorage;
|
|
7
|
-
constructor(cacheLocation: string);
|
|
8
|
-
getItem(key: string): string | null;
|
|
9
|
-
setItem(key: string, value: string): void;
|
|
10
|
-
removeItem(key: string): void;
|
|
11
|
-
getKeys(): string[];
|
|
12
|
-
containsKey(key: string): boolean;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=BrowserStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserStorage.d.ts","sourceRoot":"","sources":["../../src/cache/BrowserStorage.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrD;;GAEG;AACH,qBAAa,cAAe,YAAW,cAAc,CAAC,MAAM,CAAC;IACzD,OAAO,CAAC,aAAa,CAAyB;gBAElC,aAAa,EAAE,MAAM;IAYjC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAInC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B,OAAO,IAAI,MAAM,EAAE;IAInB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAGpC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.28.1 2025-01-14 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { createBrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.mjs';
|
|
4
|
-
import { BrowserCacheLocation } from '../utils/BrowserConstants.mjs';
|
|
5
|
-
import { LocalStorage } from './LocalStorage.mjs';
|
|
6
|
-
import { SessionStorage } from './SessionStorage.mjs';
|
|
7
|
-
import { storageNotSupported } from '../error/BrowserConfigurationAuthErrorCodes.mjs';
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11
|
-
* Licensed under the MIT License.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated This class will be removed in a future major version
|
|
15
|
-
*/
|
|
16
|
-
class BrowserStorage {
|
|
17
|
-
constructor(cacheLocation) {
|
|
18
|
-
if (cacheLocation === BrowserCacheLocation.LocalStorage) {
|
|
19
|
-
this.windowStorage = new LocalStorage();
|
|
20
|
-
}
|
|
21
|
-
else if (cacheLocation === BrowserCacheLocation.SessionStorage) {
|
|
22
|
-
this.windowStorage = new SessionStorage();
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
throw createBrowserConfigurationAuthError(storageNotSupported);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
getItem(key) {
|
|
29
|
-
return this.windowStorage.getItem(key);
|
|
30
|
-
}
|
|
31
|
-
setItem(key, value) {
|
|
32
|
-
this.windowStorage.setItem(key, value);
|
|
33
|
-
}
|
|
34
|
-
removeItem(key) {
|
|
35
|
-
this.windowStorage.removeItem(key);
|
|
36
|
-
}
|
|
37
|
-
getKeys() {
|
|
38
|
-
return Object.keys(this.windowStorage);
|
|
39
|
-
}
|
|
40
|
-
containsKey(key) {
|
|
41
|
-
return this.windowStorage.hasOwnProperty(key);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { BrowserStorage };
|
|
46
|
-
//# sourceMappingURL=BrowserStorage.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserStorage.mjs","sources":["../../src/cache/BrowserStorage.ts"],"sourcesContent":[null],"names":["BrowserConfigurationAuthErrorCodes.storageNotSupported"],"mappings":";;;;;;;;AAAA;;;AAGG;AAWH;;AAEG;MACU,cAAc,CAAA;AAGvB,IAAA,WAAA,CAAY,aAAqB,EAAA;AAC7B,QAAA,IAAI,aAAa,KAAK,oBAAoB,CAAC,YAAY,EAAE;AACrD,YAAA,IAAI,CAAC,aAAa,GAAG,IAAI,YAAY,EAAE,CAAC;AAC3C,SAAA;AAAM,aAAA,IAAI,aAAa,KAAK,oBAAoB,CAAC,cAAc,EAAE;AAC9D,YAAA,IAAI,CAAC,aAAa,GAAG,IAAI,cAAc,EAAE,CAAC;AAC7C,SAAA;AAAM,aAAA;AACH,YAAA,MAAM,mCAAmC,CACrCA,mBAAsD,CACzD,CAAC;AACL,SAAA;KACJ;AAED,IAAA,OAAO,CAAC,GAAW,EAAA;QACf,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;KAC1C;IAED,OAAO,CAAC,GAAW,EAAE,KAAa,EAAA;QAC9B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KAC1C;AAED,IAAA,UAAU,CAAC,GAAW,EAAA;AAClB,QAAA,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;KACtC;IAED,OAAO,GAAA;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;KAC1C;AAED,IAAA,WAAW,CAAC,GAAW,EAAA;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;KACjD;AACJ;;;;"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { IWindowStorage } from "./IWindowStorage.js";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated This class will be removed in a future major version
|
|
4
|
-
*/
|
|
5
|
-
export declare class BrowserStorage implements IWindowStorage<string> {
|
|
6
|
-
private windowStorage;
|
|
7
|
-
constructor(cacheLocation: string);
|
|
8
|
-
getItem(key: string): string | null;
|
|
9
|
-
setItem(key: string, value: string): void;
|
|
10
|
-
removeItem(key: string): void;
|
|
11
|
-
getKeys(): string[];
|
|
12
|
-
containsKey(key: string): boolean;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=BrowserStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserStorage.d.ts","sourceRoot":"","sources":["../../../src/cache/BrowserStorage.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAIrD;;GAEG;AACH,qBAAa,cAAe,YAAW,cAAc,CAAC,MAAM,CAAC;IACzD,OAAO,CAAC,aAAa,CAAyB;gBAElC,aAAa,EAAE,MAAM;IAYjC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAInC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAIzC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B,OAAO,IAAI,MAAM,EAAE;IAInB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;CAGpC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
BrowserConfigurationAuthErrorCodes,
|
|
8
|
-
createBrowserConfigurationAuthError,
|
|
9
|
-
} from "../error/BrowserConfigurationAuthError.js";
|
|
10
|
-
import { BrowserCacheLocation } from "../utils/BrowserConstants.js";
|
|
11
|
-
import { IWindowStorage } from "./IWindowStorage.js";
|
|
12
|
-
import { LocalStorage } from "./LocalStorage.js";
|
|
13
|
-
import { SessionStorage } from "./SessionStorage.js";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated This class will be removed in a future major version
|
|
17
|
-
*/
|
|
18
|
-
export class BrowserStorage implements IWindowStorage<string> {
|
|
19
|
-
private windowStorage: IWindowStorage<string>;
|
|
20
|
-
|
|
21
|
-
constructor(cacheLocation: string) {
|
|
22
|
-
if (cacheLocation === BrowserCacheLocation.LocalStorage) {
|
|
23
|
-
this.windowStorage = new LocalStorage();
|
|
24
|
-
} else if (cacheLocation === BrowserCacheLocation.SessionStorage) {
|
|
25
|
-
this.windowStorage = new SessionStorage();
|
|
26
|
-
} else {
|
|
27
|
-
throw createBrowserConfigurationAuthError(
|
|
28
|
-
BrowserConfigurationAuthErrorCodes.storageNotSupported
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getItem(key: string): string | null {
|
|
34
|
-
return this.windowStorage.getItem(key);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
setItem(key: string, value: string): void {
|
|
38
|
-
this.windowStorage.setItem(key, value);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
removeItem(key: string): void {
|
|
42
|
-
this.windowStorage.removeItem(key);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
getKeys(): string[] {
|
|
46
|
-
return Object.keys(this.windowStorage);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
containsKey(key: string): boolean {
|
|
50
|
-
return this.windowStorage.hasOwnProperty(key);
|
|
51
|
-
}
|
|
52
|
-
}
|