@azure/msal-browser 3.27.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 +9 -85
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +55 -398
- 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 +17 -0
- package/dist/cache/CookieStorage.d.ts.map +1 -0
- package/dist/cache/CookieStorage.mjs +73 -0
- package/dist/cache/CookieStorage.mjs.map +1 -0
- 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 +43 -0
- package/dist/cache/LocalStorage.d.ts.map +1 -0
- package/dist/cache/LocalStorage.mjs +201 -0
- package/dist/cache/LocalStorage.mjs.map +1 -0
- 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 +13 -0
- package/dist/cache/SessionStorage.d.ts.map +1 -0
- package/dist/cache/SessionStorage.mjs +43 -0
- package/dist/cache/SessionStorage.mjs.map +1 -0
- 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 +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +3 -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 +5 -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 +587 -622
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +587 -622
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +65 -66
- package/lib/types/cache/BrowserCacheManager.d.ts +9 -85
- 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 +17 -0
- package/lib/types/cache/CookieStorage.d.ts.map +1 -0
- 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 +43 -0
- package/lib/types/cache/LocalStorage.d.ts.map +1 -0
- 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 +13 -0
- package/lib/types/cache/SessionStorage.d.ts.map +1 -0
- 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 +3 -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 +85 -552
- package/src/cache/CacheHelpers.ts +52 -0
- package/src/cache/CookieStorage.ts +98 -0
- package/src/cache/ITokenCache.ts +1 -1
- package/src/cache/IWindowStorage.ts +14 -0
- package/src/cache/LocalStorage.ts +270 -0
- package/src/cache/MemoryStorage.ts +12 -0
- package/src/cache/SessionStorage.ts +52 -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 +3 -1
- package/src/interaction_client/NativeInteractionClient.ts +3 -3
- package/src/interaction_client/StandardInteractionClient.ts +5 -8
- package/src/packageMetadata.ts +1 -1
- package/dist/cache/BrowserStorage.d.ts +0 -12
- package/dist/cache/BrowserStorage.d.ts.map +0 -1
- package/dist/cache/BrowserStorage.mjs +0 -41
- package/dist/cache/BrowserStorage.mjs.map +0 -1
- package/lib/types/cache/BrowserStorage.d.ts +0 -12
- package/lib/types/cache/BrowserStorage.d.ts.map +0 -1
- package/src/cache/BrowserStorage.ts +0 -52
|
@@ -157,8 +157,8 @@ export class NestedAppAuthController implements IController {
|
|
|
157
157
|
* Specific implementation of initialize function for NestedAppAuthController
|
|
158
158
|
* @returns
|
|
159
159
|
*/
|
|
160
|
-
initialize(): Promise<void> {
|
|
161
|
-
|
|
160
|
+
async initialize(): Promise<void> {
|
|
161
|
+
await this.browserStorage.initialize();
|
|
162
162
|
return Promise.resolve();
|
|
163
163
|
}
|
|
164
164
|
|
|
@@ -842,7 +842,7 @@ export class NestedAppAuthController implements IController {
|
|
|
842
842
|
result.cloudGraphHostName,
|
|
843
843
|
result.msGraphHost
|
|
844
844
|
);
|
|
845
|
-
this.browserStorage.setAccount(accountEntity);
|
|
845
|
+
await this.browserStorage.setAccount(accountEntity);
|
|
846
846
|
return this.browserStorage.hydrateCache(result, request);
|
|
847
847
|
}
|
|
848
848
|
}
|
|
@@ -331,6 +331,8 @@ export class StandardController implements IController {
|
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
await this.browserStorage.initialize();
|
|
335
|
+
|
|
334
336
|
const initCorrelationId =
|
|
335
337
|
request?.correlationId || this.getRequestCorrelationId();
|
|
336
338
|
const allowNativeBroker = this.config.system.allowNativeBroker;
|
|
@@ -1472,7 +1474,7 @@ export class StandardController implements IController {
|
|
|
1472
1474
|
result.cloudGraphHostName,
|
|
1473
1475
|
result.msGraphHost
|
|
1474
1476
|
);
|
|
1475
|
-
this.browserStorage.setAccount(accountEntity);
|
|
1477
|
+
await this.browserStorage.setAccount(accountEntity);
|
|
1476
1478
|
|
|
1477
1479
|
if (result.fromNativeBroker) {
|
|
1478
1480
|
this.logger.verbose(
|
|
@@ -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,9 @@ export { ITokenCache } from "./cache/ITokenCache.js";
|
|
|
74
74
|
|
|
75
75
|
// Storage
|
|
76
76
|
export { MemoryStorage } from "./cache/MemoryStorage.js";
|
|
77
|
-
export {
|
|
77
|
+
export { LocalStorage } from "./cache/LocalStorage.js";
|
|
78
|
+
export { SessionStorage } from "./cache/SessionStorage.js";
|
|
79
|
+
export { IWindowStorage } from "./cache/IWindowStorage.js";
|
|
78
80
|
|
|
79
81
|
// Events
|
|
80
82
|
export {
|
|
@@ -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) => {
|
|
@@ -362,6 +362,11 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
362
362
|
.serverResponseType as ResponseMode,
|
|
363
363
|
};
|
|
364
364
|
|
|
365
|
+
// Skip active account lookup if either login hint or session id is set
|
|
366
|
+
if (request.loginHint || request.sid) {
|
|
367
|
+
return validatedRequest;
|
|
368
|
+
}
|
|
369
|
+
|
|
365
370
|
const account =
|
|
366
371
|
request.account || this.browserStorage.getActiveAccount();
|
|
367
372
|
if (account) {
|
|
@@ -376,14 +381,6 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
376
381
|
validatedRequest.account = account;
|
|
377
382
|
}
|
|
378
383
|
|
|
379
|
-
// Check for ADAL/MSAL v1 SSO
|
|
380
|
-
if (!validatedRequest.loginHint && !account) {
|
|
381
|
-
const legacyLoginHint = this.browserStorage.getLegacyLoginHint();
|
|
382
|
-
if (legacyLoginHint) {
|
|
383
|
-
validatedRequest.loginHint = legacyLoginHint;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
384
|
return validatedRequest;
|
|
388
385
|
}
|
|
389
386
|
}
|
package/src/packageMetadata.ts
CHANGED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { IWindowStorage } from "./IWindowStorage.js";
|
|
2
|
-
export declare class BrowserStorage implements IWindowStorage<string> {
|
|
3
|
-
private windowStorage;
|
|
4
|
-
constructor(cacheLocation: string);
|
|
5
|
-
private validateWindowStorage;
|
|
6
|
-
getItem(key: string): string | null;
|
|
7
|
-
setItem(key: string, value: string): void;
|
|
8
|
-
removeItem(key: string): void;
|
|
9
|
-
getKeys(): string[];
|
|
10
|
-
containsKey(key: string): boolean;
|
|
11
|
-
}
|
|
12
|
-
//# 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;AAErD,qBAAa,cAAe,YAAW,cAAc,CAAC,MAAM,CAAC;IACzD,OAAO,CAAC,aAAa,CAAU;gBAEnB,aAAa,EAAE,MAAM;IAKjC,OAAO,CAAC,qBAAqB;IAY7B,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,41 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.27.0 2024-11-05 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { createBrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.mjs';
|
|
4
|
-
import { BrowserCacheLocation } from '../utils/BrowserConstants.mjs';
|
|
5
|
-
import { storageNotSupported } from '../error/BrowserConfigurationAuthErrorCodes.mjs';
|
|
6
|
-
|
|
7
|
-
/*
|
|
8
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9
|
-
* Licensed under the MIT License.
|
|
10
|
-
*/
|
|
11
|
-
class BrowserStorage {
|
|
12
|
-
constructor(cacheLocation) {
|
|
13
|
-
this.validateWindowStorage(cacheLocation);
|
|
14
|
-
this.windowStorage = window[cacheLocation];
|
|
15
|
-
}
|
|
16
|
-
validateWindowStorage(cacheLocation) {
|
|
17
|
-
if ((cacheLocation !== BrowserCacheLocation.LocalStorage &&
|
|
18
|
-
cacheLocation !== BrowserCacheLocation.SessionStorage) ||
|
|
19
|
-
!window[cacheLocation]) {
|
|
20
|
-
throw createBrowserConfigurationAuthError(storageNotSupported);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
getItem(key) {
|
|
24
|
-
return this.windowStorage.getItem(key);
|
|
25
|
-
}
|
|
26
|
-
setItem(key, value) {
|
|
27
|
-
this.windowStorage.setItem(key, value);
|
|
28
|
-
}
|
|
29
|
-
removeItem(key) {
|
|
30
|
-
this.windowStorage.removeItem(key);
|
|
31
|
-
}
|
|
32
|
-
getKeys() {
|
|
33
|
-
return Object.keys(this.windowStorage);
|
|
34
|
-
}
|
|
35
|
-
containsKey(key) {
|
|
36
|
-
return this.windowStorage.hasOwnProperty(key);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export { BrowserStorage };
|
|
41
|
-
//# 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;MASU,cAAc,CAAA;AAGvB,IAAA,WAAA,CAAY,aAAqB,EAAA;AAC7B,QAAA,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;AAC1C,QAAA,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;KAC9C;AAEO,IAAA,qBAAqB,CAAC,aAAqB,EAAA;AAC/C,QAAA,IACI,CAAC,aAAa,KAAK,oBAAoB,CAAC,YAAY;AAChD,YAAA,aAAa,KAAK,oBAAoB,CAAC,cAAc;AACzD,YAAA,CAAC,MAAM,CAAC,aAAa,CAAC,EACxB;AACE,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,12 +0,0 @@
|
|
|
1
|
-
import { IWindowStorage } from "./IWindowStorage.js";
|
|
2
|
-
export declare class BrowserStorage implements IWindowStorage<string> {
|
|
3
|
-
private windowStorage;
|
|
4
|
-
constructor(cacheLocation: string);
|
|
5
|
-
private validateWindowStorage;
|
|
6
|
-
getItem(key: string): string | null;
|
|
7
|
-
setItem(key: string, value: string): void;
|
|
8
|
-
removeItem(key: string): void;
|
|
9
|
-
getKeys(): string[];
|
|
10
|
-
containsKey(key: string): boolean;
|
|
11
|
-
}
|
|
12
|
-
//# 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;AAErD,qBAAa,cAAe,YAAW,cAAc,CAAC,MAAM,CAAC;IACzD,OAAO,CAAC,aAAa,CAAU;gBAEnB,aAAa,EAAE,MAAM;IAKjC,OAAO,CAAC,qBAAqB;IAY7B,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
|
-
|
|
13
|
-
export class BrowserStorage implements IWindowStorage<string> {
|
|
14
|
-
private windowStorage: Storage;
|
|
15
|
-
|
|
16
|
-
constructor(cacheLocation: string) {
|
|
17
|
-
this.validateWindowStorage(cacheLocation);
|
|
18
|
-
this.windowStorage = window[cacheLocation];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
private validateWindowStorage(cacheLocation: string): void {
|
|
22
|
-
if (
|
|
23
|
-
(cacheLocation !== BrowserCacheLocation.LocalStorage &&
|
|
24
|
-
cacheLocation !== BrowserCacheLocation.SessionStorage) ||
|
|
25
|
-
!window[cacheLocation]
|
|
26
|
-
) {
|
|
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
|
-
}
|