@azure/msal-browser 3.20.0 → 3.22.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.
Files changed (187) hide show
  1. package/dist/app/IPublicClientApplication.d.ts +53 -53
  2. package/dist/app/IPublicClientApplication.mjs +105 -105
  3. package/dist/app/PublicClientApplication.d.ts +293 -293
  4. package/dist/app/PublicClientApplication.mjs +364 -364
  5. package/dist/app/PublicClientNext.d.ts +276 -276
  6. package/dist/app/PublicClientNext.mjs +354 -354
  7. package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +62 -62
  8. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +254 -254
  9. package/dist/broker/nativeBroker/NativeRequest.d.ts +45 -45
  10. package/dist/broker/nativeBroker/NativeResponse.d.ts +48 -48
  11. package/dist/broker/nativeBroker/NativeStatusCodes.d.ts +7 -7
  12. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +11 -11
  13. package/dist/cache/AccountManager.d.ts +48 -48
  14. package/dist/cache/AccountManager.mjs +126 -126
  15. package/dist/cache/AsyncMemoryStorage.d.ts +50 -50
  16. package/dist/cache/AsyncMemoryStorage.mjs +131 -131
  17. package/dist/cache/BrowserCacheManager.d.ts +385 -385
  18. package/dist/cache/BrowserCacheManager.mjs +1294 -1294
  19. package/dist/cache/BrowserStorage.d.ts +11 -11
  20. package/dist/cache/BrowserStorage.mjs +32 -32
  21. package/dist/cache/DatabaseStorage.d.ts +56 -56
  22. package/dist/cache/DatabaseStorage.mjs +200 -200
  23. package/dist/cache/IAsyncStorage.d.ts +27 -27
  24. package/dist/cache/ITokenCache.d.ts +11 -11
  25. package/dist/cache/IWindowStorage.d.ts +27 -27
  26. package/dist/cache/MemoryStorage.d.ts +11 -11
  27. package/dist/cache/MemoryStorage.mjs +31 -31
  28. package/dist/cache/TokenCache.d.ts +77 -77
  29. package/dist/cache/TokenCache.mjs +195 -195
  30. package/dist/config/Configuration.d.ts +213 -208
  31. package/dist/config/Configuration.d.ts.map +1 -1
  32. package/dist/config/Configuration.mjs +128 -128
  33. package/dist/config/Configuration.mjs.map +1 -1
  34. package/dist/controllers/ControllerFactory.d.ts +5 -5
  35. package/dist/controllers/ControllerFactory.mjs +25 -25
  36. package/dist/controllers/IController.d.ts +60 -60
  37. package/dist/controllers/NestedAppAuthController.d.ts +202 -202
  38. package/dist/controllers/NestedAppAuthController.mjs +473 -473
  39. package/dist/controllers/StandardController.d.ts +405 -405
  40. package/dist/controllers/StandardController.d.ts.map +1 -1
  41. package/dist/controllers/StandardController.mjs +1334 -1316
  42. package/dist/controllers/StandardController.mjs.map +1 -1
  43. package/dist/controllers/UnknownOperatingContextController.d.ts +86 -86
  44. package/dist/controllers/UnknownOperatingContextController.mjs +256 -256
  45. package/dist/crypto/BrowserCrypto.d.ts +52 -52
  46. package/dist/crypto/BrowserCrypto.mjs +151 -151
  47. package/dist/crypto/CryptoOps.d.ts +74 -74
  48. package/dist/crypto/CryptoOps.mjs +176 -176
  49. package/dist/crypto/PkceGenerator.d.ts +8 -8
  50. package/dist/crypto/PkceGenerator.mjs +54 -54
  51. package/dist/crypto/SignedHttpRequest.d.ts +30 -30
  52. package/dist/crypto/SignedHttpRequest.mjs +39 -39
  53. package/dist/encode/Base64Decode.d.ts +9 -9
  54. package/dist/encode/Base64Decode.mjs +36 -36
  55. package/dist/encode/Base64Encode.d.ts +19 -19
  56. package/dist/encode/Base64Encode.mjs +43 -43
  57. package/dist/error/BrowserAuthError.d.ts +255 -255
  58. package/dist/error/BrowserAuthError.mjs +263 -263
  59. package/dist/error/BrowserAuthErrorCodes.d.ts +46 -46
  60. package/dist/error/BrowserAuthErrorCodes.mjs +50 -50
  61. package/dist/error/BrowserConfigurationAuthError.d.ts +33 -33
  62. package/dist/error/BrowserConfigurationAuthError.mjs +40 -40
  63. package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -1
  64. package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +3 -3
  65. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +7 -7
  66. package/dist/error/NativeAuthError.d.ts +29 -29
  67. package/dist/error/NativeAuthError.mjs +60 -60
  68. package/dist/error/NativeAuthErrorCodes.d.ts +2 -2
  69. package/dist/error/NativeAuthErrorCodes.mjs +6 -6
  70. package/dist/error/NestedAppAuthError.d.ts +14 -14
  71. package/dist/error/NestedAppAuthError.mjs +23 -23
  72. package/dist/event/EventHandler.d.ts +41 -41
  73. package/dist/event/EventHandler.mjs +125 -125
  74. package/dist/event/EventMessage.d.ts +25 -25
  75. package/dist/event/EventMessage.mjs +68 -68
  76. package/dist/event/EventType.d.ts +29 -29
  77. package/dist/event/EventType.mjs +32 -32
  78. package/dist/index.d.ts +40 -40
  79. package/dist/index.mjs +1 -1
  80. package/dist/interaction_client/BaseInteractionClient.d.ts +50 -50
  81. package/dist/interaction_client/BaseInteractionClient.mjs +106 -106
  82. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +4 -4
  83. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +10 -10
  84. package/dist/interaction_client/NativeInteractionClient.d.ts +151 -151
  85. package/dist/interaction_client/NativeInteractionClient.mjs +621 -621
  86. package/dist/interaction_client/PopupClient.d.ts +105 -105
  87. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  88. package/dist/interaction_client/PopupClient.mjs +433 -433
  89. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  90. package/dist/interaction_client/RedirectClient.d.ts +50 -50
  91. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  92. package/dist/interaction_client/RedirectClient.mjs +315 -314
  93. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  94. package/dist/interaction_client/SilentAuthCodeClient.d.ts +23 -23
  95. package/dist/interaction_client/SilentAuthCodeClient.mjs +57 -57
  96. package/dist/interaction_client/SilentCacheClient.d.ts +16 -16
  97. package/dist/interaction_client/SilentCacheClient.mjs +42 -42
  98. package/dist/interaction_client/SilentIframeClient.d.ts +32 -32
  99. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  100. package/dist/interaction_client/SilentIframeClient.mjs +110 -100
  101. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  102. package/dist/interaction_client/SilentRefreshClient.d.ts +20 -20
  103. package/dist/interaction_client/SilentRefreshClient.mjs +47 -47
  104. package/dist/interaction_client/StandardInteractionClient.d.ts +48 -48
  105. package/dist/interaction_client/StandardInteractionClient.mjs +199 -199
  106. package/dist/interaction_handler/InteractionHandler.d.ts +33 -33
  107. package/dist/interaction_handler/InteractionHandler.mjs +93 -93
  108. package/dist/interaction_handler/RedirectHandler.d.ts +32 -32
  109. package/dist/interaction_handler/RedirectHandler.mjs +134 -134
  110. package/dist/interaction_handler/SilentHandler.d.ts +13 -13
  111. package/dist/interaction_handler/SilentHandler.mjs +134 -134
  112. package/dist/naa/AccountInfo.d.ts +11 -11
  113. package/dist/naa/AuthBridge.d.ts +8 -8
  114. package/dist/naa/AuthResult.d.ts +6 -6
  115. package/dist/naa/BridgeAccountContext.d.ts +12 -12
  116. package/dist/naa/BridgeCapabilities.d.ts +3 -3
  117. package/dist/naa/BridgeError.d.ts +9 -9
  118. package/dist/naa/BridgeError.mjs +7 -7
  119. package/dist/naa/BridgeProxy.d.ts +67 -67
  120. package/dist/naa/BridgeProxy.mjs +148 -148
  121. package/dist/naa/BridgeRequest.d.ts +7 -7
  122. package/dist/naa/BridgeRequestEnvelope.d.ts +12 -12
  123. package/dist/naa/BridgeResponseEnvelope.d.ts +13 -13
  124. package/dist/naa/BridgeStatusCode.d.ts +11 -11
  125. package/dist/naa/BridgeStatusCode.mjs +14 -14
  126. package/dist/naa/IBridgeProxy.d.ts +10 -10
  127. package/dist/naa/InitContext.d.ts +8 -8
  128. package/dist/naa/TokenRequest.d.ts +18 -18
  129. package/dist/naa/TokenResponse.d.ts +13 -13
  130. package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +35 -35
  131. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +179 -179
  132. package/dist/navigation/INavigationClient.d.ts +16 -16
  133. package/dist/navigation/NavigationClient.d.ts +22 -22
  134. package/dist/navigation/NavigationClient.mjs +40 -40
  135. package/dist/navigation/NavigationOptions.d.ts +12 -12
  136. package/dist/network/FetchClient.d.ts +26 -26
  137. package/dist/network/FetchClient.mjs +99 -99
  138. package/dist/operatingcontext/BaseOperatingContext.d.ts +41 -41
  139. package/dist/operatingcontext/BaseOperatingContext.mjs +94 -94
  140. package/dist/operatingcontext/NestedAppOperatingContext.d.ts +34 -34
  141. package/dist/operatingcontext/NestedAppOperatingContext.mjs +71 -71
  142. package/dist/operatingcontext/StandardOperatingContext.d.ts +25 -25
  143. package/dist/operatingcontext/StandardOperatingContext.mjs +43 -43
  144. package/dist/operatingcontext/UnknownOperatingContext.d.ts +25 -25
  145. package/dist/operatingcontext/UnknownOperatingContext.mjs +42 -42
  146. package/dist/packageMetadata.d.ts +2 -2
  147. package/dist/packageMetadata.mjs +4 -4
  148. package/dist/request/AuthorizationCodeRequest.d.ts +8 -8
  149. package/dist/request/AuthorizationUrlRequest.d.ts +8 -8
  150. package/dist/request/ClearCacheRequest.d.ts +10 -10
  151. package/dist/request/EndSessionPopupRequest.d.ts +18 -18
  152. package/dist/request/EndSessionRequest.d.ts +15 -15
  153. package/dist/request/InitializeApplicationRequest.d.ts +8 -8
  154. package/dist/request/PopupRequest.d.ts +34 -34
  155. package/dist/request/PopupWindowAttributes.d.ts +15 -15
  156. package/dist/request/RedirectRequest.d.ts +40 -35
  157. package/dist/request/RedirectRequest.d.ts.map +1 -1
  158. package/dist/request/RequestHelpers.d.ts +13 -13
  159. package/dist/request/RequestHelpers.mjs +53 -53
  160. package/dist/request/SilentRequest.d.ts +33 -33
  161. package/dist/request/SsoSilentRequest.d.ts +29 -29
  162. package/dist/response/AuthenticationResult.d.ts +4 -4
  163. package/dist/response/ResponseHandler.d.ts +7 -7
  164. package/dist/response/ResponseHandler.mjs +36 -36
  165. package/dist/telemetry/BrowserPerformanceClient.d.ts +34 -34
  166. package/dist/telemetry/BrowserPerformanceClient.mjs +162 -162
  167. package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +21 -21
  168. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +92 -92
  169. package/dist/utils/BrowserConstants.d.ts +180 -180
  170. package/dist/utils/BrowserConstants.mjs +212 -212
  171. package/dist/utils/BrowserProtocolUtils.d.ts +11 -11
  172. package/dist/utils/BrowserProtocolUtils.mjs +21 -21
  173. package/dist/utils/BrowserUtils.d.ts +75 -75
  174. package/dist/utils/BrowserUtils.mjs +157 -157
  175. package/lib/msal-browser.cjs +18884 -18855
  176. package/lib/msal-browser.cjs.map +1 -1
  177. package/lib/msal-browser.js +18884 -18855
  178. package/lib/msal-browser.js.map +1 -1
  179. package/lib/msal-browser.min.js +59 -59
  180. package/package.json +2 -2
  181. package/src/config/Configuration.ts +9 -1
  182. package/src/controllers/StandardController.ts +30 -12
  183. package/src/interaction_client/PopupClient.ts +1 -0
  184. package/src/interaction_client/RedirectClient.ts +4 -1
  185. package/src/interaction_client/SilentIframeClient.ts +40 -3
  186. package/src/packageMetadata.ts +1 -1
  187. package/src/request/RedirectRequest.ts +5 -0
