@azure/msal-browser 3.27.0 → 3.28.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.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +2 -38
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +21 -115
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.d.ts +3 -1
- package/dist/cache/BrowserStorage.d.ts.map +1 -1
- package/dist/cache/BrowserStorage.mjs +13 -8
- package/dist/cache/BrowserStorage.mjs.map +1 -1
- package/dist/cache/CookieStorage.d.ts +14 -0
- package/dist/cache/CookieStorage.d.ts.map +1 -0
- package/dist/cache/CookieStorage.mjs +62 -0
- package/dist/cache/CookieStorage.mjs.map +1 -0
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/LocalStorage.d.ts +10 -0
- package/dist/cache/LocalStorage.d.ts.map +1 -0
- package/dist/cache/LocalStorage.mjs +34 -0
- package/dist/cache/LocalStorage.mjs.map +1 -0
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.d.ts +10 -0
- package/dist/cache/SessionStorage.d.ts.map +1 -0
- package/dist/cache/SessionStorage.mjs +34 -0
- package/dist/cache/SessionStorage.mjs.map +1 -0
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +2 -2
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.mjs +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +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/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 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +3 -1
- 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.mjs +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 -1
- 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.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.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 +224 -198
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +224 -198
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +64 -64
- package/lib/types/cache/BrowserCacheManager.d.ts +2 -38
- package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/types/cache/BrowserStorage.d.ts +3 -1
- package/lib/types/cache/BrowserStorage.d.ts.map +1 -1
- package/lib/types/cache/CookieStorage.d.ts +14 -0
- package/lib/types/cache/CookieStorage.d.ts.map +1 -0
- package/lib/types/cache/LocalStorage.d.ts +10 -0
- package/lib/types/cache/LocalStorage.d.ts.map +1 -0
- package/lib/types/cache/SessionStorage.d.ts +10 -0
- package/lib/types/cache/SessionStorage.d.ts.map +1 -0
- 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/index.d.ts +3 -0
- package/lib/types/index.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/utils/BrowserUtils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cache/BrowserCacheManager.ts +27 -141
- package/src/cache/BrowserStorage.ts +11 -11
- package/src/cache/CookieStorage.ts +80 -0
- package/src/cache/LocalStorage.ts +40 -0
- package/src/cache/SessionStorage.ts +40 -0
- package/src/controllers/NestedAppAuthController.ts +1 -1
- package/src/crypto/BrowserCrypto.ts +4 -2
- package/src/crypto/CryptoOps.ts +8 -2
- package/src/index.ts +3 -0
- package/src/interaction_client/StandardInteractionClient.ts +5 -0
- package/src/packageMetadata.ts +1 -1
- package/src/utils/BrowserUtils.ts +3 -1
|
@@ -0,0 +1,40 @@
|
|
|
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 { IWindowStorage } from "./IWindowStorage.js";
|
|
11
|
+
|
|
12
|
+
export class LocalStorage implements IWindowStorage<string> {
|
|
13
|
+
constructor() {
|
|
14
|
+
if (!window.localStorage) {
|
|
15
|
+
throw createBrowserConfigurationAuthError(
|
|
16
|
+
BrowserConfigurationAuthErrorCodes.storageNotSupported
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getItem(key: string): string | null {
|
|
22
|
+
return window.localStorage.getItem(key);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
setItem(key: string, value: string): void {
|
|
26
|
+
window.localStorage.setItem(key, value);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
removeItem(key: string): void {
|
|
30
|
+
window.localStorage.removeItem(key);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getKeys(): string[] {
|
|
34
|
+
return Object.keys(window.localStorage);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
containsKey(key: string): boolean {
|
|
38
|
+
return window.localStorage.hasOwnProperty(key);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { IWindowStorage } from "./IWindowStorage.js";
|
|
11
|
+
|
|
12
|
+
export class SessionStorage implements IWindowStorage<string> {
|
|
13
|
+
constructor() {
|
|
14
|
+
if (!window.sessionStorage) {
|
|
15
|
+
throw createBrowserConfigurationAuthError(
|
|
16
|
+
BrowserConfigurationAuthErrorCodes.storageNotSupported
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
getItem(key: string): string | null {
|
|
22
|
+
return window.sessionStorage.getItem(key);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
setItem(key: string, value: string): void {
|
|
26
|
+
window.sessionStorage.setItem(key, value);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
removeItem(key: string): void {
|
|
30
|
+
window.sessionStorage.removeItem(key);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
getKeys(): string[] {
|
|
34
|
+
return Object.keys(window.sessionStorage);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
containsKey(key: string): boolean {
|
|
38
|
+
return window.sessionStorage.hasOwnProperty(key);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -102,7 +102,7 @@ export class NestedAppAuthController implements IController {
|
|
|
102
102
|
|
|
103
103
|
// Initialize the crypto class.
|
|
104
104
|
this.browserCrypto = operatingContext.isBrowserEnvironment()
|
|
105
|
-
? new CryptoOps(this.logger, this.performanceClient)
|
|
105
|
+
? new CryptoOps(this.logger, this.performanceClient, true)
|
|
106
106
|
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
107
107
|
|
|
108
108
|
// Initialize the browser storage class.
|
|
@@ -47,7 +47,9 @@ const keygenAlgorithmOptions: RsaHashedKeyGenParams = {
|
|
|
47
47
|
/**
|
|
48
48
|
* Check whether browser crypto is available.
|
|
49
49
|
*/
|
|
50
|
-
export function validateCryptoAvailable(
|
|
50
|
+
export function validateCryptoAvailable(
|
|
51
|
+
skipValidateSubtleCrypto: boolean
|
|
52
|
+
): void {
|
|
51
53
|
if (!window) {
|
|
52
54
|
throw createBrowserAuthError(
|
|
53
55
|
BrowserAuthErrorCodes.nonBrowserEnvironment
|
|
@@ -56,7 +58,7 @@ export function validateCryptoAvailable(): void {
|
|
|
56
58
|
if (!window.crypto) {
|
|
57
59
|
throw createBrowserAuthError(BrowserAuthErrorCodes.cryptoNonExistent);
|
|
58
60
|
}
|
|
59
|
-
if (!window.crypto.subtle) {
|
|
61
|
+
if (!skipValidateSubtleCrypto && !window.crypto.subtle) {
|
|
60
62
|
throw createBrowserAuthError(
|
|
61
63
|
BrowserAuthErrorCodes.cryptoNonExistent,
|
|
62
64
|
SUBTLE_SUBERROR
|
package/src/crypto/CryptoOps.ts
CHANGED
|
@@ -50,10 +50,16 @@ export class CryptoOps implements ICrypto {
|
|
|
50
50
|
private static EXTRACTABLE: boolean = true;
|
|
51
51
|
private cache: AsyncMemoryStorage<CachedKeyPair>;
|
|
52
52
|
|
|
53
|
-
constructor(
|
|
53
|
+
constructor(
|
|
54
|
+
logger: Logger,
|
|
55
|
+
performanceClient?: IPerformanceClient,
|
|
56
|
+
skipValidateSubtleCrypto?: boolean
|
|
57
|
+
) {
|
|
54
58
|
this.logger = logger;
|
|
55
59
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
56
|
-
BrowserCrypto.validateCryptoAvailable(
|
|
60
|
+
BrowserCrypto.validateCryptoAvailable(
|
|
61
|
+
skipValidateSubtleCrypto ?? false
|
|
62
|
+
);
|
|
57
63
|
this.cache = new AsyncMemoryStorage<CachedKeyPair>(this.logger);
|
|
58
64
|
this.performanceClient = performanceClient;
|
|
59
65
|
}
|
package/src/index.ts
CHANGED
|
@@ -75,6 +75,9 @@ export { ITokenCache } from "./cache/ITokenCache.js";
|
|
|
75
75
|
// Storage
|
|
76
76
|
export { MemoryStorage } from "./cache/MemoryStorage.js";
|
|
77
77
|
export { BrowserStorage } from "./cache/BrowserStorage.js";
|
|
78
|
+
export { LocalStorage } from "./cache/LocalStorage.js";
|
|
79
|
+
export { SessionStorage } from "./cache/SessionStorage.js";
|
|
80
|
+
export { IWindowStorage } from "./cache/IWindowStorage.js";
|
|
78
81
|
|
|
79
82
|
// Events
|
|
80
83
|
export {
|
|
@@ -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) {
|
package/src/packageMetadata.ts
CHANGED
|
@@ -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
|
/**
|