@azure/msal-browser 3.10.0 → 3.11.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/AsyncMemoryStorage.d.ts +2 -3
- package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +4 -5
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +8 -27
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +48 -75
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.d.ts +1 -1
- package/dist/cache/DatabaseStorage.d.ts.map +1 -1
- package/dist/cache/DatabaseStorage.mjs +14 -4
- package/dist/cache/DatabaseStorage.mjs.map +1 -1
- package/dist/cache/{IAsyncMemoryStorage.d.ts → IAsyncStorage.d.ts} +1 -1
- package/dist/cache/IAsyncStorage.d.ts.map +1 -0
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/IController.d.ts +1 -3
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts +2 -3
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +21 -19
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.d.ts +5 -23
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +47 -127
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts +1 -2
- package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +28 -36
- package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +5 -0
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +12 -2
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +28 -12
- 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 +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts +1 -6
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +2 -43
- package/dist/interaction_client/BaseInteractionClient.mjs.map +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.d.ts +1 -9
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +3 -22
- package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +3 -2
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +3 -2
- 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.d.ts +3 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +4 -3
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +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/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.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.d.ts +14 -0
- package/dist/request/RequestHelpers.d.ts.map +1 -0
- package/dist/request/RequestHelpers.mjs +61 -0
- package/dist/request/RequestHelpers.mjs.map +1 -0
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +5 -5
- package/dist/telemetry/BrowserPerformanceClient.mjs.map +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 +14 -3
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +37 -10
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +866 -584
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +866 -584
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +66 -66
- package/package.json +2 -2
- package/src/cache/AsyncMemoryStorage.ts +4 -6
- package/src/cache/BrowserCacheManager.ts +54 -90
- package/src/cache/DatabaseStorage.ts +14 -4
- package/src/controllers/IController.ts +1 -7
- package/src/controllers/NestedAppAuthController.ts +38 -23
- package/src/controllers/StandardController.ts +107 -179
- package/src/controllers/UnknownOperatingContextController.ts +28 -37
- package/src/crypto/BrowserCrypto.ts +11 -0
- package/src/crypto/CryptoOps.ts +31 -13
- package/src/index.ts +2 -0
- package/src/interaction_client/BaseInteractionClient.ts +0 -66
- package/src/interaction_client/SilentCacheClient.ts +11 -51
- package/src/interaction_client/SilentRefreshClient.ts +3 -2
- package/src/interaction_client/StandardInteractionClient.ts +8 -2
- package/src/naa/mapping/NestedAppAuthAdapter.ts +10 -2
- package/src/packageMetadata.ts +1 -1
- package/src/request/RequestHelpers.ts +112 -0
- package/src/telemetry/BrowserPerformanceClient.ts +18 -9
- package/src/utils/BrowserUtils.ts +50 -15
- package/dist/cache/CryptoKeyStore.d.ts +0 -19
- package/dist/cache/CryptoKeyStore.d.ts.map +0 -1
- package/dist/cache/CryptoKeyStore.mjs +0 -47
- package/dist/cache/CryptoKeyStore.mjs.map +0 -1
- package/dist/cache/IAsyncMemoryStorage.d.ts.map +0 -1
- package/src/cache/CryptoKeyStore.ts +0 -63
- /package/src/cache/{IAsyncMemoryStorage.ts → IAsyncStorage.ts} +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
AccountInfo,
|
|
8
|
+
AuthenticationScheme,
|
|
9
|
+
BaseAuthRequest,
|
|
10
|
+
ClientConfigurationErrorCodes,
|
|
11
|
+
CommonSilentFlowRequest,
|
|
12
|
+
IPerformanceClient,
|
|
13
|
+
Logger,
|
|
14
|
+
PerformanceEvents,
|
|
15
|
+
StringUtils,
|
|
16
|
+
createClientConfigurationError,
|
|
17
|
+
invokeAsync,
|
|
18
|
+
} from "@azure/msal-common";
|
|
19
|
+
import { BrowserConfiguration } from "../config/Configuration";
|
|
20
|
+
import { SilentRequest } from "./SilentRequest";
|
|
21
|
+
import { hashString } from "../crypto/BrowserCrypto";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Initializer function for all request APIs
|
|
25
|
+
* @param request
|
|
26
|
+
*/
|
|
27
|
+
export async function initializeBaseRequest(
|
|
28
|
+
request: Partial<BaseAuthRequest> & { correlationId: string },
|
|
29
|
+
config: BrowserConfiguration,
|
|
30
|
+
performanceClient: IPerformanceClient,
|
|
31
|
+
logger: Logger
|
|
32
|
+
): Promise<BaseAuthRequest> {
|
|
33
|
+
performanceClient.addQueueMeasurement(
|
|
34
|
+
PerformanceEvents.InitializeBaseRequest,
|
|
35
|
+
request.correlationId
|
|
36
|
+
);
|
|
37
|
+
const authority = request.authority || config.auth.authority;
|
|
38
|
+
|
|
39
|
+
const scopes = [...((request && request.scopes) || [])];
|
|
40
|
+
|
|
41
|
+
const validatedRequest: BaseAuthRequest = {
|
|
42
|
+
...request,
|
|
43
|
+
correlationId: request.correlationId,
|
|
44
|
+
authority,
|
|
45
|
+
scopes,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
49
|
+
if (!validatedRequest.authenticationScheme) {
|
|
50
|
+
validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;
|
|
51
|
+
logger.verbose(
|
|
52
|
+
'Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request'
|
|
53
|
+
);
|
|
54
|
+
} else {
|
|
55
|
+
if (
|
|
56
|
+
validatedRequest.authenticationScheme === AuthenticationScheme.SSH
|
|
57
|
+
) {
|
|
58
|
+
if (!request.sshJwk) {
|
|
59
|
+
throw createClientConfigurationError(
|
|
60
|
+
ClientConfigurationErrorCodes.missingSshJwk
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
if (!request.sshKid) {
|
|
64
|
+
throw createClientConfigurationError(
|
|
65
|
+
ClientConfigurationErrorCodes.missingSshKid
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
logger.verbose(
|
|
70
|
+
`Authentication Scheme set to "${validatedRequest.authenticationScheme}" as configured in Auth request`
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Set requested claims hash if claims-based caching is enabled and claims were requested
|
|
75
|
+
if (
|
|
76
|
+
config.cache.claimsBasedCachingEnabled &&
|
|
77
|
+
request.claims &&
|
|
78
|
+
// Checks for empty stringified object "{}" which doesn't qualify as requested claims
|
|
79
|
+
!StringUtils.isEmptyObj(request.claims)
|
|
80
|
+
) {
|
|
81
|
+
validatedRequest.requestedClaimsHash = await hashString(request.claims);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return validatedRequest;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export async function initializeSilentRequest(
|
|
88
|
+
request: SilentRequest & { correlationId: string },
|
|
89
|
+
account: AccountInfo,
|
|
90
|
+
config: BrowserConfiguration,
|
|
91
|
+
performanceClient: IPerformanceClient,
|
|
92
|
+
logger: Logger
|
|
93
|
+
): Promise<CommonSilentFlowRequest> {
|
|
94
|
+
performanceClient.addQueueMeasurement(
|
|
95
|
+
PerformanceEvents.InitializeSilentRequest,
|
|
96
|
+
request.correlationId
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
const baseRequest = await invokeAsync(
|
|
100
|
+
initializeBaseRequest,
|
|
101
|
+
PerformanceEvents.InitializeBaseRequest,
|
|
102
|
+
logger,
|
|
103
|
+
performanceClient,
|
|
104
|
+
request.correlationId
|
|
105
|
+
)(request, config, performanceClient, logger);
|
|
106
|
+
return {
|
|
107
|
+
...request,
|
|
108
|
+
...baseRequest,
|
|
109
|
+
account: account,
|
|
110
|
+
forceRefresh: request.forceRefresh || false,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -69,7 +69,11 @@ export class BrowserPerformanceClient
|
|
|
69
69
|
extends PerformanceClient
|
|
70
70
|
implements IPerformanceClient
|
|
71
71
|
{
|
|
72
|
-
constructor(
|
|
72
|
+
constructor(
|
|
73
|
+
configuration: Configuration,
|
|
74
|
+
intFields?: Set<string>,
|
|
75
|
+
abbreviations?: Map<string, string>
|
|
76
|
+
) {
|
|
73
77
|
super(
|
|
74
78
|
configuration.auth.clientId,
|
|
75
79
|
configuration.auth.authority || `${Constants.DEFAULT_AUTHORITY}`,
|
|
@@ -84,7 +88,8 @@ export class BrowserPerformanceClient
|
|
|
84
88
|
appName: "",
|
|
85
89
|
appVersion: "",
|
|
86
90
|
},
|
|
87
|
-
intFields
|
|
91
|
+
intFields,
|
|
92
|
+
abbreviations
|
|
88
93
|
);
|
|
89
94
|
}
|
|
90
95
|
|
|
@@ -159,14 +164,18 @@ export class BrowserPerformanceClient
|
|
|
159
164
|
return {
|
|
160
165
|
...inProgressEvent,
|
|
161
166
|
end: (
|
|
162
|
-
event?: Partial<PerformanceEvent
|
|
167
|
+
event?: Partial<PerformanceEvent>,
|
|
168
|
+
error?: unknown
|
|
163
169
|
): PerformanceEvent | null => {
|
|
164
|
-
const res = inProgressEvent.end(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
const res = inProgressEvent.end(
|
|
171
|
+
{
|
|
172
|
+
...event,
|
|
173
|
+
startPageVisibility,
|
|
174
|
+
endPageVisibility: this.getPageVisibility(),
|
|
175
|
+
durationMs: getPerfDurationMs(startTime),
|
|
176
|
+
},
|
|
177
|
+
error
|
|
178
|
+
);
|
|
170
179
|
void browserMeasurement?.then((measurement) =>
|
|
171
180
|
measurement.endMeasurement()
|
|
172
181
|
);
|
|
@@ -8,8 +8,13 @@ import {
|
|
|
8
8
|
createBrowserAuthError,
|
|
9
9
|
BrowserAuthErrorCodes,
|
|
10
10
|
} from "../error/BrowserAuthError";
|
|
11
|
-
import {
|
|
11
|
+
import { BrowserConstants, BrowserCacheLocation } from "./BrowserConstants";
|
|
12
12
|
import * as BrowserCrypto from "../crypto/BrowserCrypto";
|
|
13
|
+
import {
|
|
14
|
+
BrowserConfigurationAuthErrorCodes,
|
|
15
|
+
createBrowserConfigurationAuthError,
|
|
16
|
+
} from "../error/BrowserConfigurationAuthError";
|
|
17
|
+
import { BrowserConfiguration } from "../config/Configuration";
|
|
13
18
|
|
|
14
19
|
/**
|
|
15
20
|
* Clears hash from window url.
|
|
@@ -93,16 +98,8 @@ export function blockReloadInHiddenIframes(): void {
|
|
|
93
98
|
* @param interactionType Interaction type for the request
|
|
94
99
|
* @param allowRedirectInIframe Config value to allow redirects when app is inside an iframe
|
|
95
100
|
*/
|
|
96
|
-
export function blockRedirectInIframe(
|
|
97
|
-
|
|
98
|
-
allowRedirectInIframe: boolean
|
|
99
|
-
): void {
|
|
100
|
-
const isIframedApp = isInIframe();
|
|
101
|
-
if (
|
|
102
|
-
interactionType === InteractionType.Redirect &&
|
|
103
|
-
isIframedApp &&
|
|
104
|
-
!allowRedirectInIframe
|
|
105
|
-
) {
|
|
101
|
+
export function blockRedirectInIframe(allowRedirectInIframe: boolean): void {
|
|
102
|
+
if (isInIframe() && !allowRedirectInIframe) {
|
|
106
103
|
// If we are not in top frame, we shouldn't redirect. This is also handled by the service.
|
|
107
104
|
throw createBrowserAuthError(BrowserAuthErrorCodes.redirectInIframe);
|
|
108
105
|
}
|
|
@@ -122,10 +119,8 @@ export function blockAcquireTokenInPopups(): void {
|
|
|
122
119
|
* Throws error if token requests are made in non-browser environment
|
|
123
120
|
* @param isBrowserEnvironment Flag indicating if environment is a browser.
|
|
124
121
|
*/
|
|
125
|
-
export function blockNonBrowserEnvironment(
|
|
126
|
-
|
|
127
|
-
): void {
|
|
128
|
-
if (!isBrowserEnvironment) {
|
|
122
|
+
export function blockNonBrowserEnvironment(): void {
|
|
123
|
+
if (typeof window === "undefined") {
|
|
129
124
|
throw createBrowserAuthError(
|
|
130
125
|
BrowserAuthErrorCodes.nonBrowserEnvironment
|
|
131
126
|
);
|
|
@@ -144,6 +139,46 @@ export function blockAPICallsBeforeInitialize(initialized: boolean): void {
|
|
|
144
139
|
}
|
|
145
140
|
}
|
|
146
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Helper to validate app environment before making an auth request
|
|
144
|
+
* @param initialized
|
|
145
|
+
*/
|
|
146
|
+
export function preflightCheck(initialized: boolean): void {
|
|
147
|
+
// Block request if not in browser environment
|
|
148
|
+
blockNonBrowserEnvironment();
|
|
149
|
+
|
|
150
|
+
// Block auth requests inside a hidden iframe
|
|
151
|
+
blockReloadInHiddenIframes();
|
|
152
|
+
|
|
153
|
+
// Block redirectUri opened in a popup from calling MSAL APIs
|
|
154
|
+
blockAcquireTokenInPopups();
|
|
155
|
+
|
|
156
|
+
// Block token acquisition before initialize has been called
|
|
157
|
+
blockAPICallsBeforeInitialize(initialized);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Helper to validate app enviornment before making redirect request
|
|
162
|
+
* @param initialized
|
|
163
|
+
* @param config
|
|
164
|
+
*/
|
|
165
|
+
export function redirectPreflightCheck(
|
|
166
|
+
initialized: boolean,
|
|
167
|
+
config: BrowserConfiguration
|
|
168
|
+
): void {
|
|
169
|
+
preflightCheck(initialized);
|
|
170
|
+
blockRedirectInIframe(config.system.allowRedirectInIframe);
|
|
171
|
+
// Block redirects if memory storage is enabled but storeAuthStateInCookie is not
|
|
172
|
+
if (
|
|
173
|
+
config.cache.cacheLocation === BrowserCacheLocation.MemoryStorage &&
|
|
174
|
+
!config.cache.storeAuthStateInCookie
|
|
175
|
+
) {
|
|
176
|
+
throw createBrowserConfigurationAuthError(
|
|
177
|
+
BrowserConfigurationAuthErrorCodes.inMemRedirectUnavailable
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
147
182
|
/**
|
|
148
183
|
* Adds a preconnect link element to the header which begins DNS resolution and SSL connection in anticipation of the /token request
|
|
149
184
|
* @param loginDomain Authority domain, including https protocol e.g. https://login.microsoftonline.com
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Logger } from "@azure/msal-common";
|
|
2
|
-
import { CachedKeyPair } from "../crypto/CryptoOps";
|
|
3
|
-
import { AsyncMemoryStorage } from "./AsyncMemoryStorage";
|
|
4
|
-
export declare const CryptoKeyStoreNames: {
|
|
5
|
-
readonly asymmetricKeys: "asymmetricKeys";
|
|
6
|
-
readonly symmetricKeys: "symmetricKeys";
|
|
7
|
-
};
|
|
8
|
-
export type CryptoKeyStoreNames = (typeof CryptoKeyStoreNames)[keyof typeof CryptoKeyStoreNames];
|
|
9
|
-
/**
|
|
10
|
-
* MSAL CryptoKeyStore DB Version 2
|
|
11
|
-
*/
|
|
12
|
-
export declare class CryptoKeyStore {
|
|
13
|
-
asymmetricKeys: AsyncMemoryStorage<CachedKeyPair>;
|
|
14
|
-
symmetricKeys: AsyncMemoryStorage<CryptoKey>;
|
|
15
|
-
logger: Logger;
|
|
16
|
-
constructor(logger: Logger);
|
|
17
|
-
clear(): Promise<boolean>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=CryptoKeyStore.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoKeyStore.d.ts","sourceRoot":"","sources":["../../src/cache/CryptoKeyStore.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AACX,MAAM,MAAM,mBAAmB,GAC3B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEnE;;GAEG;AACH,qBAAa,cAAc;IAChB,cAAc,EAAE,kBAAkB,CAAC,aAAa,CAAC,CAAC;IAClD,aAAa,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC7C,MAAM,EAAE,MAAM,CAAC;gBAEV,MAAM,EAAE,MAAM;IAYpB,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC;CA0BlC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.10.0 2024-02-17 */
|
|
2
|
-
'use strict';
|
|
3
|
-
import { AsyncMemoryStorage } from './AsyncMemoryStorage.mjs';
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7
|
-
* Licensed under the MIT License.
|
|
8
|
-
*/
|
|
9
|
-
const CryptoKeyStoreNames = {
|
|
10
|
-
asymmetricKeys: "asymmetricKeys",
|
|
11
|
-
symmetricKeys: "symmetricKeys",
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* MSAL CryptoKeyStore DB Version 2
|
|
15
|
-
*/
|
|
16
|
-
class CryptoKeyStore {
|
|
17
|
-
constructor(logger) {
|
|
18
|
-
this.logger = logger;
|
|
19
|
-
this.asymmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys);
|
|
20
|
-
this.symmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys);
|
|
21
|
-
}
|
|
22
|
-
async clear() {
|
|
23
|
-
// Delete in-memory keystores
|
|
24
|
-
this.asymmetricKeys.clearInMemory();
|
|
25
|
-
this.symmetricKeys.clearInMemory();
|
|
26
|
-
/**
|
|
27
|
-
* There is only one database, so calling clearPersistent on asymmetric keystore takes care of
|
|
28
|
-
* every persistent keystore
|
|
29
|
-
*/
|
|
30
|
-
try {
|
|
31
|
-
await this.asymmetricKeys.clearPersistent();
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
if (e instanceof Error) {
|
|
36
|
-
this.logger.error(`Clearing keystore failed with error: ${e.message}`);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
this.logger.error("Clearing keystore failed with unknown error");
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { CryptoKeyStore, CryptoKeyStoreNames };
|
|
47
|
-
//# sourceMappingURL=CryptoKeyStore.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CryptoKeyStore.mjs","sources":["../../src/cache/CryptoKeyStore.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AAMU,MAAA,mBAAmB,GAAG;AAC/B,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,aAAa,EAAE,eAAe;EACvB;AAIX;;AAEG;MACU,cAAc,CAAA;AAKvB,IAAA,WAAA,CAAY,MAAc,EAAA;AACtB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,cAAc,GAAG,IAAI,kBAAkB,CACxC,IAAI,CAAC,MAAM,EACX,mBAAmB,CAAC,cAAc,CACrC,CAAC;AACF,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,kBAAkB,CACvC,IAAI,CAAC,MAAM,EACX,mBAAmB,CAAC,aAAa,CACpC,CAAC;KACL;AAED,IAAA,MAAM,KAAK,GAAA;;AAEP,QAAA,IAAI,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC;AACpC,QAAA,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;AAEnC;;;AAGG;QACH,IAAI;AACA,YAAA,MAAM,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE,CAAC;AAC5C,YAAA,OAAO,IAAI,CAAC;AACf,SAAA;AAAC,QAAA,OAAO,CAAC,EAAE;YACR,IAAI,CAAC,YAAY,KAAK,EAAE;gBACpB,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,CAAwC,qCAAA,EAAA,CAAC,CAAC,OAAO,CAAE,CAAA,CACtD,CAAC;AACL,aAAA;AAAM,iBAAA;AACH,gBAAA,IAAI,CAAC,MAAM,CAAC,KAAK,CACb,6CAA6C,CAChD,CAAC;AACL,aAAA;AAED,YAAA,OAAO,KAAK,CAAC;AAChB,SAAA;KACJ;AACJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IAsyncMemoryStorage.d.ts","sourceRoot":"","sources":["../../src/cache/IAsyncMemoryStorage.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa,CAAC,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAExC;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;;OAGG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE7B;;;OAGG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9C"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { Logger } from "@azure/msal-common";
|
|
7
|
-
import { CachedKeyPair } from "../crypto/CryptoOps";
|
|
8
|
-
import { AsyncMemoryStorage } from "./AsyncMemoryStorage";
|
|
9
|
-
|
|
10
|
-
export const CryptoKeyStoreNames = {
|
|
11
|
-
asymmetricKeys: "asymmetricKeys",
|
|
12
|
-
symmetricKeys: "symmetricKeys",
|
|
13
|
-
} as const;
|
|
14
|
-
export type CryptoKeyStoreNames =
|
|
15
|
-
(typeof CryptoKeyStoreNames)[keyof typeof CryptoKeyStoreNames];
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* MSAL CryptoKeyStore DB Version 2
|
|
19
|
-
*/
|
|
20
|
-
export class CryptoKeyStore {
|
|
21
|
-
public asymmetricKeys: AsyncMemoryStorage<CachedKeyPair>;
|
|
22
|
-
public symmetricKeys: AsyncMemoryStorage<CryptoKey>;
|
|
23
|
-
public logger: Logger;
|
|
24
|
-
|
|
25
|
-
constructor(logger: Logger) {
|
|
26
|
-
this.logger = logger;
|
|
27
|
-
this.asymmetricKeys = new AsyncMemoryStorage<CachedKeyPair>(
|
|
28
|
-
this.logger,
|
|
29
|
-
CryptoKeyStoreNames.asymmetricKeys
|
|
30
|
-
);
|
|
31
|
-
this.symmetricKeys = new AsyncMemoryStorage<CryptoKey>(
|
|
32
|
-
this.logger,
|
|
33
|
-
CryptoKeyStoreNames.symmetricKeys
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async clear(): Promise<boolean> {
|
|
38
|
-
// Delete in-memory keystores
|
|
39
|
-
this.asymmetricKeys.clearInMemory();
|
|
40
|
-
this.symmetricKeys.clearInMemory();
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* There is only one database, so calling clearPersistent on asymmetric keystore takes care of
|
|
44
|
-
* every persistent keystore
|
|
45
|
-
*/
|
|
46
|
-
try {
|
|
47
|
-
await this.asymmetricKeys.clearPersistent();
|
|
48
|
-
return true;
|
|
49
|
-
} catch (e) {
|
|
50
|
-
if (e instanceof Error) {
|
|
51
|
-
this.logger.error(
|
|
52
|
-
`Clearing keystore failed with error: ${e.message}`
|
|
53
|
-
);
|
|
54
|
-
} else {
|
|
55
|
-
this.logger.error(
|
|
56
|
-
"Clearing keystore failed with unknown error"
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
File without changes
|