@azure/msal-browser 4.18.0 → 4.20.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 (445) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/app/PublicClientNext.mjs +1 -1
  4. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  5. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
  6. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
  7. package/dist/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
  8. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +3 -2
  9. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs.map +1 -1
  10. package/dist/cache/AccountManager.d.ts.map +1 -1
  11. package/dist/cache/AccountManager.mjs +1 -6
  12. package/dist/cache/AccountManager.mjs.map +1 -1
  13. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  14. package/dist/cache/BrowserCacheManager.d.ts +26 -11
  15. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  16. package/dist/cache/BrowserCacheManager.mjs +239 -56
  17. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  18. package/dist/cache/CacheHelpers.d.ts +2 -2
  19. package/dist/cache/CacheHelpers.d.ts.map +1 -1
  20. package/dist/cache/CacheHelpers.mjs +6 -6
  21. package/dist/cache/CacheHelpers.mjs.map +1 -1
  22. package/dist/cache/CacheKeys.d.ts +14 -0
  23. package/dist/cache/CacheKeys.d.ts.map +1 -0
  24. package/dist/cache/CacheKeys.mjs +33 -0
  25. package/dist/cache/CacheKeys.mjs.map +1 -0
  26. package/dist/cache/CookieStorage.d.ts +1 -0
  27. package/dist/cache/CookieStorage.d.ts.map +1 -1
  28. package/dist/cache/CookieStorage.mjs +5 -1
  29. package/dist/cache/CookieStorage.mjs.map +1 -1
  30. package/dist/cache/DatabaseStorage.mjs +1 -1
  31. package/dist/cache/EncryptedData.d.ts +8 -0
  32. package/dist/cache/EncryptedData.d.ts.map +1 -0
  33. package/dist/cache/EncryptedData.mjs +14 -0
  34. package/dist/cache/EncryptedData.mjs.map +1 -0
  35. package/dist/cache/IWindowStorage.d.ts +2 -0
  36. package/dist/cache/IWindowStorage.d.ts.map +1 -1
  37. package/dist/cache/LocalStorage.d.ts +2 -0
  38. package/dist/cache/LocalStorage.d.ts.map +1 -1
  39. package/dist/cache/LocalStorage.mjs +46 -13
  40. package/dist/cache/LocalStorage.mjs.map +1 -1
  41. package/dist/cache/MemoryStorage.d.ts +1 -0
  42. package/dist/cache/MemoryStorage.d.ts.map +1 -1
  43. package/dist/cache/MemoryStorage.mjs +5 -1
  44. package/dist/cache/MemoryStorage.mjs.map +1 -1
  45. package/dist/cache/SessionStorage.d.ts +1 -0
  46. package/dist/cache/SessionStorage.d.ts.map +1 -1
  47. package/dist/cache/SessionStorage.mjs +5 -1
  48. package/dist/cache/SessionStorage.mjs.map +1 -1
  49. package/dist/cache/TokenCache.mjs +1 -1
  50. package/dist/config/Configuration.d.ts +4 -0
  51. package/dist/config/Configuration.d.ts.map +1 -1
  52. package/dist/config/Configuration.mjs +2 -1
  53. package/dist/config/Configuration.mjs.map +1 -1
  54. package/dist/controllers/ControllerFactory.mjs +1 -1
  55. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  56. package/dist/controllers/StandardController.d.ts.map +1 -1
  57. package/dist/controllers/StandardController.mjs +26 -14
  58. package/dist/controllers/StandardController.mjs.map +1 -1
  59. package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
  60. package/dist/crypto/BrowserCrypto.mjs +1 -1
  61. package/dist/crypto/CryptoOps.mjs +1 -1
  62. package/dist/crypto/PkceGenerator.mjs +1 -1
  63. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  64. package/dist/custom-auth-path/app/PublicClientApplication.mjs +1 -1
  65. package/dist/custom-auth-path/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  66. package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
  67. package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
  68. package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
  69. package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthProvider.mjs +3 -2
  70. package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthProvider.mjs.map +1 -1
  71. package/dist/custom-auth-path/cache/AccountManager.d.ts.map +1 -1
  72. package/dist/custom-auth-path/cache/AccountManager.mjs +1 -6
  73. package/dist/custom-auth-path/cache/AccountManager.mjs.map +1 -1
  74. package/dist/custom-auth-path/cache/AsyncMemoryStorage.mjs +1 -1
  75. package/dist/custom-auth-path/cache/BrowserCacheManager.d.ts +26 -11
  76. package/dist/custom-auth-path/cache/BrowserCacheManager.d.ts.map +1 -1
  77. package/dist/custom-auth-path/cache/BrowserCacheManager.mjs +239 -56
  78. package/dist/custom-auth-path/cache/BrowserCacheManager.mjs.map +1 -1
  79. package/dist/custom-auth-path/cache/CacheHelpers.d.ts +2 -2
  80. package/dist/custom-auth-path/cache/CacheHelpers.d.ts.map +1 -1
  81. package/dist/custom-auth-path/cache/CacheHelpers.mjs +6 -6
  82. package/dist/custom-auth-path/cache/CacheHelpers.mjs.map +1 -1
  83. package/dist/custom-auth-path/cache/CacheKeys.d.ts +14 -0
  84. package/dist/custom-auth-path/cache/CacheKeys.d.ts.map +1 -0
  85. package/dist/custom-auth-path/cache/CacheKeys.mjs +32 -0
  86. package/dist/custom-auth-path/cache/CacheKeys.mjs.map +1 -0
  87. package/dist/custom-auth-path/cache/CookieStorage.d.ts +1 -0
  88. package/dist/custom-auth-path/cache/CookieStorage.d.ts.map +1 -1
  89. package/dist/custom-auth-path/cache/CookieStorage.mjs +5 -1
  90. package/dist/custom-auth-path/cache/CookieStorage.mjs.map +1 -1
  91. package/dist/custom-auth-path/cache/DatabaseStorage.mjs +1 -1
  92. package/dist/custom-auth-path/cache/EncryptedData.d.ts +8 -0
  93. package/dist/custom-auth-path/cache/EncryptedData.d.ts.map +1 -0
  94. package/dist/custom-auth-path/cache/EncryptedData.mjs +14 -0
  95. package/dist/custom-auth-path/cache/EncryptedData.mjs.map +1 -0
  96. package/dist/custom-auth-path/cache/IWindowStorage.d.ts +2 -0
  97. package/dist/custom-auth-path/cache/IWindowStorage.d.ts.map +1 -1
  98. package/dist/custom-auth-path/cache/LocalStorage.d.ts +2 -0
  99. package/dist/custom-auth-path/cache/LocalStorage.d.ts.map +1 -1
  100. package/dist/custom-auth-path/cache/LocalStorage.mjs +46 -13
  101. package/dist/custom-auth-path/cache/LocalStorage.mjs.map +1 -1
  102. package/dist/custom-auth-path/cache/MemoryStorage.d.ts +1 -0
  103. package/dist/custom-auth-path/cache/MemoryStorage.d.ts.map +1 -1
  104. package/dist/custom-auth-path/cache/MemoryStorage.mjs +5 -1
  105. package/dist/custom-auth-path/cache/MemoryStorage.mjs.map +1 -1
  106. package/dist/custom-auth-path/cache/SessionStorage.d.ts +1 -0
  107. package/dist/custom-auth-path/cache/SessionStorage.d.ts.map +1 -1
  108. package/dist/custom-auth-path/cache/SessionStorage.mjs +5 -1
  109. package/dist/custom-auth-path/cache/SessionStorage.mjs.map +1 -1
  110. package/dist/custom-auth-path/cache/TokenCache.mjs +1 -1
  111. package/dist/custom-auth-path/config/Configuration.d.ts +4 -0
  112. package/dist/custom-auth-path/config/Configuration.d.ts.map +1 -1
  113. package/dist/custom-auth-path/config/Configuration.mjs +2 -1
  114. package/dist/custom-auth-path/config/Configuration.mjs.map +1 -1
  115. package/dist/custom-auth-path/controllers/ControllerFactory.mjs +1 -1
  116. package/dist/custom-auth-path/controllers/StandardController.d.ts.map +1 -1
  117. package/dist/custom-auth-path/controllers/StandardController.mjs +26 -14
  118. package/dist/custom-auth-path/controllers/StandardController.mjs.map +1 -1
  119. package/dist/custom-auth-path/crypto/BrowserCrypto.mjs +1 -1
  120. package/dist/custom-auth-path/crypto/CryptoOps.mjs +1 -1
  121. package/dist/custom-auth-path/crypto/PkceGenerator.mjs +1 -1
  122. package/dist/custom-auth-path/custom_auth/CustomAuthConstants.d.ts +1 -1
  123. package/dist/custom-auth-path/custom_auth/CustomAuthConstants.mjs +1 -1
  124. package/dist/custom-auth-path/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
  125. package/dist/custom-auth-path/custom_auth/controller/CustomAuthStandardController.mjs +1 -1
  126. package/dist/custom-auth-path/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  127. package/dist/custom-auth-path/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  128. package/dist/custom-auth-path/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  129. package/dist/custom-auth-path/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  130. package/dist/custom-auth-path/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
  131. package/dist/custom-auth-path/custom_auth/core/error/CustomAuthError.mjs +1 -1
  132. package/dist/custom-auth-path/custom_auth/core/error/HttpError.mjs +1 -1
  133. package/dist/custom-auth-path/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  134. package/dist/custom-auth-path/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
  135. package/dist/custom-auth-path/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  136. package/dist/custom-auth-path/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  137. package/dist/custom-auth-path/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  138. package/dist/custom-auth-path/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  139. package/dist/custom-auth-path/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  140. package/dist/custom-auth-path/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  141. package/dist/custom-auth-path/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  142. package/dist/custom-auth-path/custom_auth/core/error/UnexpectedError.mjs +1 -1
  143. package/dist/custom-auth-path/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  144. package/dist/custom-auth-path/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  145. package/dist/custom-auth-path/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  146. package/dist/custom-auth-path/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
  147. package/dist/custom-auth-path/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
  148. package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  149. package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  150. package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  151. package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  152. package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  153. package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  154. package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  155. package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  156. package/dist/custom-auth-path/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  157. package/dist/custom-auth-path/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  158. package/dist/custom-auth-path/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
  159. package/dist/custom-auth-path/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
  160. package/dist/custom-auth-path/custom_auth/core/utils/UrlUtils.mjs +1 -1
  161. package/dist/custom-auth-path/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  162. package/dist/custom-auth-path/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  163. package/dist/custom-auth-path/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  164. package/dist/custom-auth-path/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  165. package/dist/custom-auth-path/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  166. package/dist/custom-auth-path/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  167. package/dist/custom-auth-path/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  168. package/dist/custom-auth-path/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  169. package/dist/custom-auth-path/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
  170. package/dist/custom-auth-path/custom_auth/index.mjs +1 -1
  171. package/dist/custom-auth-path/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  172. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  173. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  174. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  175. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  176. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  177. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  178. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  179. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  180. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  181. package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  182. package/dist/custom-auth-path/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  183. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  184. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  185. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  186. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  187. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  188. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInSubmitCredentialResult.mjs +1 -1
  189. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  190. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  191. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  192. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  193. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  194. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  195. package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  196. package/dist/custom-auth-path/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  197. package/dist/custom-auth-path/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  198. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  199. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  200. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  201. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  202. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  203. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  204. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  205. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  206. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  207. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  208. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  209. package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  210. package/dist/custom-auth-path/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  211. package/dist/custom-auth-path/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  212. package/dist/custom-auth-path/encode/Base64Decode.mjs +1 -1
  213. package/dist/custom-auth-path/encode/Base64Encode.mjs +1 -1
  214. package/dist/custom-auth-path/error/BrowserAuthError.mjs +1 -1
  215. package/dist/custom-auth-path/error/BrowserAuthErrorCodes.mjs +1 -1
  216. package/dist/custom-auth-path/error/BrowserConfigurationAuthError.mjs +1 -1
  217. package/dist/custom-auth-path/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  218. package/dist/custom-auth-path/error/NativeAuthError.mjs +1 -1
  219. package/dist/custom-auth-path/error/NativeAuthErrorCodes.mjs +1 -1
  220. package/dist/custom-auth-path/event/EventHandler.mjs +1 -1
  221. package/dist/custom-auth-path/event/EventType.mjs +1 -1
  222. package/dist/custom-auth-path/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  223. package/dist/custom-auth-path/interaction_client/BaseInteractionClient.mjs +3 -7
  224. package/dist/custom-auth-path/interaction_client/BaseInteractionClient.mjs.map +1 -1
  225. package/dist/custom-auth-path/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  226. package/dist/custom-auth-path/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  227. package/dist/custom-auth-path/interaction_client/PlatformAuthInteractionClient.mjs +2 -2
  228. package/dist/custom-auth-path/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
  229. package/dist/custom-auth-path/interaction_client/PopupClient.d.ts.map +1 -1
  230. package/dist/custom-auth-path/interaction_client/PopupClient.mjs +1 -2
  231. package/dist/custom-auth-path/interaction_client/PopupClient.mjs.map +1 -1
  232. package/dist/custom-auth-path/interaction_client/RedirectClient.d.ts.map +1 -1
  233. package/dist/custom-auth-path/interaction_client/RedirectClient.mjs +1 -2
  234. package/dist/custom-auth-path/interaction_client/RedirectClient.mjs.map +1 -1
  235. package/dist/custom-auth-path/interaction_client/SilentAuthCodeClient.mjs +1 -1
  236. package/dist/custom-auth-path/interaction_client/SilentCacheClient.mjs +1 -1
  237. package/dist/custom-auth-path/interaction_client/SilentIframeClient.mjs +1 -1
  238. package/dist/custom-auth-path/interaction_client/SilentRefreshClient.mjs +1 -1
  239. package/dist/custom-auth-path/interaction_client/StandardInteractionClient.mjs +1 -1
  240. package/dist/custom-auth-path/interaction_handler/InteractionHandler.mjs +1 -1
  241. package/dist/custom-auth-path/interaction_handler/SilentHandler.mjs +1 -1
  242. package/dist/custom-auth-path/naa/AccountInfo.d.ts +1 -0
  243. package/dist/custom-auth-path/naa/AccountInfo.d.ts.map +1 -1
  244. package/dist/custom-auth-path/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
  245. package/dist/custom-auth-path/navigation/NavigationClient.mjs +1 -1
  246. package/dist/custom-auth-path/network/FetchClient.mjs +1 -1
  247. package/dist/custom-auth-path/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
  248. package/dist/custom-auth-path/operatingcontext/BaseOperatingContext.mjs +3 -2
  249. package/dist/custom-auth-path/operatingcontext/BaseOperatingContext.mjs.map +1 -1
  250. package/dist/custom-auth-path/operatingcontext/StandardOperatingContext.mjs +1 -1
  251. package/dist/custom-auth-path/packageMetadata.d.ts +1 -1
  252. package/dist/custom-auth-path/packageMetadata.mjs +2 -2
  253. package/dist/custom-auth-path/protocol/Authorize.mjs +1 -1
  254. package/dist/custom-auth-path/request/RequestHelpers.mjs +1 -1
  255. package/dist/custom-auth-path/response/ResponseHandler.mjs +1 -1
  256. package/dist/custom-auth-path/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
  257. package/dist/custom-auth-path/utils/BrowserConstants.d.ts +0 -10
  258. package/dist/custom-auth-path/utils/BrowserConstants.d.ts.map +1 -1
  259. package/dist/custom-auth-path/utils/BrowserConstants.mjs +3 -11
  260. package/dist/custom-auth-path/utils/BrowserConstants.mjs.map +1 -1
  261. package/dist/custom-auth-path/utils/BrowserProtocolUtils.mjs +1 -1
  262. package/dist/custom-auth-path/utils/BrowserUtils.mjs +1 -1
  263. package/dist/custom-auth-path/utils/Helpers.d.ts +7 -0
  264. package/dist/custom-auth-path/utils/Helpers.d.ts.map +1 -0
  265. package/dist/custom-auth-path/utils/Helpers.mjs +20 -0
  266. package/dist/custom-auth-path/utils/Helpers.mjs.map +1 -0
  267. package/dist/custom-auth-path/utils/MsalFrameStatsUtils.mjs +1 -1
  268. package/dist/custom_auth/CustomAuthConstants.d.ts +1 -1
  269. package/dist/encode/Base64Decode.mjs +1 -1
  270. package/dist/encode/Base64Encode.mjs +1 -1
  271. package/dist/error/BrowserAuthError.mjs +1 -1
  272. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  273. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  274. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  275. package/dist/error/NativeAuthError.mjs +1 -1
  276. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  277. package/dist/error/NestedAppAuthError.mjs +1 -1
  278. package/dist/event/EventHandler.mjs +1 -1
  279. package/dist/event/EventMessage.mjs +1 -1
  280. package/dist/event/EventType.mjs +1 -1
  281. package/dist/index.mjs +1 -1
  282. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  283. package/dist/interaction_client/BaseInteractionClient.mjs +3 -7
  284. package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
  285. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  286. package/dist/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  287. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +2 -2
  288. package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
  289. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  290. package/dist/interaction_client/PopupClient.mjs +1 -2
  291. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  292. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  293. package/dist/interaction_client/RedirectClient.mjs +1 -2
  294. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  295. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  296. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  297. package/dist/interaction_client/SilentIframeClient.mjs +1 -1
  298. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  299. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  300. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  301. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  302. package/dist/naa/AccountInfo.d.ts +1 -0
  303. package/dist/naa/AccountInfo.d.ts.map +1 -1
  304. package/dist/naa/BridgeError.mjs +1 -1
  305. package/dist/naa/BridgeProxy.mjs +1 -1
  306. package/dist/naa/BridgeStatusCode.mjs +1 -1
  307. package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
  308. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +3 -1
  309. package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
  310. package/dist/navigation/NavigationClient.mjs +1 -1
  311. package/dist/network/FetchClient.mjs +1 -1
  312. package/dist/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
  313. package/dist/operatingcontext/BaseOperatingContext.mjs +3 -2
  314. package/dist/operatingcontext/BaseOperatingContext.mjs.map +1 -1
  315. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  316. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  317. package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
  318. package/dist/packageMetadata.d.ts +1 -1
  319. package/dist/packageMetadata.mjs +2 -2
  320. package/dist/protocol/Authorize.mjs +1 -1
  321. package/dist/request/RequestHelpers.mjs +1 -1
  322. package/dist/response/ResponseHandler.mjs +1 -1
  323. package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
  324. package/dist/telemetry/BrowserPerformanceClient.mjs +3 -2
  325. package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -1
  326. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  327. package/dist/utils/BrowserConstants.d.ts +0 -10
  328. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  329. package/dist/utils/BrowserConstants.mjs +3 -12
  330. package/dist/utils/BrowserConstants.mjs.map +1 -1
  331. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  332. package/dist/utils/BrowserUtils.mjs +1 -1
  333. package/dist/utils/Helpers.d.ts +7 -0
  334. package/dist/utils/Helpers.d.ts.map +1 -0
  335. package/dist/utils/Helpers.mjs +20 -0
  336. package/dist/utils/Helpers.mjs.map +1 -0
  337. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  338. package/lib/custom-auth-path/msal-custom-auth.cjs +2686 -2554
  339. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  340. package/lib/custom-auth-path/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
  341. package/lib/custom-auth-path/types/cache/AccountManager.d.ts.map +1 -1
  342. package/lib/custom-auth-path/types/cache/BrowserCacheManager.d.ts +26 -11
  343. package/lib/custom-auth-path/types/cache/BrowserCacheManager.d.ts.map +1 -1
  344. package/lib/custom-auth-path/types/cache/CacheHelpers.d.ts +2 -2
  345. package/lib/custom-auth-path/types/cache/CacheHelpers.d.ts.map +1 -1
  346. package/lib/custom-auth-path/types/cache/CacheKeys.d.ts +14 -0
  347. package/lib/custom-auth-path/types/cache/CacheKeys.d.ts.map +1 -0
  348. package/lib/custom-auth-path/types/cache/CookieStorage.d.ts +1 -0
  349. package/lib/custom-auth-path/types/cache/CookieStorage.d.ts.map +1 -1
  350. package/lib/custom-auth-path/types/cache/EncryptedData.d.ts +8 -0
  351. package/lib/custom-auth-path/types/cache/EncryptedData.d.ts.map +1 -0
  352. package/lib/custom-auth-path/types/cache/IWindowStorage.d.ts +2 -0
  353. package/lib/custom-auth-path/types/cache/IWindowStorage.d.ts.map +1 -1
  354. package/lib/custom-auth-path/types/cache/LocalStorage.d.ts +2 -0
  355. package/lib/custom-auth-path/types/cache/LocalStorage.d.ts.map +1 -1
  356. package/lib/custom-auth-path/types/cache/MemoryStorage.d.ts +1 -0
  357. package/lib/custom-auth-path/types/cache/MemoryStorage.d.ts.map +1 -1
  358. package/lib/custom-auth-path/types/cache/SessionStorage.d.ts +1 -0
  359. package/lib/custom-auth-path/types/cache/SessionStorage.d.ts.map +1 -1
  360. package/lib/custom-auth-path/types/config/Configuration.d.ts +4 -0
  361. package/lib/custom-auth-path/types/config/Configuration.d.ts.map +1 -1
  362. package/lib/custom-auth-path/types/controllers/StandardController.d.ts.map +1 -1
  363. package/lib/custom-auth-path/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  364. package/lib/custom-auth-path/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  365. package/lib/custom-auth-path/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  366. package/lib/custom-auth-path/types/interaction_client/PopupClient.d.ts.map +1 -1
  367. package/lib/custom-auth-path/types/interaction_client/RedirectClient.d.ts.map +1 -1
  368. package/lib/custom-auth-path/types/naa/AccountInfo.d.ts +1 -0
  369. package/lib/custom-auth-path/types/naa/AccountInfo.d.ts.map +1 -1
  370. package/lib/custom-auth-path/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
  371. package/lib/custom-auth-path/types/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
  372. package/lib/custom-auth-path/types/packageMetadata.d.ts +1 -1
  373. package/lib/custom-auth-path/types/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
  374. package/lib/custom-auth-path/types/utils/BrowserConstants.d.ts +0 -10
  375. package/lib/custom-auth-path/types/utils/BrowserConstants.d.ts.map +1 -1
  376. package/lib/custom-auth-path/types/utils/Helpers.d.ts +7 -0
  377. package/lib/custom-auth-path/types/utils/Helpers.d.ts.map +1 -0
  378. package/lib/msal-browser.cjs +2754 -2610
  379. package/lib/msal-browser.cjs.map +1 -1
  380. package/lib/msal-browser.js +2754 -2610
  381. package/lib/msal-browser.js.map +1 -1
  382. package/lib/msal-browser.min.js +67 -69
  383. package/lib/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
  384. package/lib/types/cache/AccountManager.d.ts.map +1 -1
  385. package/lib/types/cache/BrowserCacheManager.d.ts +26 -11
  386. package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
  387. package/lib/types/cache/CacheHelpers.d.ts +2 -2
  388. package/lib/types/cache/CacheHelpers.d.ts.map +1 -1
  389. package/lib/types/cache/CacheKeys.d.ts +14 -0
  390. package/lib/types/cache/CacheKeys.d.ts.map +1 -0
  391. package/lib/types/cache/CookieStorage.d.ts +1 -0
  392. package/lib/types/cache/CookieStorage.d.ts.map +1 -1
  393. package/lib/types/cache/EncryptedData.d.ts +8 -0
  394. package/lib/types/cache/EncryptedData.d.ts.map +1 -0
  395. package/lib/types/cache/IWindowStorage.d.ts +2 -0
  396. package/lib/types/cache/IWindowStorage.d.ts.map +1 -1
  397. package/lib/types/cache/LocalStorage.d.ts +2 -0
  398. package/lib/types/cache/LocalStorage.d.ts.map +1 -1
  399. package/lib/types/cache/MemoryStorage.d.ts +1 -0
  400. package/lib/types/cache/MemoryStorage.d.ts.map +1 -1
  401. package/lib/types/cache/SessionStorage.d.ts +1 -0
  402. package/lib/types/cache/SessionStorage.d.ts.map +1 -1
  403. package/lib/types/config/Configuration.d.ts +4 -0
  404. package/lib/types/config/Configuration.d.ts.map +1 -1
  405. package/lib/types/controllers/StandardController.d.ts.map +1 -1
  406. package/lib/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  407. package/lib/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  408. package/lib/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  409. package/lib/types/interaction_client/PopupClient.d.ts.map +1 -1
  410. package/lib/types/interaction_client/RedirectClient.d.ts.map +1 -1
  411. package/lib/types/naa/AccountInfo.d.ts +1 -0
  412. package/lib/types/naa/AccountInfo.d.ts.map +1 -1
  413. package/lib/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
  414. package/lib/types/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
  415. package/lib/types/packageMetadata.d.ts +1 -1
  416. package/lib/types/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
  417. package/lib/types/utils/BrowserConstants.d.ts +0 -10
  418. package/lib/types/utils/BrowserConstants.d.ts.map +1 -1
  419. package/lib/types/utils/Helpers.d.ts +7 -0
  420. package/lib/types/utils/Helpers.d.ts.map +1 -0
  421. package/package.json +2 -2
  422. package/src/broker/nativeBroker/PlatformAuthProvider.ts +2 -4
  423. package/src/cache/AccountManager.ts +0 -6
  424. package/src/cache/BrowserCacheManager.ts +381 -61
  425. package/src/cache/CacheHelpers.ts +13 -5
  426. package/src/cache/CacheKeys.ts +39 -0
  427. package/src/cache/CookieStorage.ts +5 -0
  428. package/src/cache/EncryptedData.ts +19 -0
  429. package/src/cache/IWindowStorage.ts +8 -0
  430. package/src/cache/LocalStorage.ts +83 -27
  431. package/src/cache/MemoryStorage.ts +5 -0
  432. package/src/cache/SessionStorage.ts +5 -0
  433. package/src/config/Configuration.ts +5 -0
  434. package/src/controllers/StandardController.ts +28 -11
  435. package/src/interaction_client/BaseInteractionClient.ts +1 -15
  436. package/src/interaction_client/PlatformAuthInteractionClient.ts +4 -2
  437. package/src/interaction_client/PopupClient.ts +0 -5
  438. package/src/interaction_client/RedirectClient.ts +0 -5
  439. package/src/naa/AccountInfo.ts +1 -0
  440. package/src/naa/mapping/NestedAppAuthAdapter.ts +4 -0
  441. package/src/operatingcontext/BaseOperatingContext.ts +2 -5
  442. package/src/packageMetadata.ts +1 -1
  443. package/src/telemetry/BrowserPerformanceClient.ts +2 -4
  444. package/src/utils/BrowserConstants.ts +0 -15
  445. package/src/utils/Helpers.ts +19 -0
