@azure/msal-browser 3.28.0 → 4.0.0-alpha.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 +7 -47
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +36 -285
- 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 +34 -1
- package/dist/cache/LocalStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.mjs +169 -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 +15 -15
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +4 -4
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +3 -2
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +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/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 +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +4 -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.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/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 +532 -591
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +532 -591
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +65 -66
- package/lib/types/cache/BrowserCacheManager.d.ts +7 -47
- 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 +34 -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/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/lib/types/controllers/StandardController.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 +1 -1
- package/lib/types/interaction_client/NativeInteractionClient.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/package.json +2 -2
- package/src/cache/BrowserCacheManager.ts +59 -412
- 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 +231 -1
- package/src/cache/MemoryStorage.ts +12 -0
- package/src/cache/SessionStorage.ts +12 -0
- package/src/cache/TokenCache.ts +19 -19
- package/src/controllers/NestedAppAuthController.ts +3 -3
- package/src/controllers/StandardController.ts +3 -1
- 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 +3 -3
- package/src/interaction_client/StandardInteractionClient.ts +0 -8
- package/src/packageMetadata.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
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "@azure/msal-common/browser";
|
|
14
14
|
import { KEY_FORMAT_JWK } from "../utils/BrowserConstants.js";
|
|
15
15
|
import { urlEncodeArr } from "../encode/Base64Encode.js";
|
|
16
|
+
import { base64DecToArr } from "../encode/Base64Decode.js";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* This file defines functions used by the browser library to perform cryptography operations such as
|
|
@@ -22,8 +23,10 @@ import { urlEncodeArr } from "../encode/Base64Encode.js";
|
|
|
22
23
|
/**
|
|
23
24
|
* See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams
|
|
24
25
|
*/
|
|
25
|
-
//
|
|
26
|
+
// Algorithms
|
|
26
27
|
const PKCS1_V15_KEYGEN_ALG = "RSASSA-PKCS1-v1_5";
|
|
28
|
+
const AES_GCM = "AES-GCM";
|
|
29
|
+
const HKDF = "HKDF";
|
|
27
30
|
// SHA-256 hashing algorithm
|
|
28
31
|
const S256_HASH_ALG = "SHA-256";
|
|
29
32
|
// MOD length for PoP tokens
|
|
@@ -35,6 +38,14 @@ const UUID_CHARS = "0123456789abcdef";
|
|
|
35
38
|
// Array to store UINT32 random value
|
|
36
39
|
const UINT32_ARR = new Uint32Array(1);
|
|
37
40
|
|
|
41
|
+
// Key Format
|
|
42
|
+
const RAW = "raw";
|
|
43
|
+
// Key Usages
|
|
44
|
+
const ENCRYPT = "encrypt";
|
|
45
|
+
const DECRYPT = "decrypt";
|
|
46
|
+
const DERIVE_KEY = "deriveKey";
|
|
47
|
+
|
|
48
|
+
// Suberror
|
|
38
49
|
const SUBTLE_SUBERROR = "crypto_subtle_undefined";
|
|
39
50
|
|
|
40
51
|
const keygenAlgorithmOptions: RsaHashedKeyGenParams = {
|
|
@@ -213,6 +224,114 @@ export async function sign(
|
|
|
213
224
|
) as Promise<ArrayBuffer>;
|
|
214
225
|
}
|
|
215
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Generates symmetric base encryption key. This may be stored as all encryption/decryption keys will be derived from this one.
|
|
229
|
+
*/
|
|
230
|
+
export async function generateBaseKey(): Promise<ArrayBuffer> {
|
|
231
|
+
const key = await window.crypto.subtle.generateKey(
|
|
232
|
+
{
|
|
233
|
+
name: AES_GCM,
|
|
234
|
+
length: 256,
|
|
235
|
+
},
|
|
236
|
+
true,
|
|
237
|
+
[ENCRYPT, DECRYPT]
|
|
238
|
+
);
|
|
239
|
+
return window.crypto.subtle.exportKey(RAW, key);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Returns the raw key to be passed into the key derivation function
|
|
244
|
+
* @param baseKey
|
|
245
|
+
* @returns
|
|
246
|
+
*/
|
|
247
|
+
export async function generateHKDF(baseKey: ArrayBuffer): Promise<CryptoKey> {
|
|
248
|
+
return window.crypto.subtle.importKey(RAW, baseKey, HKDF, false, [
|
|
249
|
+
DERIVE_KEY,
|
|
250
|
+
]);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Given a base key and a nonce generates a derived key to be used in encryption and decryption.
|
|
255
|
+
* Note: every time we encrypt a new key is derived
|
|
256
|
+
* @param baseKey
|
|
257
|
+
* @param nonce
|
|
258
|
+
* @returns
|
|
259
|
+
*/
|
|
260
|
+
async function deriveKey(
|
|
261
|
+
baseKey: CryptoKey,
|
|
262
|
+
nonce: ArrayBuffer,
|
|
263
|
+
context: string
|
|
264
|
+
): Promise<CryptoKey> {
|
|
265
|
+
return window.crypto.subtle.deriveKey(
|
|
266
|
+
{
|
|
267
|
+
name: HKDF,
|
|
268
|
+
salt: nonce,
|
|
269
|
+
hash: S256_HASH_ALG,
|
|
270
|
+
info: new TextEncoder().encode(context),
|
|
271
|
+
},
|
|
272
|
+
baseKey,
|
|
273
|
+
{ name: AES_GCM, length: 256 },
|
|
274
|
+
false,
|
|
275
|
+
[ENCRYPT, DECRYPT]
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Encrypt the given data given a base key. Returns encrypted data and a nonce that must be provided during decryption
|
|
281
|
+
* @param key
|
|
282
|
+
* @param rawData
|
|
283
|
+
*/
|
|
284
|
+
export async function encrypt(
|
|
285
|
+
baseKey: CryptoKey,
|
|
286
|
+
rawData: string,
|
|
287
|
+
context: string
|
|
288
|
+
): Promise<{ data: string; nonce: string }> {
|
|
289
|
+
const encodedData = new TextEncoder().encode(rawData);
|
|
290
|
+
// The nonce must never be reused with a given key.
|
|
291
|
+
const nonce = window.crypto.getRandomValues(new Uint8Array(16));
|
|
292
|
+
const derivedKey = await deriveKey(baseKey, nonce, context);
|
|
293
|
+
const encryptedData = await window.crypto.subtle.encrypt(
|
|
294
|
+
{
|
|
295
|
+
name: AES_GCM,
|
|
296
|
+
iv: new Uint8Array(12), // New key is derived for every encrypt so we don't need a new nonce
|
|
297
|
+
},
|
|
298
|
+
derivedKey,
|
|
299
|
+
encodedData
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
return {
|
|
303
|
+
data: urlEncodeArr(new Uint8Array(encryptedData)),
|
|
304
|
+
nonce: urlEncodeArr(nonce),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Decrypt data with the given key and nonce
|
|
310
|
+
* @param key
|
|
311
|
+
* @param nonce
|
|
312
|
+
* @param encryptedData
|
|
313
|
+
* @returns
|
|
314
|
+
*/
|
|
315
|
+
export async function decrypt(
|
|
316
|
+
baseKey: CryptoKey,
|
|
317
|
+
nonce: string,
|
|
318
|
+
context: string,
|
|
319
|
+
encryptedData: string
|
|
320
|
+
): Promise<string> {
|
|
321
|
+
const encodedData = base64DecToArr(encryptedData);
|
|
322
|
+
const derivedKey = await deriveKey(baseKey, base64DecToArr(nonce), context);
|
|
323
|
+
const decryptedData = await window.crypto.subtle.decrypt(
|
|
324
|
+
{
|
|
325
|
+
name: AES_GCM,
|
|
326
|
+
iv: new Uint8Array(12), // New key is derived for every encrypt so we don't need a new nonce
|
|
327
|
+
},
|
|
328
|
+
derivedKey,
|
|
329
|
+
encodedData
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
return new TextDecoder().decode(decryptedData);
|
|
333
|
+
}
|
|
334
|
+
|
|
216
335
|
/**
|
|
217
336
|
* Returns the SHA-256 hash of an input string
|
|
218
337
|
* @param plainText
|
|
@@ -25,7 +25,7 @@ export function base64Decode(input: string): string {
|
|
|
25
25
|
* Decodes base64 into Uint8Array
|
|
26
26
|
* @param base64String
|
|
27
27
|
*/
|
|
28
|
-
function base64DecToArr(base64String: string): Uint8Array {
|
|
28
|
+
export function base64DecToArr(base64String: string): Uint8Array {
|
|
29
29
|
let encodedString = base64String.replace(/-/g, "+").replace(/_/g, "/");
|
|
30
30
|
switch (encodedString.length % 4) {
|
|
31
31
|
case 0:
|
package/src/index.ts
CHANGED
|
@@ -74,7 +74,6 @@ export { ITokenCache } from "./cache/ITokenCache.js";
|
|
|
74
74
|
|
|
75
75
|
// Storage
|
|
76
76
|
export { MemoryStorage } from "./cache/MemoryStorage.js";
|
|
77
|
-
export { BrowserStorage } from "./cache/BrowserStorage.js";
|
|
78
77
|
export { LocalStorage } from "./cache/LocalStorage.js";
|
|
79
78
|
export { SessionStorage } from "./cache/SessionStorage.js";
|
|
80
79
|
export { IWindowStorage } from "./cache/IWindowStorage.js";
|
|
@@ -529,7 +529,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
529
529
|
);
|
|
530
530
|
|
|
531
531
|
// cache accounts and tokens in the appropriate storage
|
|
532
|
-
this.cacheAccount(baseAccount);
|
|
532
|
+
await this.cacheAccount(baseAccount);
|
|
533
533
|
this.cacheNativeTokens(
|
|
534
534
|
response,
|
|
535
535
|
request,
|
|
@@ -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);
|
|
728
728
|
|
|
729
729
|
// Remove any existing cached tokens for this account in browser storage
|
|
730
730
|
this.browserStorage.removeAccountContext(accountEntity).catch((e) => {
|
|
@@ -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
|
@@ -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.0 2024-12-12 */
|
|
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
|
-
}
|