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