@@ -1,386 +1,386 @@
1
- import { CommonAuthorizationCodeRequest, ICrypto, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo, ValidCredentialType, TokenKeys, CredentialType, CacheRecord, IPerformanceClient, StaticAuthorityOptions, StoreInCache } from "@azure/msal-common";
2
- import { CacheOptions } from "../config/Configuration";
3
- import { BrowserCacheLocation, InteractionType } from "../utils/BrowserConstants";
4
- import { MemoryStorage } from "./MemoryStorage";
5
- import { IWindowStorage } from "./IWindowStorage";
6
- import { NativeTokenRequest } from "../broker/nativeBroker/NativeRequest";
7
- import { AuthenticationResult } from "../response/AuthenticationResult";
8
- import { SilentRequest } from "../request/SilentRequest";
9
- import { SsoSilentRequest } from "../request/SsoSilentRequest";
10
- import { RedirectRequest } from "../request/RedirectRequest";
11
- import { PopupRequest } from "../request/PopupRequest";
12
- /**
13
- * This class implements the cache storage interface for MSAL through browser local or session storage.
14
- * Cookies are only used if storeAuthStateInCookie is true, and are only used for
15
- * parameters such as state and nonce, generally.
16
- */
17
- export declare class BrowserCacheManager extends CacheManager {
18
- protected cacheConfig: Required<CacheOptions>;
19
- protected browserStorage: IWindowStorage<string>;
20
- protected internalStorage: MemoryStorage<string>;
21
- protected temporaryCacheStorage: IWindowStorage<string>;
22
- protected logger: Logger;
23
- protected performanceClient?: IPerformanceClient;
24
- protected readonly COOKIE_LIFE_MULTIPLIER: number;
25
- constructor(clientId: string, cacheConfig: Required<CacheOptions>, cryptoImpl: ICrypto, logger: Logger, staticAuthorityOptions?: StaticAuthorityOptions, performanceClient?: IPerformanceClient);
26
- /**
27
- * Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
28
- * @param cacheLocation
29
- */
30
- protected setupBrowserStorage(cacheLocation: BrowserCacheLocation | string): IWindowStorage<string>;
31
- /**
32
- * Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured temporaryCacheLocation.
33
- * @param temporaryCacheLocation
34
- * @param cacheLocation
35
- */
36
- protected setupTemporaryCacheStorage(temporaryCacheLocation: BrowserCacheLocation | string, cacheLocation: BrowserCacheLocation | string): IWindowStorage<string>;
37
- /**
38
- * Migrate all old cache entries to new schema. No rollback supported.
39
- * @param storeAuthStateInCookie
40
- */
41
- protected migrateCacheEntries(): void;
42
- /**
43
- * Searches all cache entries for MSAL accounts and creates the account key map
44
- * This is used to migrate users from older versions of MSAL which did not create the map.
45
- * @returns
46
- */
47
- private createKeyMaps;
48
- /**
49
- * Parses passed value as JSON object, JSON.parse() will throw an error.
50
- * @param input
51
- */
52
- protected validateAndParseJson(jsonValue: string): object | null;
53
- /**
54
- * fetches the entry from the browser storage based off the key
55
- * @param key
56
- */
57
- getItem(key: string): string | null;
58
- /**
59
- * sets the entry in the browser storage
60
- * @param key
61
- * @param value
62
- */
63
- setItem(key: string, value: string): void;
64
- /**
65
- * fetch the account entity from the platform cache
66
- * @param accountKey
67
- */
68
- getAccount(accountKey: string, logger?: Logger): AccountEntity | null;
69
- /**
70
- * Reads account from cache, deserializes it into an account entity and returns it.
71
- * If account is not found from the key, returns null and removes key from map.
72
- * @param accountKey
73
- * @returns
74
- */
75
- getCachedAccountEntity(accountKey: string): AccountEntity | null;
76
- /**
77
- * set account entity in the platform cache
78
- * @param account
79
- */
80
- setAccount(account: AccountEntity): void;
81
- /**
82
- * Returns the array of account keys currently cached
83
- * @returns
84
- */
85
- getAccountKeys(): Array<string>;
86
- /**
87
- * Add a new account to the key map
88
- * @param key
89
- */
90
- addAccountKeyToMap(key: string): void;
91
- /**
92
- * Remove an account from the key map
93
- * @param key
94
- */
95
- removeAccountKeyFromMap(key: string): void;
96
- /**
97
- * Extends inherited removeAccount function to include removal of the account key from the map
98
- * @param key
99
- */
100
- removeAccount(key: string): Promise<void>;
101
- /**
102
- * Remove account entity from the platform cache if it's outdated
103
- * @param accountKey
104
- */
105
- removeOutdatedAccount(accountKey: string): void;
106
- /**
107
- * Removes given idToken from the cache and from the key map
108
- * @param key
109
- */
110
- removeIdToken(key: string): void;
111
- /**
112
- * Removes given accessToken from the cache and from the key map
113
- * @param key
114
- */
115
- removeAccessToken(key: string): Promise<void>;
116
- /**
117
- * Removes given refreshToken from the cache and from the key map
118
- * @param key
119
- */
120
- removeRefreshToken(key: string): void;
121
- /**
122
- * Gets the keys for the cached tokens associated with this clientId
123
- * @returns
124
- */
125
- getTokenKeys(): TokenKeys;
126
- /**
127
- * Adds the given key to the token key map
128
- * @param key
129
- * @param type
130
- */
131
- addTokenKey(key: string, type: CredentialType): void;
132
- /**
133
- * Removes the given key from the token key map
134
- * @param key
135
- * @param type
136
- */
137
- removeTokenKey(key: string, type: CredentialType): void;
138
- /**
139
- * generates idToken entity from a string
140
- * @param idTokenKey
141
- */
142
- getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;
143
- /**
144
- * set IdToken credential to the platform cache
145
- * @param idToken
146
- */
147
- setIdTokenCredential(idToken: IdTokenEntity): void;
148
- /**
149
- * generates accessToken entity from a string
150
- * @param key
151
- */
152
- getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;
153
- /**
154
- * set accessToken credential to the platform cache
155
- * @param accessToken
156
- */
157
- setAccessTokenCredential(accessToken: AccessTokenEntity): void;
158
- /**
159
- * generates refreshToken entity from a string
160
- * @param refreshTokenKey
161
- */
162
- getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;
163
- /**
164
- * set refreshToken credential to the platform cache
165
- * @param refreshToken
166
- */
167
- setRefreshTokenCredential(refreshToken: RefreshTokenEntity): void;
168
- /**
169
- * fetch appMetadata entity from the platform cache
170
- * @param appMetadataKey
171
- */
172
- getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;
173
- /**
174
- * set appMetadata entity to the platform cache
175
- * @param appMetadata
176
- */
177
- setAppMetadata(appMetadata: AppMetadataEntity): void;
178
- /**
179
- * fetch server telemetry entity from the platform cache
180
- * @param serverTelemetryKey
181
- */
182
- getServerTelemetry(serverTelemetryKey: string): ServerTelemetryEntity | null;
183
- /**
184
- * set server telemetry entity to the platform cache
185
- * @param serverTelemetryKey
186
- * @param serverTelemetry
187
- */
188
- setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;
189
- /**
190
- *
191
- */
192
- getAuthorityMetadata(key: string): AuthorityMetadataEntity | null;
193
- /**
194
- *
195
- */
196
- getAuthorityMetadataKeys(): Array<string>;
197
- /**
198
- * Sets wrapper metadata in memory
199
- * @param wrapperSKU
200
- * @param wrapperVersion
201
- */
202
- setWrapperMetadata(wrapperSKU: string, wrapperVersion: string): void;
203
- /**
204
- * Returns wrapper metadata from in-memory storage
205
- */
206
- getWrapperMetadata(): [string, string];
207
- /**
208
- *
209
- * @param entity
210
- */
211
- setAuthorityMetadata(key: string, entity: AuthorityMetadataEntity): void;
212
- /**
213
- * Gets the active account
214
- */
215
- getActiveAccount(): AccountInfo | null;
216
- /**
217
- * Sets the active account's localAccountId in cache
218
- * @param account
219
- */
220
- setActiveAccount(account: AccountInfo | null): void;
221
- /**
222
- * fetch throttling entity from the platform cache
223
- * @param throttlingCacheKey
224
- */
225
- getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;
226
- /**
227
- * set throttling entity to the platform cache
228
- * @param throttlingCacheKey
229
- * @param throttlingCache
230
- */
231
- setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;
232
- /**
233
- * Gets cache item with given key.
234
- * Will retrieve from cookies if storeAuthStateInCookie is set to true.
235
- * @param key
236
- */
237
- getTemporaryCache(cacheKey: string, generateKey?: boolean): string | null;
238
- /**
239
- * Sets the cache item with the key and value given.
240
- * Stores in cookie if storeAuthStateInCookie is set to true.
241
- * This can cause cookie overflow if used incorrectly.
242
- * @param key
243
- * @param value
244
- */
245
- setTemporaryCache(cacheKey: string, value: string, generateKey?: boolean): void;
246
- /**
247
- * Removes the cache item with the given key.
248
- * @param key
249
- */
250
- removeItem(key: string): void;
251
- /**
252
- * Removes the temporary cache item with the given key.
253
- * Will also clear the cookie item if storeAuthStateInCookie is set to true.
254
- * @param key
255
- */
256
- removeTemporaryItem(key: string): void;
257
- /**
258
- * Gets all keys in window.
259
- */
260
- getKeys(): string[];
261
- /**
262
- * Clears all cache entries created by MSAL.
263
- */
264
- clear(): Promise<void>;
265
- /**
266
- * Clears all access tokes that have claims prior to saving the current one
267
- * @param performanceClient {IPerformanceClient}
268
- * @param correlationId {string} correlation id
269
- * @returns
270
- */
271
- clearTokensAndKeysWithClaims(performanceClient: IPerformanceClient, correlationId: string): Promise<void>;
272
- /**
273
- * Add value to cookies
274
- * @param cookieName
275
- * @param cookieValue
276
- * @param expires
277
- * @deprecated
278
- */
279
- setItemCookie(cookieName: string, cookieValue: string, expires?: number): void;
280
- /**
281
- * Get one item by key from cookies
282
- * @param cookieName
283
- * @deprecated
284
- */
285
- getItemCookie(cookieName: string): string;
286
- /**
287
- * Clear all msal-related cookies currently set in the browser. Should only be used to clear temporary cache items.
288
- * @deprecated
289
- */
290
- clearMsalCookies(): void;
291
- /**
292
- * Clear an item in the cookies by key
293
- * @param cookieName
294
- * @deprecated
295
- */
296
- clearItemCookie(cookieName: string): void;
297
- /**
298
- * Get cookie expiration time
299
- * @param cookieLifeDays
300
- * @deprecated
301
- */
302
- getCookieExpirationTime(cookieLifeDays: number): string;
303
- /**
304
- * Prepend msal.<client-id> to each key; Skip for any JSON object as Key (defined schemas do not need the key appended: AccessToken Keys or the upcoming schema)
305
- * @param key
306
- * @param addInstanceId
307
- */
308
- generateCacheKey(key: string): string;
309
- /**
310
- * Create authorityKey to cache authority
311
- * @param state
312
- */
313
- generateAuthorityKey(stateString: string): string;
314
- /**
315
- * Create Nonce key to cache nonce
316
- * @param state
317
- */
318
- generateNonceKey(stateString: string): string;
319
- /**
320
- * Creates full cache key for the request state
321
- * @param stateString State string for the request
322
- */
323
- generateStateKey(stateString: string): string;
324
- /**
325
- * Gets the cached authority based on the cached state. Returns empty if no cached state found.
326
- */
327
- getCachedAuthority(cachedState: string): string | null;
328
- /**
329
- * Updates account, authority, and state in cache
330
- * @param serverAuthenticationRequest
331
- * @param account
332
- */
333
- updateCacheEntries(state: string, nonce: string, authorityInstance: string, loginHint: string, account: AccountInfo | null): void;
334
- /**
335
- * Reset all temporary cache items
336
- * @param state
337
- */
338
- resetRequestCache(state: string): void;
339
- /**
340
- * Removes temporary cache for the provided state
341
- * @param stateString
342
- */
343
- cleanRequestByState(stateString: string): void;
344
- /**
345
- * Looks in temporary cache for any state values with the provided interactionType and removes all temporary cache items for that state
346
- * Used in scenarios where temp cache needs to be cleaned but state is not known, such as clicking browser back button.
347
- * @param interactionType
348
- */
349
- cleanRequestByInteractionType(interactionType: InteractionType): void;
350
- cacheCodeRequest(authCodeRequest: CommonAuthorizationCodeRequest): void;
351
- /**
352
- * Gets the token exchange parameters from the cache. Throws an error if nothing is found.
353
- */
354
- getCachedRequest(state: string): CommonAuthorizationCodeRequest;
355
- /**
356
- * Gets cached native request for redirect flows
357
- */
358
- getCachedNativeRequest(): NativeTokenRequest | null;
359
- isInteractionInProgress(matchClientId?: boolean): boolean;
360
- getInteractionInProgress(): string | null;
361
- setInteractionInProgress(inProgress: boolean): void;
362
- /**
363
- * Returns username retrieved from ADAL or MSAL v1 idToken
364
- * @deprecated
365
- */
366
- getLegacyLoginHint(): string | null;
367
- /**
368
- * Updates a credential's cache key if the current cache key is outdated
369
- */
370
- updateCredentialCacheKey(currentCacheKey: string, credential: ValidCredentialType): string;
371
- /**
372
- * Builds credential entities from AuthenticationResult object and saves the resulting credentials to the cache
373
- * @param result
374
- * @param request
375
- */
376
- hydrateCache(result: AuthenticationResult, request: SilentRequest | SsoSilentRequest | RedirectRequest | PopupRequest): Promise<void>;
377
- /**
378
- * saves a cache record
379
- * @param cacheRecord {CacheRecord}
380
- * @param storeInCache {?StoreInCache}
381
- * @param correlationId {?string} correlation id
382
- */
383
- saveCacheRecord(cacheRecord: CacheRecord, storeInCache?: StoreInCache, correlationId?: string): Promise<void>;
384
- }
385
- export declare const DEFAULT_BROWSER_CACHE_MANAGER: (clientId: string, logger: Logger) => BrowserCacheManager;
1
+ import { CommonAuthorizationCodeRequest, ICrypto, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo, ValidCredentialType, TokenKeys, CredentialType, CacheRecord, IPerformanceClient, StaticAuthorityOptions, StoreInCache } from "@azure/msal-common";
2
+ import { CacheOptions } from "../config/Configuration";
3
+ import { BrowserCacheLocation, InteractionType } from "../utils/BrowserConstants";
4
+ import { MemoryStorage } from "./MemoryStorage";
5
+ import { IWindowStorage } from "./IWindowStorage";
6
+ import { NativeTokenRequest } from "../broker/nativeBroker/NativeRequest";
7
+ import { AuthenticationResult } from "../response/AuthenticationResult";
8
+ import { SilentRequest } from "../request/SilentRequest";
9
+ import { SsoSilentRequest } from "../request/SsoSilentRequest";
10
+ import { RedirectRequest } from "../request/RedirectRequest";
11
+ import { PopupRequest } from "../request/PopupRequest";
12
+ /**
13
+ * This class implements the cache storage interface for MSAL through browser local or session storage.
14
+ * Cookies are only used if storeAuthStateInCookie is true, and are only used for
15
+ * parameters such as state and nonce, generally.
16
+ */
17
+ export declare class BrowserCacheManager extends CacheManager {
18
+ protected cacheConfig: Required<CacheOptions>;
19
+ protected browserStorage: IWindowStorage<string>;
20
+ protected internalStorage: MemoryStorage<string>;
21
+ protected temporaryCacheStorage: IWindowStorage<string>;
22
+ protected logger: Logger;
23
+ protected performanceClient?: IPerformanceClient;
24
+ protected readonly COOKIE_LIFE_MULTIPLIER: number;
25
+ constructor(clientId: string, cacheConfig: Required<CacheOptions>, cryptoImpl: ICrypto, logger: Logger, staticAuthorityOptions?: StaticAuthorityOptions, performanceClient?: IPerformanceClient);
26
+ /**
27
+ * Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
28
+ * @param cacheLocation
29
+ */
30
+ protected setupBrowserStorage(cacheLocation: BrowserCacheLocation | string): IWindowStorage<string>;
31
+ /**
32
+ * Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured temporaryCacheLocation.
33
+ * @param temporaryCacheLocation
34
+ * @param cacheLocation
35
+ */
36
+ protected setupTemporaryCacheStorage(temporaryCacheLocation: BrowserCacheLocation | string, cacheLocation: BrowserCacheLocation | string): IWindowStorage<string>;
37
+ /**
38
+ * Migrate all old cache entries to new schema. No rollback supported.
39
+ * @param storeAuthStateInCookie
40
+ */
41
+ protected migrateCacheEntries(): void;
42
+ /**
43
+ * Searches all cache entries for MSAL accounts and creates the account key map
44
+ * This is used to migrate users from older versions of MSAL which did not create the map.
45
+ * @returns
46
+ */
47
+ private createKeyMaps;
48
+ /**
49
+ * Parses passed value as JSON object, JSON.parse() will throw an error.
50
+ * @param input
51
+ */
52
+ protected validateAndParseJson(jsonValue: string): object | null;
53
+ /**
54
+ * fetches the entry from the browser storage based off the key
55
+ * @param key
56
+ */
57
+ getItem(key: string): string | null;
58
+ /**
59
+ * sets the entry in the browser storage
60
+ * @param key
61
+ * @param value
62
+ */
63
+ setItem(key: string, value: string): void;
64
+ /**
65
+ * fetch the account entity from the platform cache
66
+ * @param accountKey
67
+ */
68
+ getAccount(accountKey: string, logger?: Logger): AccountEntity | null;
69
+ /**
70
+ * Reads account from cache, deserializes it into an account entity and returns it.
71
+ * If account is not found from the key, returns null and removes key from map.
72
+ * @param accountKey
73
+ * @returns
74
+ */
75
+ getCachedAccountEntity(accountKey: string): AccountEntity | null;
76
+ /**
77
+ * set account entity in the platform cache
78
+ * @param account
79
+ */
80
+ setAccount(account: AccountEntity): void;
81
+ /**
82
+ * Returns the array of account keys currently cached
83
+ * @returns
84
+ */
85
+ getAccountKeys(): Array<string>;
86
+ /**
87
+ * Add a new account to the key map
88
+ * @param key
89
+ */
90
+ addAccountKeyToMap(key: string): void;
91
+ /**
92
+ * Remove an account from the key map
93
+ * @param key
94
+ */
95
+ removeAccountKeyFromMap(key: string): void;
96
+ /**
97
+ * Extends inherited removeAccount function to include removal of the account key from the map
98
+ * @param key
99
+ */
100
+ removeAccount(key: string): Promise<void>;
101
+ /**
102
+ * Remove account entity from the platform cache if it's outdated
103
+ * @param accountKey
104
+ */
105
+ removeOutdatedAccount(accountKey: string): void;
106
+ /**
107
+ * Removes given idToken from the cache and from the key map
108
+ * @param key
109
+ */
110
+ removeIdToken(key: string): void;
111
+ /**
112
+ * Removes given accessToken from the cache and from the key map
113
+ * @param key
114
+ */
115
+ removeAccessToken(key: string): Promise<void>;
116
+ /**
117
+ * Removes given refreshToken from the cache and from the key map
118
+ * @param key
119
+ */
120
+ removeRefreshToken(key: string): void;
121
+ /**
122
+ * Gets the keys for the cached tokens associated with this clientId
123
+ * @returns
124
+ */
125
+ getTokenKeys(): TokenKeys;
126
+ /**
127
+ * Adds the given key to the token key map
128
+ * @param key
129
+ * @param type
130
+ */
131
+ addTokenKey(key: string, type: CredentialType): void;
132
+ /**
133
+ * Removes the given key from the token key map
134
+ * @param key
135
+ * @param type
136
+ */
137
+ removeTokenKey(key: string, type: CredentialType): void;
138
+ /**
139
+ * generates idToken entity from a string
140
+ * @param idTokenKey
141
+ */
142
+ getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;
143
+ /**
144
+ * set IdToken credential to the platform cache
145
+ * @param idToken
146
+ */
147
+ setIdTokenCredential(idToken: IdTokenEntity): void;
148
+ /**
149
+ * generates accessToken entity from a string
150
+ * @param key
151
+ */
152
+ getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;
153
+ /**
154
+ * set accessToken credential to the platform cache
155
+ * @param accessToken
156
+ */
157
+ setAccessTokenCredential(accessToken: AccessTokenEntity): void;
158
+ /**
159
+ * generates refreshToken entity from a string
160
+ * @param refreshTokenKey
161
+ */
162
+ getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;
163
+ /**
164
+ * set refreshToken credential to the platform cache
165
+ * @param refreshToken
166
+ */
167
+ setRefreshTokenCredential(refreshToken: RefreshTokenEntity): void;
168
+ /**
169
+ * fetch appMetadata entity from the platform cache
170
+ * @param appMetadataKey
171
+ */
172
+ getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;
173
+ /**
174
+ * set appMetadata entity to the platform cache
175
+ * @param appMetadata
176
+ */
177
+ setAppMetadata(appMetadata: AppMetadataEntity): void;
178
+ /**
179
+ * fetch server telemetry entity from the platform cache
180
+ * @param serverTelemetryKey
181
+ */
182
+ getServerTelemetry(serverTelemetryKey: string): ServerTelemetryEntity | null;
183
+ /**
184
+ * set server telemetry entity to the platform cache
185
+ * @param serverTelemetryKey
186
+ * @param serverTelemetry
187
+ */
188
+ setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;
189
+ /**
190
+ *
191
+ */
192
+ getAuthorityMetadata(key: string): AuthorityMetadataEntity | null;
193
+ /**
194
+ *
195
+ */
196
+ getAuthorityMetadataKeys(): Array<string>;
197
+ /**
198
+ * Sets wrapper metadata in memory
199
+ * @param wrapperSKU
200
+ * @param wrapperVersion
201
+ */
202
+ setWrapperMetadata(wrapperSKU: string, wrapperVersion: string): void;
203
+ /**
204
+ * Returns wrapper metadata from in-memory storage
205
+ */
206
+ getWrapperMetadata(): [string, string];
207
+ /**
208
+ *
209
+ * @param entity
210
+ */
211
+ setAuthorityMetadata(key: string, entity: AuthorityMetadataEntity): void;
212
+ /**
213
+ * Gets the active account
214
+ */
215
+ getActiveAccount(): AccountInfo | null;
216
+ /**
217
+ * Sets the active account's localAccountId in cache
218
+ * @param account
219
+ */
220
+ setActiveAccount(account: AccountInfo | null): void;
221
+ /**
222
+ * fetch throttling entity from the platform cache
223
+ * @param throttlingCacheKey
224
+ */
225
+ getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;
226
+ /**
227
+ * set throttling entity to the platform cache
228
+ * @param throttlingCacheKey
229
+ * @param throttlingCache
230
+ */
231
+ setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;
232
+ /**
233
+ * Gets cache item with given key.
234
+ * Will retrieve from cookies if storeAuthStateInCookie is set to true.
235
+ * @param key
236
+ */
237
+ getTemporaryCache(cacheKey: string, generateKey?: boolean): string | null;
238
+ /**
239
+ * Sets the cache item with the key and value given.
240
+ * Stores in cookie if storeAuthStateInCookie is set to true.
241
+ * This can cause cookie overflow if used incorrectly.
242
+ * @param key
243
+ * @param value
244
+ */
245
+ setTemporaryCache(cacheKey: string, value: string, generateKey?: boolean): void;
246
+ /**
247
+ * Removes the cache item with the given key.
248
+ * @param key
249
+ */
250
+ removeItem(key: string): void;
251
+ /**
252
+ * Removes the temporary cache item with the given key.
253
+ * Will also clear the cookie item if storeAuthStateInCookie is set to true.
254
+ * @param key
255
+ */
256
+ removeTemporaryItem(key: string): void;
257
+ /**
258
+ * Gets all keys in window.
259
+ */
260
+ getKeys(): string[];
261
+ /**
262
+ * Clears all cache entries created by MSAL.
263
+ */
264
+ clear(): Promise<void>;
265
+ /**
266
+ * Clears all access tokes that have claims prior to saving the current one
267
+ * @param performanceClient {IPerformanceClient}
268
+ * @param correlationId {string} correlation id
269
+ * @returns
270
+ */
271
+ clearTokensAndKeysWithClaims(performanceClient: IPerformanceClient, correlationId: string): Promise<void>;
272
+ /**
273
+ * Add value to cookies
274
+ * @param cookieName
275
+ * @param cookieValue
276
+ * @param expires
277
+ * @deprecated
278
+ */
279
+ setItemCookie(cookieName: string, cookieValue: string, expires?: number): void;
280
+ /**
281
+ * Get one item by key from cookies
282
+ * @param cookieName
283
+ * @deprecated
284
+ */
285
+ getItemCookie(cookieName: string): string;
286
+ /**
287
+ * Clear all msal-related cookies currently set in the browser. Should only be used to clear temporary cache items.
288
+ * @deprecated
289
+ */
290
+ clearMsalCookies(): void;
291
+ /**
292
+ * Clear an item in the cookies by key
293
+ * @param cookieName
294
+ * @deprecated
295
+ */
296
+ clearItemCookie(cookieName: string): void;
297
+ /**
298
+ * Get cookie expiration time
299
+ * @param cookieLifeDays
300
+ * @deprecated
301
+ */
302
+ getCookieExpirationTime(cookieLifeDays: number): string;
303
+ /**
304
+ * Prepend msal.<client-id> to each key; Skip for any JSON object as Key (defined schemas do not need the key appended: AccessToken Keys or the upcoming schema)
305
+ * @param key
306
+ * @param addInstanceId
307
+ */
308
+ generateCacheKey(key: string): string;
309
+ /**
310
+ * Create authorityKey to cache authority
311
+ * @param state
312
+ */
313
+ generateAuthorityKey(stateString: string): string;
314
+ /**
315
+ * Create Nonce key to cache nonce
316
+ * @param state
317
+ */
318
+ generateNonceKey(stateString: string): string;
319
+ /**
320
+ * Creates full cache key for the request state
321
+ * @param stateString State string for the request
322
+ */
323
+ generateStateKey(stateString: string): string;
324
+ /**
325
+ * Gets the cached authority based on the cached state. Returns empty if no cached state found.
326
+ */
327
+ getCachedAuthority(cachedState: string): string | null;
328
+ /**
329
+ * Updates account, authority, and state in cache
330
+ * @param serverAuthenticationRequest
331
+ * @param account
332
+ */
333
+ updateCacheEntries(state: string, nonce: string, authorityInstance: string, loginHint: string, account: AccountInfo | null): void;
334
+ /**
335
+ * Reset all temporary cache items
336
+ * @param state
337
+ */
338
+ resetRequestCache(state: string): void;
339
+ /**
340
+ * Removes temporary cache for the provided state
341
+ * @param stateString
342
+ */
343
+ cleanRequestByState(stateString: string): void;
344
+ /**
345
+ * Looks in temporary cache for any state values with the provided interactionType and removes all temporary cache items for that state
346
+ * Used in scenarios where temp cache needs to be cleaned but state is not known, such as clicking browser back button.
347
+ * @param interactionType
348
+ */
349
+ cleanRequestByInteractionType(interactionType: InteractionType): void;
350
+ cacheCodeRequest(authCodeRequest: CommonAuthorizationCodeRequest): void;
351
+ /**
352
+ * Gets the token exchange parameters from the cache. Throws an error if nothing is found.
353
+ */
354
+ getCachedRequest(state: string): CommonAuthorizationCodeRequest;
355
+ /**
356
+ * Gets cached native request for redirect flows
357
+ */
358
+ getCachedNativeRequest(): NativeTokenRequest | null;
359
+ isInteractionInProgress(matchClientId?: boolean): boolean;
360
+ getInteractionInProgress(): string | null;
361
+ setInteractionInProgress(inProgress: boolean): void;
362
+ /**
363
+ * Returns username retrieved from ADAL or MSAL v1 idToken
364
+ * @deprecated
365
+ */
366
+ getLegacyLoginHint(): string | null;
367
+ /**
368
+ * Updates a credential's cache key if the current cache key is outdated
369
+ */
370
+ updateCredentialCacheKey(currentCacheKey: string, credential: ValidCredentialType): string;
371
+ /**
372
+ * Builds credential entities from AuthenticationResult object and saves the resulting credentials to the cache
373
+ * @param result
374
+ * @param request
375
+ */
376
+ hydrateCache(result: AuthenticationResult, request: SilentRequest | SsoSilentRequest | RedirectRequest | PopupRequest): Promise<void>;
377
+ /**
378
+ * saves a cache record
379
+ * @param cacheRecord {CacheRecord}
380
+ * @param storeInCache {?StoreInCache}
381
+ * @param correlationId {?string} correlation id
382
+ */
383
+ saveCacheRecord(cacheRecord: CacheRecord, storeInCache?: StoreInCache, correlationId?: string): Promise<void>;
384
+ }
385
+ export declare const DEFAULT_BROWSER_CACHE_MANAGER: (clientId: string, logger: Logger) => BrowserCacheManager;
386
386
  //# sourceMappingURL=BrowserCacheManager.d.ts.map