@@ -4,16 +4,21 @@
4
4
  */
5
5
 
6
6
  import { TokenKeys } from "@azure/msal-common/browser";
7
- import { StaticCacheKeys } from "../utils/BrowserConstants.js";
8
7
  import { IWindowStorage } from "./IWindowStorage.js";
8
+ import * as CacheKeys from "./CacheKeys.js";
9
9
 
10
10
  /**
11
11
  * Returns a list of cache keys for all known accounts
12
12
  * @param storage
13
13
  * @returns
14
14
  */
15
- export function getAccountKeys(storage: IWindowStorage<string>): Array<string> {
16
- const accountKeys = storage.getItem(StaticCacheKeys.ACCOUNT_KEYS);
15
+ export function getAccountKeys(
16
+ storage: IWindowStorage<string>,
17
+ schemaVersion?: number
18
+ ): Array<string> {
19
+ const accountKeys = storage.getItem(
20
+ CacheKeys.getAccountKeysCacheKey(schemaVersion)
21
+ );
17
22
  if (accountKeys) {
18
23
  return JSON.parse(accountKeys);
19
24
  }
@@ -29,9 +34,12 @@ export function getAccountKeys(storage: IWindowStorage<string>): Array<string> {
29
34
  */
30
35
  export function getTokenKeys(
31
36
  clientId: string,
32
- storage: IWindowStorage<string>
37
+ storage: IWindowStorage<string>,
38
+ schemaVersion?: number
33
39
  ): TokenKeys {
34
- const item = storage.getItem(`${StaticCacheKeys.TOKEN_KEYS}.${clientId}`);
40
+ const item = storage.getItem(
41
+ CacheKeys.getTokenKeysCacheKey(clientId, schemaVersion)
42
+ );
35
43
  if (item) {
36
44
  const tokenKeys = JSON.parse(item);
37
45
  if (
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ export const PREFIX = "msal";
7
+ const BROWSER_PREFIX = "browser";
8
+ export const CACHE_KEY_SEPARATOR = "-";
9
+ export const CREDENTIAL_SCHEMA_VERSION = 1;
10
+ export const ACCOUNT_SCHEMA_VERSION = 1;
11
+
12
+ export const LOG_LEVEL_CACHE_KEY = `${PREFIX}.${BROWSER_PREFIX}.log.level`;
13
+ export const LOG_PII_CACHE_KEY = `${PREFIX}.${BROWSER_PREFIX}.log.pii`;
14
+ export const BROWSER_PERF_ENABLED_KEY = `${PREFIX}.${BROWSER_PREFIX}.performance.enabled`;
15
+ export const PLATFORM_AUTH_DOM_SUPPORT = `${PREFIX}.${BROWSER_PREFIX}.platform.auth.dom`;
16
+ export const VERSION_CACHE_KEY = `${PREFIX}.version`;
17
+ export const ACCOUNT_KEYS = "account.keys";
18
+ export const TOKEN_KEYS = "token.keys";
19
+
20
+ export function getAccountKeysCacheKey(
21
+ schema: number = ACCOUNT_SCHEMA_VERSION
22
+ ): string {
23
+ if (schema < 1) {
24
+ return `${PREFIX}.${ACCOUNT_KEYS}`;
25
+ }
26
+
27
+ return `${PREFIX}.${schema}.${ACCOUNT_KEYS}`;
28
+ }
29
+
30
+ export function getTokenKeysCacheKey(
31
+ clientId: string,
32
+ schema: number = CREDENTIAL_SCHEMA_VERSION
33
+ ): string {
34
+ if (schema < 1) {
35
+ return `${PREFIX}.${TOKEN_KEYS}.${clientId}`;
36
+ }
37
+
38
+ return `${PREFIX}.${schema}.${TOKEN_KEYS}.${clientId}`;
39
+ }
@@ -92,6 +92,11 @@ export class CookieStorage implements IWindowStorage<string> {
92
92
  containsKey(key: string): boolean {
93
93
  return this.getKeys().includes(key);
94
94
  }
95
+
96
+ decryptData(): Promise<object | null> {
97
+ // Cookie storage does not support encryption, so this method is a no-op
98
+ return Promise.resolve(null);
99
+ }
95
100
  }
96
101
 
97
102
  /**
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ export type EncryptedData = {
7
+ id: string;
8
+ nonce: string;
9
+ data: string;
10
+ lastUpdatedAt: string;
11
+ };
12
+
13
+ export function isEncrypted(data: object): data is EncryptedData {
14
+ return (
15
+ data.hasOwnProperty("id") &&
16
+ data.hasOwnProperty("nonce") &&
17
+ data.hasOwnProperty("data")
18
+ );
19
+ }
@@ -3,6 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
+ import { EncryptedData } from "./EncryptedData.js";
7
+
6
8
  export interface IWindowStorage<T> {
7
9
  /**
8
10
  * Async initializer
@@ -52,4 +54,10 @@ export interface IWindowStorage<T> {
52
54
  * @param key
53
55
  */
54
56
  containsKey(key: string): boolean;
57
+
58
+ decryptData(
59
+ key: string,
60
+ data: EncryptedData,
61
+ correlationId: string
62
+ ): Promise<object | null>;
55
63
  }
@@ -4,7 +4,6 @@
4
4
  */
5
5
 
6
6
  import {
7
- Constants,
8
7
  TokenKeys,
9
8
  IPerformanceClient,
10
9
  invokeAsync,
@@ -33,7 +32,8 @@ import { CookieStorage, SameSiteOptions } from "./CookieStorage.js";
33
32
  import { IWindowStorage } from "./IWindowStorage.js";
34
33
  import { MemoryStorage } from "./MemoryStorage.js";
35
34
  import { getAccountKeys, getTokenKeys } from "./CacheHelpers.js";
36
- import { StaticCacheKeys } from "../utils/BrowserConstants.js";
35
+ import * as CacheKeys from "./CacheKeys.js";
36
+ import { EncryptedData, isEncrypted } from "./EncryptedData.js";
37
37
 
38
38
  const ENCRYPTION_KEY = "msal.cache.encryption";
39
39
  const BROADCAST_CHANNEL_NAME = "msal.broadcast.cache";
@@ -43,13 +43,6 @@ type EncryptionCookie = {
43
43
  key: CryptoKey;
44
44
  };
45
45
 
46
- type EncryptedData = {
47
- id: string;
48
- nonce: string;
49
- data: string;
50
- lastUpdatedAt: string;
51
- };
52
-
53
46
  export class LocalStorage implements IWindowStorage<string> {
54
47
  private clientId: string;
55
48
  private initialized: boolean;
@@ -105,16 +98,8 @@ export class LocalStorage implements IWindowStorage<string> {
105
98
  correlationId
106
99
  )(baseKey),
107
100
  };
108
- await invokeAsync(
109
- this.importExistingCache.bind(this),
110
- PerformanceEvents.ImportExistingCache,
111
- this.logger,
112
- this.performanceClient,
113
- correlationId
114
- )(correlationId);
115
101
  } else {
116
- // Encryption key doesn't exist or is invalid, generate a new one and clear existing cache
117
- this.clear();
102
+ // Encryption key doesn't exist or is invalid, generate a new one
118
103
  const id = createNewGuid();
119
104
  const baseKey = await invokeAsync(
120
105
  generateBaseKey,
@@ -155,6 +140,14 @@ export class LocalStorage implements IWindowStorage<string> {
155
140
  );
156
141
  }
157
142
 
143
+ await invokeAsync(
144
+ this.importExistingCache.bind(this),
145
+ PerformanceEvents.ImportExistingCache,
146
+ this.logger,
147
+ this.performanceClient,
148
+ correlationId
149
+ )(correlationId);
150
+
158
151
  // Register listener for cache updates in other tabs
159
152
  this.broadcast.addEventListener("message", this.updateCache.bind(this));
160
153
 
@@ -174,6 +167,54 @@ export class LocalStorage implements IWindowStorage<string> {
174
167
  return this.memoryStorage.getItem(key);
175
168
  }
176
169
 
170
+ async decryptData(
171
+ key: string,
172
+ data: EncryptedData,
173
+ correlationId: string
174
+ ): Promise<object | null> {
175
+ if (!this.initialized || !this.encryptionCookie) {
176
+ throw createBrowserAuthError(
177
+ BrowserAuthErrorCodes.uninitializedPublicClientApplication
178
+ );
179
+ }
180
+
181
+ if (data.id !== this.encryptionCookie.id) {
182
+ // Data was encrypted with a different key. It must be removed because it is from a previous session.
183
+ this.performanceClient.incrementFields(
184
+ { encryptedCacheExpiredCount: 1 },
185
+ correlationId
186
+ );
187
+ return null;
188
+ }
189
+
190
+ const decryptedData = await invokeAsync(
191
+ decrypt,
192
+ PerformanceEvents.Decrypt,
193
+ this.logger,
194
+ this.performanceClient,
195
+ correlationId
196
+ )(
197
+ this.encryptionCookie.key,
198
+ data.nonce,
199
+ this.getContext(key),
200
+ data.data
201
+ );
202
+
203
+ if (!decryptedData) {
204
+ return null;
205
+ }
206
+
207
+ try {
208
+ return JSON.parse(decryptedData);
209
+ } catch (e) {
210
+ this.performanceClient.incrementFields(
211
+ { encryptedCacheCorruptionCount: 1 },
212
+ correlationId
213
+ );
214
+ return null;
215
+ }
216
+ }
217
+
177
218
  setItem(key: string, value: string): void {
178
219
  window.localStorage.setItem(key, value);
179
220
  }
@@ -252,7 +293,7 @@ export class LocalStorage implements IWindowStorage<string> {
252
293
  // Clean up anything left
253
294
  this.getKeys().forEach((cacheKey: string) => {
254
295
  if (
255
- cacheKey.startsWith(Constants.CACHE_PREFIX) ||
296
+ cacheKey.startsWith(CacheKeys.PREFIX) ||
256
297
  cacheKey.indexOf(this.clientId) !== -1
257
298
  ) {
258
299
  this.removeItem(cacheKey);
@@ -272,7 +313,14 @@ export class LocalStorage implements IWindowStorage<string> {
272
313
  let accountKeys = getAccountKeys(this);
273
314
  accountKeys = await this.importArray(accountKeys, correlationId);
274
315
  // Write valid account keys back to map
275
- this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
316
+ if (accountKeys.length) {
317
+ this.setItem(
318
+ CacheKeys.getAccountKeysCacheKey(),
319
+ JSON.stringify(accountKeys)
320
+ );
321
+ } else {
322
+ this.removeItem(CacheKeys.getAccountKeysCacheKey());
323
+ }
276
324
 
277
325
  const tokenKeys: TokenKeys = getTokenKeys(this.clientId, this);
278
326
  tokenKeys.idToken = await this.importArray(
@@ -288,10 +336,18 @@ export class LocalStorage implements IWindowStorage<string> {
288
336
  correlationId
289
337
  );
290
338
  // Write valid token keys back to map
291
- this.setItem(
292
- `${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`,
293
- JSON.stringify(tokenKeys)
294
- );
339
+ if (
340
+ tokenKeys.idToken.length ||
341
+ tokenKeys.accessToken.length ||
342
+ tokenKeys.refreshToken.length
343
+ ) {
344
+ this.setItem(
345
+ CacheKeys.getTokenKeysCacheKey(this.clientId),
346
+ JSON.stringify(tokenKeys)
347
+ );
348
+ } else {
349
+ this.removeItem(CacheKeys.getTokenKeysCacheKey(this.clientId));
350
+ }
295
351
  }
296
352
 
297
353
  /**
@@ -320,13 +376,13 @@ export class LocalStorage implements IWindowStorage<string> {
320
376
  return null;
321
377
  }
322
378
 
323
- if (!encObj.id || !encObj.nonce || !encObj.data) {
324
- // Data is not encrypted, likely from old version of MSAL. It must be removed because we don't know how old it is.
379
+ if (!isEncrypted(encObj)) {
380
+ // Data is not encrypted
325
381
  this.performanceClient.incrementFields(
326
382
  { unencryptedCacheCount: 1 },
327
383
  correlationId
328
384
  );
329
- return null;
385
+ return encObj;
330
386
  }
331
387
 
332
388
  if (encObj.id !== this.encryptionCookie.id) {
@@ -51,4 +51,9 @@ export class MemoryStorage<T> implements IWindowStorage<T> {
51
51
  clear(): void {
52
52
  this.cache.clear();
53
53
  }
54
+
55
+ decryptData(): Promise<object | null> {
56
+ // Memory storage does not support encryption, so this method is a no-op
57
+ return Promise.resolve(null);
58
+ }
54
59
  }
@@ -49,4 +49,9 @@ export class SessionStorage implements IWindowStorage<string> {
49
49
  containsKey(key: string): boolean {
50
50
  return window.sessionStorage.hasOwnProperty(key);
51
51
  }
52
+
53
+ decryptData(): Promise<object | null> {
54
+ // Session storage does not support encryption, so this method is a no-op
55
+ return Promise.resolve(null);
56
+ }
52
57
  }
@@ -132,6 +132,10 @@ export type CacheOptions = {
132
132
  * Used to specify the cacheLocation user wants to set. Valid values are "localStorage", "sessionStorage" and "memoryStorage".
133
133
  */
134
134
  cacheLocation?: BrowserCacheLocation | string;
135
+ /**
136
+ * Used to specify the number of days cache entries written by previous versions of MSAL.js should be retained in the browser. Defaults to 5 days.
137
+ */
138
+ cacheRetentionDays?: number;
135
139
  /**
136
140
  * Used to specify the temporaryCacheLocation user wants to set. Valid values are "localStorage", "sessionStorage" and "memoryStorage".
137
141
  * @deprecated This option is deprecated and will be removed in the next major version.
@@ -311,6 +315,7 @@ export function buildConfiguration(
311
315
  // Default cache options for browser
312
316
  const DEFAULT_CACHE_OPTIONS: Required<CacheOptions> = {
313
317
  cacheLocation: BrowserCacheLocation.SessionStorage,
318
+ cacheRetentionDays: 5,
314
319
  temporaryCacheLocation: BrowserCacheLocation.SessionStorage,
315
320
  storeAuthStateInCookie: false,
316
321
  secureCookies: false,
@@ -262,6 +262,7 @@ export class StandardController implements IController {
262
262
  // initialize in memory storage for native flows
263
263
  const nativeCacheOptions: Required<CacheOptions> = {
264
264
  cacheLocation: BrowserCacheLocation.MemoryStorage,
265
+ cacheRetentionDays: 5,
265
266
  temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
266
267
  storeAuthStateInCookie: false,
267
268
  secureCookies: false,
@@ -657,11 +658,12 @@ export class StandardController implements IController {
657
658
  typeof onRedirectNavigateCb === "function"
658
659
  ? onRedirectNavigateCb(url)
659
660
  : undefined;
660
- if (navigate !== false) {
661
- atrMeasurement.end({ success: true });
662
- } else {
663
- atrMeasurement.discard();
664
- }
661
+ atrMeasurement.add({
662
+ navigateCallbackResult: navigate !== false,
663
+ });
664
+ atrMeasurement.event =
665
+ atrMeasurement.end({ success: true }) ||
666
+ atrMeasurement.event;
665
667
  return navigate;
666
668
  };
667
669
  } else {
@@ -672,11 +674,12 @@ export class StandardController implements IController {
672
674
  typeof configOnRedirectNavigateCb === "function"
673
675
  ? configOnRedirectNavigateCb(url)
674
676
  : undefined;
675
- if (navigate !== false) {
676
- atrMeasurement.end({ success: true });
677
- } else {
678
- atrMeasurement.discard();
679
- }
677
+ atrMeasurement.add({
678
+ navigateCallbackResult: navigate !== false,
679
+ });
680
+ atrMeasurement.event =
681
+ atrMeasurement.end({ success: true }) ||
682
+ atrMeasurement.event;
680
683
  return navigate;
681
684
  };
682
685
  }
@@ -753,7 +756,21 @@ export class StandardController implements IController {
753
756
  return await result;
754
757
  } catch (e) {
755
758
  this.browserStorage.resetRequestCache();
756
- atrMeasurement.end({ success: false }, e);
759
+ /*
760
+ * Pre-redirect event completes before navigation occurs.
761
+ * Timed out navigation needs to be instrumented separately as a post-redirect event.
762
+ */
763
+ if (atrMeasurement.event.status === 2) {
764
+ this.performanceClient
765
+ .startMeasurement(
766
+ PerformanceEvents.AcquireTokenRedirect,
767
+ correlationId
768
+ )
769
+ .end({ success: false }, e);
770
+ } else {
771
+ atrMeasurement.end({ success: false }, e);
772
+ }
773
+
757
774
  if (isLoggedIn) {
758
775
  this.eventHandler.emitEvent(
759
776
  EventType.ACQUIRE_TOKEN_FAILURE,
@@ -8,7 +8,6 @@ import {
8
8
  INetworkModule,
9
9
  Logger,
10
10
  AccountInfo,
11
- AccountEntity,
12
11
  UrlString,
13
12
  ServerTelemetryManager,
14
13
  ServerTelemetryRequest,
@@ -91,22 +90,9 @@ export abstract class BaseInteractionClient {
91
90
  account?: AccountInfo | null
92
91
  ): Promise<void> {
93
92
  if (account) {
94
- if (
95
- AccountEntity.accountInfoIsEqual(
96
- account,
97
- this.browserStorage.getActiveAccount(correlationId),
98
- false
99
- )
100
- ) {
101
- this.logger.verbose("Setting active account to null");
102
- this.browserStorage.setActiveAccount(null, correlationId);
103
- }
104
93
  // Clear given account.
105
94
  try {
106
- this.browserStorage.removeAccount(
107
- AccountEntity.generateAccountCacheKey(account),
108
- correlationId
109
- );
95
+ this.browserStorage.removeAccount(account, correlationId);
110
96
  this.logger.verbose(
111
97
  "Cleared cache items belonging to the account provided in the logout request."
112
98
  );
@@ -722,9 +722,11 @@ export class PlatformAuthInteractionClient extends BaseInteractionClient {
722
722
  ): Promise<void> {
723
723
  // Store the account info and hence `nativeAccountId` in browser cache
724
724
  await this.browserStorage.setAccount(accountEntity, this.correlationId);
725
-
726
725
  // Remove any existing cached tokens for this account in browser storage
727
- this.browserStorage.removeAccountContext(accountEntity, correlationId);
726
+ this.browserStorage.removeAccountContext(
727
+ accountEntity.getAccountInfo(),
728
+ correlationId
729
+ );
728
730
  }
729
731
 
730
732
  /**
@@ -604,11 +604,6 @@ export class PopupClient extends StandardInteractionClient {
604
604
  validRequest.postLogoutRedirectUri &&
605
605
  authClient.authority.protocolMode === ProtocolMode.OIDC
606
606
  ) {
607
- this.browserStorage.removeAccount(
608
- validRequest.account?.homeAccountId,
609
- this.correlationId
610
- );
611
-
612
607
  this.eventHandler.emitEvent(
613
608
  EventType.LOGOUT_SUCCESS,
614
609
  InteractionType.Popup,
@@ -768,11 +768,6 @@ export class RedirectClient extends StandardInteractionClient {
768
768
  authClient.authority.endSessionEndpoint;
769
769
  } catch {
770
770
  if (validLogoutRequest.account?.homeAccountId) {
771
- this.browserStorage.removeAccount(
772
- validLogoutRequest.account?.homeAccountId,
773
- this.correlationId
774
- );
775
-
776
771
  this.eventHandler.emitEvent(
777
772
  EventType.LOGOUT_SUCCESS,
778
773
  InteractionType.Redirect,
@@ -13,4 +13,5 @@ export type AccountInfo = {
13
13
  idToken?: string; // idTokenClaims can be parsed from idToken in MSAL.js
14
14
  platformBrokerId?: string; // Used by WAM previous called nativeAccountId
15
15
  idTokenClaims?: object;
16
+ loginHint?: string;
16
17
  };
@@ -190,6 +190,9 @@ export class NestedAppAuthAdapter {
190
190
 
191
191
  const name = fromAccount.name || effectiveIdTokenClaims?.name;
192
192
 
193
+ const loginHint =
194
+ fromAccount.loginHint || effectiveIdTokenClaims?.login_hint;
195
+
193
196
  const tenantProfiles = new Map<string, TenantProfile>();
194
197
 
195
198
  const tenantProfile = buildTenantProfile(
@@ -207,6 +210,7 @@ export class NestedAppAuthAdapter {
207
210
  username,
208
211
  localAccountId,
209
212
  name,
213
+ loginHint,
210
214
  idToken: idToken,
211
215
  idTokenClaims: effectiveIdTokenClaims,
212
216
  tenantProfiles,
@@ -10,11 +10,8 @@ import {
10
10
  Configuration,
11
11
  } from "../config/Configuration.js";
12
12
  import { version, name } from "../packageMetadata.js";
13
- import {
14
- BrowserCacheLocation,
15
- LOG_LEVEL_CACHE_KEY,
16
- LOG_PII_CACHE_KEY,
17
- } from "../utils/BrowserConstants.js";
13
+ import { BrowserCacheLocation } from "../utils/BrowserConstants.js";
14
+ import { LOG_LEVEL_CACHE_KEY, LOG_PII_CACHE_KEY } from "../cache/CacheKeys.js";
18
15
 
19
16
  /**
20
17
  * Base class for operating context
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-browser";
3
- export const version = "4.18.0";
3
+ export const version = "4.20.0";
@@ -16,11 +16,9 @@ import {
16
16
  } from "@azure/msal-common/browser";
17
17
  import { Configuration } from "../config/Configuration.js";
18
18
  import { name, version } from "../packageMetadata.js";
19
- import {
20
- BROWSER_PERF_ENABLED_KEY,
21
- BrowserCacheLocation,
22
- } from "../utils/BrowserConstants.js";
19
+ import { BrowserCacheLocation } from "../utils/BrowserConstants.js";
23
20
  import * as BrowserCrypto from "../crypto/BrowserCrypto.js";
21
+ import { BROWSER_PERF_ENABLED_KEY } from "../cache/CacheKeys.js";
24
22
 
25
23
  /**
26
24
  * Returns browser performance measurement module if session flag is enabled. Returns undefined otherwise.
@@ -100,14 +100,6 @@ export const TemporaryCacheKeys = {
100
100
  export type TemporaryCacheKeys =
101
101
  (typeof TemporaryCacheKeys)[keyof typeof TemporaryCacheKeys];
102
102
 
103
- export const StaticCacheKeys = {
104
- ACCOUNT_KEYS: "msal.account.keys",
105
- TOKEN_KEYS: "msal.token.keys",
106
- VERSION: "msal.version",
107
- } as const;
108
- export type StaticCacheKeys =
109
- (typeof StaticCacheKeys)[keyof typeof StaticCacheKeys];
110
-
111
103
  /**
112
104
  * Cache keys stored in-memory
113
105
  */
@@ -249,10 +241,3 @@ export const iFrameRenewalPolicies: CacheLookupPolicy[] = [
249
241
  CacheLookupPolicy.Skip,
250
242
  CacheLookupPolicy.RefreshTokenAndNetwork,
251
243
  ];
252
-
253
- export const LOG_LEVEL_CACHE_KEY = "msal.browser.log.level";
254
- export const LOG_PII_CACHE_KEY = "msal.browser.log.pii";
255
-
256
- export const BROWSER_PERF_ENABLED_KEY = "msal.browser.performance.enabled";
257
-
258
- export const PLATFORM_AUTH_DOM_SUPPORT = "msal.browser.platform.auth.dom";
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Utility function to remove an element from an array in place.
8
+ * @param array - The array from which to remove the element.
9
+ * @param element - The element to remove from the array.
10
+ */
11
+ export function removeElementFromArray(
12
+ array: Array<string>,
13
+ element: string
14
+ ): void {
15
+ const index = array.indexOf(element);
16
+ if (index > -1) {
17
+ array.splice(index, 1);
18
+ }
19
+ }