@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.
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +3 -2
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs.map +1 -1
- package/dist/cache/AccountManager.d.ts.map +1 -1
- package/dist/cache/AccountManager.mjs +1 -6
- package/dist/cache/AccountManager.mjs.map +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +26 -11
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +239 -56
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/CacheHelpers.d.ts +2 -2
- package/dist/cache/CacheHelpers.d.ts.map +1 -1
- package/dist/cache/CacheHelpers.mjs +6 -6
- package/dist/cache/CacheHelpers.mjs.map +1 -1
- package/dist/cache/CacheKeys.d.ts +14 -0
- package/dist/cache/CacheKeys.d.ts.map +1 -0
- package/dist/cache/CacheKeys.mjs +33 -0
- package/dist/cache/CacheKeys.mjs.map +1 -0
- package/dist/cache/CookieStorage.d.ts +1 -0
- package/dist/cache/CookieStorage.d.ts.map +1 -1
- package/dist/cache/CookieStorage.mjs +5 -1
- package/dist/cache/CookieStorage.mjs.map +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/EncryptedData.d.ts +8 -0
- package/dist/cache/EncryptedData.d.ts.map +1 -0
- package/dist/cache/EncryptedData.mjs +14 -0
- package/dist/cache/EncryptedData.mjs.map +1 -0
- package/dist/cache/IWindowStorage.d.ts +2 -0
- package/dist/cache/IWindowStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.d.ts +2 -0
- package/dist/cache/LocalStorage.d.ts.map +1 -1
- package/dist/cache/LocalStorage.mjs +46 -13
- package/dist/cache/LocalStorage.mjs.map +1 -1
- package/dist/cache/MemoryStorage.d.ts +1 -0
- package/dist/cache/MemoryStorage.d.ts.map +1 -1
- package/dist/cache/MemoryStorage.mjs +5 -1
- package/dist/cache/MemoryStorage.mjs.map +1 -1
- package/dist/cache/SessionStorage.d.ts +1 -0
- package/dist/cache/SessionStorage.d.ts.map +1 -1
- package/dist/cache/SessionStorage.mjs +5 -1
- package/dist/cache/SessionStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.d.ts +4 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +2 -1
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +26 -14
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/custom-auth-path/app/PublicClientApplication.mjs +1 -1
- package/dist/custom-auth-path/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
- package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
- package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
- package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthProvider.mjs +3 -2
- package/dist/custom-auth-path/broker/nativeBroker/PlatformAuthProvider.mjs.map +1 -1
- package/dist/custom-auth-path/cache/AccountManager.d.ts.map +1 -1
- package/dist/custom-auth-path/cache/AccountManager.mjs +1 -6
- package/dist/custom-auth-path/cache/AccountManager.mjs.map +1 -1
- package/dist/custom-auth-path/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/custom-auth-path/cache/BrowserCacheManager.d.ts +26 -11
- package/dist/custom-auth-path/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/custom-auth-path/cache/BrowserCacheManager.mjs +239 -56
- package/dist/custom-auth-path/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/custom-auth-path/cache/CacheHelpers.d.ts +2 -2
- package/dist/custom-auth-path/cache/CacheHelpers.d.ts.map +1 -1
- package/dist/custom-auth-path/cache/CacheHelpers.mjs +6 -6
- package/dist/custom-auth-path/cache/CacheHelpers.mjs.map +1 -1
- package/dist/custom-auth-path/cache/CacheKeys.d.ts +14 -0
- package/dist/custom-auth-path/cache/CacheKeys.d.ts.map +1 -0
- package/dist/custom-auth-path/cache/CacheKeys.mjs +32 -0
- package/dist/custom-auth-path/cache/CacheKeys.mjs.map +1 -0
- package/dist/custom-auth-path/cache/CookieStorage.d.ts +1 -0
- package/dist/custom-auth-path/cache/CookieStorage.d.ts.map +1 -1
- package/dist/custom-auth-path/cache/CookieStorage.mjs +5 -1
- package/dist/custom-auth-path/cache/CookieStorage.mjs.map +1 -1
- package/dist/custom-auth-path/cache/DatabaseStorage.mjs +1 -1
- package/dist/custom-auth-path/cache/EncryptedData.d.ts +8 -0
- package/dist/custom-auth-path/cache/EncryptedData.d.ts.map +1 -0
- package/dist/custom-auth-path/cache/EncryptedData.mjs +14 -0
- package/dist/custom-auth-path/cache/EncryptedData.mjs.map +1 -0
- package/dist/custom-auth-path/cache/IWindowStorage.d.ts +2 -0
- package/dist/custom-auth-path/cache/IWindowStorage.d.ts.map +1 -1
- package/dist/custom-auth-path/cache/LocalStorage.d.ts +2 -0
- package/dist/custom-auth-path/cache/LocalStorage.d.ts.map +1 -1
- package/dist/custom-auth-path/cache/LocalStorage.mjs +46 -13
- package/dist/custom-auth-path/cache/LocalStorage.mjs.map +1 -1
- package/dist/custom-auth-path/cache/MemoryStorage.d.ts +1 -0
- package/dist/custom-auth-path/cache/MemoryStorage.d.ts.map +1 -1
- package/dist/custom-auth-path/cache/MemoryStorage.mjs +5 -1
- package/dist/custom-auth-path/cache/MemoryStorage.mjs.map +1 -1
- package/dist/custom-auth-path/cache/SessionStorage.d.ts +1 -0
- package/dist/custom-auth-path/cache/SessionStorage.d.ts.map +1 -1
- package/dist/custom-auth-path/cache/SessionStorage.mjs +5 -1
- package/dist/custom-auth-path/cache/SessionStorage.mjs.map +1 -1
- package/dist/custom-auth-path/cache/TokenCache.mjs +1 -1
- package/dist/custom-auth-path/config/Configuration.d.ts +4 -0
- package/dist/custom-auth-path/config/Configuration.d.ts.map +1 -1
- package/dist/custom-auth-path/config/Configuration.mjs +2 -1
- package/dist/custom-auth-path/config/Configuration.mjs.map +1 -1
- package/dist/custom-auth-path/controllers/ControllerFactory.mjs +1 -1
- package/dist/custom-auth-path/controllers/StandardController.d.ts.map +1 -1
- package/dist/custom-auth-path/controllers/StandardController.mjs +26 -14
- package/dist/custom-auth-path/controllers/StandardController.mjs.map +1 -1
- package/dist/custom-auth-path/crypto/BrowserCrypto.mjs +1 -1
- package/dist/custom-auth-path/crypto/CryptoOps.mjs +1 -1
- package/dist/custom-auth-path/crypto/PkceGenerator.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/dist/custom-auth-path/custom_auth/CustomAuthConstants.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/controller/CustomAuthStandardController.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/CustomAuthAuthority.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/CustomAuthError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/HttpError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/ParsedUrlError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/UnexpectedError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/core/utils/UrlUtils.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/index.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInSubmitCredentialResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
- package/dist/custom-auth-path/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
- package/dist/custom-auth-path/encode/Base64Decode.mjs +1 -1
- package/dist/custom-auth-path/encode/Base64Encode.mjs +1 -1
- package/dist/custom-auth-path/error/BrowserAuthError.mjs +1 -1
- package/dist/custom-auth-path/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/custom-auth-path/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/custom-auth-path/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/custom-auth-path/error/NativeAuthError.mjs +1 -1
- package/dist/custom-auth-path/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/custom-auth-path/event/EventHandler.mjs +1 -1
- package/dist/custom-auth-path/event/EventType.mjs +1 -1
- package/dist/custom-auth-path/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/custom-auth-path/interaction_client/BaseInteractionClient.mjs +3 -7
- package/dist/custom-auth-path/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/custom-auth-path/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/custom-auth-path/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/dist/custom-auth-path/interaction_client/PlatformAuthInteractionClient.mjs +2 -2
- package/dist/custom-auth-path/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
- package/dist/custom-auth-path/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/custom-auth-path/interaction_client/PopupClient.mjs +1 -2
- package/dist/custom-auth-path/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/custom-auth-path/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/custom-auth-path/interaction_client/RedirectClient.mjs +1 -2
- package/dist/custom-auth-path/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/custom-auth-path/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/custom-auth-path/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/custom-auth-path/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/custom-auth-path/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/custom-auth-path/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/custom-auth-path/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/custom-auth-path/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/custom-auth-path/naa/AccountInfo.d.ts +1 -0
- package/dist/custom-auth-path/naa/AccountInfo.d.ts.map +1 -1
- package/dist/custom-auth-path/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/dist/custom-auth-path/navigation/NavigationClient.mjs +1 -1
- package/dist/custom-auth-path/network/FetchClient.mjs +1 -1
- package/dist/custom-auth-path/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
- package/dist/custom-auth-path/operatingcontext/BaseOperatingContext.mjs +3 -2
- package/dist/custom-auth-path/operatingcontext/BaseOperatingContext.mjs.map +1 -1
- package/dist/custom-auth-path/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/custom-auth-path/packageMetadata.d.ts +1 -1
- package/dist/custom-auth-path/packageMetadata.mjs +2 -2
- package/dist/custom-auth-path/protocol/Authorize.mjs +1 -1
- package/dist/custom-auth-path/request/RequestHelpers.mjs +1 -1
- package/dist/custom-auth-path/response/ResponseHandler.mjs +1 -1
- package/dist/custom-auth-path/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/custom-auth-path/utils/BrowserConstants.d.ts +0 -10
- package/dist/custom-auth-path/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/custom-auth-path/utils/BrowserConstants.mjs +3 -11
- package/dist/custom-auth-path/utils/BrowserConstants.mjs.map +1 -1
- package/dist/custom-auth-path/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/custom-auth-path/utils/BrowserUtils.mjs +1 -1
- package/dist/custom-auth-path/utils/Helpers.d.ts +7 -0
- package/dist/custom-auth-path/utils/Helpers.d.ts.map +1 -0
- package/dist/custom-auth-path/utils/Helpers.mjs +20 -0
- package/dist/custom-auth-path/utils/Helpers.mjs.map +1 -0
- package/dist/custom-auth-path/utils/MsalFrameStatsUtils.mjs +1 -1
- package/dist/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +3 -7
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs +2 -2
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +1 -2
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +1 -2
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/naa/AccountInfo.d.ts +1 -0
- package/dist/naa/AccountInfo.d.ts.map +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +3 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +3 -2
- package/dist/operatingcontext/BaseOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/request/RequestHelpers.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +3 -2
- package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.d.ts +0 -10
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.mjs +3 -12
- package/dist/utils/BrowserConstants.mjs.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/dist/utils/Helpers.d.ts +7 -0
- package/dist/utils/Helpers.d.ts.map +1 -0
- package/dist/utils/Helpers.mjs +20 -0
- package/dist/utils/Helpers.mjs.map +1 -0
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/lib/custom-auth-path/msal-custom-auth.cjs +2686 -2554
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
- package/lib/custom-auth-path/types/cache/AccountManager.d.ts.map +1 -1
- package/lib/custom-auth-path/types/cache/BrowserCacheManager.d.ts +26 -11
- package/lib/custom-auth-path/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/custom-auth-path/types/cache/CacheHelpers.d.ts +2 -2
- package/lib/custom-auth-path/types/cache/CacheHelpers.d.ts.map +1 -1
- package/lib/custom-auth-path/types/cache/CacheKeys.d.ts +14 -0
- package/lib/custom-auth-path/types/cache/CacheKeys.d.ts.map +1 -0
- package/lib/custom-auth-path/types/cache/CookieStorage.d.ts +1 -0
- package/lib/custom-auth-path/types/cache/CookieStorage.d.ts.map +1 -1
- package/lib/custom-auth-path/types/cache/EncryptedData.d.ts +8 -0
- package/lib/custom-auth-path/types/cache/EncryptedData.d.ts.map +1 -0
- package/lib/custom-auth-path/types/cache/IWindowStorage.d.ts +2 -0
- package/lib/custom-auth-path/types/cache/IWindowStorage.d.ts.map +1 -1
- package/lib/custom-auth-path/types/cache/LocalStorage.d.ts +2 -0
- package/lib/custom-auth-path/types/cache/LocalStorage.d.ts.map +1 -1
- package/lib/custom-auth-path/types/cache/MemoryStorage.d.ts +1 -0
- package/lib/custom-auth-path/types/cache/MemoryStorage.d.ts.map +1 -1
- package/lib/custom-auth-path/types/cache/SessionStorage.d.ts +1 -0
- package/lib/custom-auth-path/types/cache/SessionStorage.d.ts.map +1 -1
- package/lib/custom-auth-path/types/config/Configuration.d.ts +4 -0
- package/lib/custom-auth-path/types/config/Configuration.d.ts.map +1 -1
- package/lib/custom-auth-path/types/controllers/StandardController.d.ts.map +1 -1
- package/lib/custom-auth-path/types/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/lib/custom-auth-path/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/lib/custom-auth-path/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/lib/custom-auth-path/types/interaction_client/PopupClient.d.ts.map +1 -1
- package/lib/custom-auth-path/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/lib/custom-auth-path/types/naa/AccountInfo.d.ts +1 -0
- package/lib/custom-auth-path/types/naa/AccountInfo.d.ts.map +1 -1
- package/lib/custom-auth-path/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/lib/custom-auth-path/types/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
- package/lib/custom-auth-path/types/packageMetadata.d.ts +1 -1
- package/lib/custom-auth-path/types/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/lib/custom-auth-path/types/utils/BrowserConstants.d.ts +0 -10
- package/lib/custom-auth-path/types/utils/BrowserConstants.d.ts.map +1 -1
- package/lib/custom-auth-path/types/utils/Helpers.d.ts +7 -0
- package/lib/custom-auth-path/types/utils/Helpers.d.ts.map +1 -0
- package/lib/msal-browser.cjs +2754 -2610
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +2754 -2610
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +67 -69
- package/lib/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
- package/lib/types/cache/AccountManager.d.ts.map +1 -1
- package/lib/types/cache/BrowserCacheManager.d.ts +26 -11
- package/lib/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/lib/types/cache/CacheHelpers.d.ts +2 -2
- package/lib/types/cache/CacheHelpers.d.ts.map +1 -1
- package/lib/types/cache/CacheKeys.d.ts +14 -0
- package/lib/types/cache/CacheKeys.d.ts.map +1 -0
- package/lib/types/cache/CookieStorage.d.ts +1 -0
- package/lib/types/cache/CookieStorage.d.ts.map +1 -1
- package/lib/types/cache/EncryptedData.d.ts +8 -0
- package/lib/types/cache/EncryptedData.d.ts.map +1 -0
- package/lib/types/cache/IWindowStorage.d.ts +2 -0
- package/lib/types/cache/IWindowStorage.d.ts.map +1 -1
- package/lib/types/cache/LocalStorage.d.ts +2 -0
- package/lib/types/cache/LocalStorage.d.ts.map +1 -1
- package/lib/types/cache/MemoryStorage.d.ts +1 -0
- package/lib/types/cache/MemoryStorage.d.ts.map +1 -1
- package/lib/types/cache/SessionStorage.d.ts +1 -0
- package/lib/types/cache/SessionStorage.d.ts.map +1 -1
- package/lib/types/config/Configuration.d.ts +4 -0
- package/lib/types/config/Configuration.d.ts.map +1 -1
- package/lib/types/controllers/StandardController.d.ts.map +1 -1
- package/lib/types/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/lib/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/lib/types/interaction_client/PopupClient.d.ts.map +1 -1
- package/lib/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/lib/types/naa/AccountInfo.d.ts +1 -0
- package/lib/types/naa/AccountInfo.d.ts.map +1 -1
- package/lib/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/lib/types/operatingcontext/BaseOperatingContext.d.ts.map +1 -1
- package/lib/types/packageMetadata.d.ts +1 -1
- package/lib/types/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/lib/types/utils/BrowserConstants.d.ts +0 -10
- package/lib/types/utils/BrowserConstants.d.ts.map +1 -1
- package/lib/types/utils/Helpers.d.ts +7 -0
- package/lib/types/utils/Helpers.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/broker/nativeBroker/PlatformAuthProvider.ts +2 -4
- package/src/cache/AccountManager.ts +0 -6
- package/src/cache/BrowserCacheManager.ts +381 -61
- package/src/cache/CacheHelpers.ts +13 -5
- package/src/cache/CacheKeys.ts +39 -0
- package/src/cache/CookieStorage.ts +5 -0
- package/src/cache/EncryptedData.ts +19 -0
- package/src/cache/IWindowStorage.ts +8 -0
- package/src/cache/LocalStorage.ts +83 -27
- package/src/cache/MemoryStorage.ts +5 -0
- package/src/cache/SessionStorage.ts +5 -0
- package/src/config/Configuration.ts +5 -0
- package/src/controllers/StandardController.ts +28 -11
- package/src/interaction_client/BaseInteractionClient.ts +1 -15
- package/src/interaction_client/PlatformAuthInteractionClient.ts +4 -2
- package/src/interaction_client/PopupClient.ts +0 -5
- package/src/interaction_client/RedirectClient.ts +0 -5
- package/src/naa/AccountInfo.ts +1 -0
- package/src/naa/mapping/NestedAppAuthAdapter.ts +4 -0
- package/src/operatingcontext/BaseOperatingContext.ts +2 -5
- package/src/packageMetadata.ts +1 -1
- package/src/telemetry/BrowserPerformanceClient.ts +2 -4
- package/src/utils/BrowserConstants.ts +0 -15
- package/src/utils/Helpers.ts +19 -0
|
@@ -35,6 +35,9 @@ import {
|
|
|
35
35
|
ThrottlingEntity,
|
|
36
36
|
TimeUtils,
|
|
37
37
|
TokenKeys,
|
|
38
|
+
CredentialEntity,
|
|
39
|
+
CredentialType,
|
|
40
|
+
DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
38
41
|
} from "@azure/msal-common/browser";
|
|
39
42
|
import { CacheOptions } from "../config/Configuration.js";
|
|
40
43
|
import {
|
|
@@ -45,9 +48,9 @@ import {
|
|
|
45
48
|
BrowserCacheLocation,
|
|
46
49
|
InMemoryCacheKeys,
|
|
47
50
|
INTERACTION_TYPE,
|
|
48
|
-
StaticCacheKeys,
|
|
49
51
|
TemporaryCacheKeys,
|
|
50
52
|
} from "../utils/BrowserConstants.js";
|
|
53
|
+
import * as CacheKeys from "./CacheKeys.js";
|
|
51
54
|
import { LocalStorage } from "./LocalStorage.js";
|
|
52
55
|
import { SessionStorage } from "./SessionStorage.js";
|
|
53
56
|
import { MemoryStorage } from "./MemoryStorage.js";
|
|
@@ -66,6 +69,8 @@ import { EventType } from "../event/EventType.js";
|
|
|
66
69
|
import { EventHandler } from "../event/EventHandler.js";
|
|
67
70
|
import { clearHash } from "../utils/BrowserUtils.js";
|
|
68
71
|
import { version } from "../packageMetadata.js";
|
|
72
|
+
import { removeElementFromArray } from "../utils/Helpers.js";
|
|
73
|
+
import { EncryptedData, isEncrypted } from "./EncryptedData.js";
|
|
69
74
|
|
|
70
75
|
/**
|
|
71
76
|
* This class implements the cache storage interface for MSAL through browser local or session storage.
|
|
@@ -124,16 +129,224 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
124
129
|
}
|
|
125
130
|
|
|
126
131
|
async initialize(correlationId: string): Promise<void> {
|
|
132
|
+
this.performanceClient.addFields(
|
|
133
|
+
{
|
|
134
|
+
cacheLocation: this.cacheConfig.cacheLocation,
|
|
135
|
+
cacheRetentionDays: this.cacheConfig.cacheRetentionDays,
|
|
136
|
+
},
|
|
137
|
+
correlationId
|
|
138
|
+
);
|
|
127
139
|
await this.browserStorage.initialize(correlationId);
|
|
140
|
+
await this.migrateExistingCache(correlationId);
|
|
128
141
|
this.trackVersionChanges(correlationId);
|
|
129
142
|
}
|
|
130
143
|
|
|
144
|
+
/**
|
|
145
|
+
* Migrates any existing cache data from previous versions of MSAL.js into the current cache structure.
|
|
146
|
+
*/
|
|
147
|
+
async migrateExistingCache(correlationId: string): Promise<void> {
|
|
148
|
+
const accountKeys0 = getAccountKeys(this.browserStorage, 0);
|
|
149
|
+
const tokenKeys0 = getTokenKeys(this.clientId, this.browserStorage, 0);
|
|
150
|
+
this.performanceClient.addFields(
|
|
151
|
+
{
|
|
152
|
+
oldAccountCount: accountKeys0.length,
|
|
153
|
+
oldAccessCount: tokenKeys0.accessToken.length,
|
|
154
|
+
oldIdCount: tokenKeys0.idToken.length,
|
|
155
|
+
oldRefreshCount: tokenKeys0.refreshToken.length,
|
|
156
|
+
},
|
|
157
|
+
correlationId
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const accountKeys1 = getAccountKeys(this.browserStorage, 1);
|
|
161
|
+
const tokenKeys1 = getTokenKeys(this.clientId, this.browserStorage, 1);
|
|
162
|
+
this.performanceClient.addFields(
|
|
163
|
+
{
|
|
164
|
+
currAccountCount: accountKeys1.length,
|
|
165
|
+
currAccessCount: tokenKeys1.accessToken.length,
|
|
166
|
+
currIdCount: tokenKeys1.idToken.length,
|
|
167
|
+
currRefreshCount: tokenKeys1.refreshToken.length,
|
|
168
|
+
},
|
|
169
|
+
correlationId
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
await Promise.all([
|
|
173
|
+
this.updateV0ToCurrent(
|
|
174
|
+
CacheKeys.ACCOUNT_SCHEMA_VERSION,
|
|
175
|
+
accountKeys0,
|
|
176
|
+
accountKeys1,
|
|
177
|
+
correlationId
|
|
178
|
+
),
|
|
179
|
+
this.updateV0ToCurrent(
|
|
180
|
+
CacheKeys.CREDENTIAL_SCHEMA_VERSION,
|
|
181
|
+
tokenKeys0.idToken,
|
|
182
|
+
tokenKeys1.idToken,
|
|
183
|
+
correlationId
|
|
184
|
+
),
|
|
185
|
+
this.updateV0ToCurrent(
|
|
186
|
+
CacheKeys.CREDENTIAL_SCHEMA_VERSION,
|
|
187
|
+
tokenKeys0.accessToken,
|
|
188
|
+
tokenKeys1.accessToken,
|
|
189
|
+
correlationId
|
|
190
|
+
),
|
|
191
|
+
this.updateV0ToCurrent(
|
|
192
|
+
CacheKeys.CREDENTIAL_SCHEMA_VERSION,
|
|
193
|
+
tokenKeys0.refreshToken,
|
|
194
|
+
tokenKeys1.refreshToken,
|
|
195
|
+
correlationId
|
|
196
|
+
),
|
|
197
|
+
]);
|
|
198
|
+
|
|
199
|
+
if (accountKeys0.length > 0) {
|
|
200
|
+
this.browserStorage.setItem(
|
|
201
|
+
CacheKeys.getAccountKeysCacheKey(0),
|
|
202
|
+
JSON.stringify(accountKeys0)
|
|
203
|
+
);
|
|
204
|
+
} else {
|
|
205
|
+
this.browserStorage.removeItem(CacheKeys.getAccountKeysCacheKey(0));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (accountKeys1.length > 0) {
|
|
209
|
+
this.browserStorage.setItem(
|
|
210
|
+
CacheKeys.getAccountKeysCacheKey(1),
|
|
211
|
+
JSON.stringify(accountKeys1)
|
|
212
|
+
);
|
|
213
|
+
} else {
|
|
214
|
+
this.browserStorage.removeItem(CacheKeys.getAccountKeysCacheKey(1));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
this.setTokenKeys(tokenKeys0, correlationId, 0);
|
|
218
|
+
this.setTokenKeys(tokenKeys1, correlationId, 1);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
async updateV0ToCurrent(
|
|
222
|
+
currentSchema: number,
|
|
223
|
+
v0Keys: Array<string>,
|
|
224
|
+
v1Keys: Array<string>,
|
|
225
|
+
correlationId: string
|
|
226
|
+
): Promise<void[]> {
|
|
227
|
+
const upgradePromises: Array<Promise<void>> = [];
|
|
228
|
+
|
|
229
|
+
for (const v0Key of [...v0Keys]) {
|
|
230
|
+
const rawV0Value = this.browserStorage.getItem(v0Key);
|
|
231
|
+
const parsedV0Value = this.validateAndParseJson(
|
|
232
|
+
rawV0Value || ""
|
|
233
|
+
) as CredentialEntity | AccountEntity | EncryptedData | null;
|
|
234
|
+
|
|
235
|
+
if (!parsedV0Value) {
|
|
236
|
+
removeElementFromArray(v0Keys, v0Key);
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
if (!parsedV0Value.lastUpdatedAt) {
|
|
241
|
+
// Add lastUpdatedAt to the existing v0 entry if it doesnt exist so we know when it's safe to remove it
|
|
242
|
+
parsedV0Value.lastUpdatedAt = Date.now().toString();
|
|
243
|
+
this.setItem(
|
|
244
|
+
v0Key,
|
|
245
|
+
JSON.stringify(parsedV0Value),
|
|
246
|
+
correlationId
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const decryptedData = isEncrypted(parsedV0Value)
|
|
251
|
+
? await this.browserStorage.decryptData(
|
|
252
|
+
v0Key,
|
|
253
|
+
parsedV0Value,
|
|
254
|
+
correlationId
|
|
255
|
+
)
|
|
256
|
+
: parsedV0Value;
|
|
257
|
+
let expirationTime;
|
|
258
|
+
if (decryptedData) {
|
|
259
|
+
if (CacheHelpers.isAccessTokenEntity(decryptedData)) {
|
|
260
|
+
expirationTime = decryptedData.expiresOn;
|
|
261
|
+
} else if (CacheHelpers.isRefreshTokenEntity(decryptedData)) {
|
|
262
|
+
expirationTime = decryptedData.expiresOn;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (
|
|
266
|
+
!decryptedData ||
|
|
267
|
+
TimeUtils.isCacheExpired(
|
|
268
|
+
parsedV0Value.lastUpdatedAt,
|
|
269
|
+
this.cacheConfig.cacheRetentionDays
|
|
270
|
+
) ||
|
|
271
|
+
(expirationTime &&
|
|
272
|
+
TimeUtils.isTokenExpired(
|
|
273
|
+
expirationTime,
|
|
274
|
+
DEFAULT_TOKEN_RENEWAL_OFFSET_SEC
|
|
275
|
+
))
|
|
276
|
+
) {
|
|
277
|
+
this.browserStorage.removeItem(v0Key);
|
|
278
|
+
removeElementFromArray(v0Keys, v0Key);
|
|
279
|
+
this.performanceClient.incrementFields(
|
|
280
|
+
{ expiredCacheRemovedCount: 1 },
|
|
281
|
+
correlationId
|
|
282
|
+
);
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (
|
|
287
|
+
this.cacheConfig.cacheLocation !==
|
|
288
|
+
BrowserCacheLocation.LocalStorage ||
|
|
289
|
+
isEncrypted(parsedV0Value)
|
|
290
|
+
) {
|
|
291
|
+
const v1Key = `${CacheKeys.PREFIX}.${currentSchema}${CacheKeys.CACHE_KEY_SEPARATOR}${v0Key}`;
|
|
292
|
+
const rawV1Entry = this.browserStorage.getItem(v1Key);
|
|
293
|
+
if (!rawV1Entry) {
|
|
294
|
+
upgradePromises.push(
|
|
295
|
+
this.setUserData(
|
|
296
|
+
v1Key,
|
|
297
|
+
JSON.stringify(decryptedData),
|
|
298
|
+
correlationId,
|
|
299
|
+
parsedV0Value.lastUpdatedAt
|
|
300
|
+
).then(() => {
|
|
301
|
+
v1Keys.push(v1Key);
|
|
302
|
+
this.performanceClient.incrementFields(
|
|
303
|
+
{ upgradedCacheCount: 1 },
|
|
304
|
+
correlationId
|
|
305
|
+
);
|
|
306
|
+
})
|
|
307
|
+
);
|
|
308
|
+
continue;
|
|
309
|
+
} else {
|
|
310
|
+
const parsedV1Entry = this.validateAndParseJson(
|
|
311
|
+
rawV1Entry
|
|
312
|
+
) as CredentialEntity | AccountEntity | EncryptedData;
|
|
313
|
+
// If the entry already exists but is older than the v0 entry, replace it
|
|
314
|
+
if (
|
|
315
|
+
Number(parsedV0Value.lastUpdatedAt) >
|
|
316
|
+
Number(parsedV1Entry.lastUpdatedAt)
|
|
317
|
+
) {
|
|
318
|
+
upgradePromises.push(
|
|
319
|
+
this.setUserData(
|
|
320
|
+
v1Key,
|
|
321
|
+
JSON.stringify(decryptedData),
|
|
322
|
+
correlationId,
|
|
323
|
+
parsedV0Value.lastUpdatedAt
|
|
324
|
+
).then(() => {
|
|
325
|
+
this.performanceClient.incrementFields(
|
|
326
|
+
{ updatedCacheFromV0Count: 1 },
|
|
327
|
+
correlationId
|
|
328
|
+
);
|
|
329
|
+
})
|
|
330
|
+
);
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
/*
|
|
336
|
+
* Note: If we reach here for unencrypted localStorage data, we continue without migrating
|
|
337
|
+
* as we can't migrate unencrypted localStorage data right now since we can't guarantee KMSI=no
|
|
338
|
+
*/
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return Promise.all(upgradePromises);
|
|
342
|
+
}
|
|
343
|
+
|
|
131
344
|
/**
|
|
132
345
|
* Tracks upgrades and downgrades for telemetry and debugging purposes
|
|
133
346
|
*/
|
|
134
347
|
private trackVersionChanges(correlationId: string): void {
|
|
135
348
|
const previousVersion = this.browserStorage.getItem(
|
|
136
|
-
|
|
349
|
+
CacheKeys.VERSION_CACHE_KEY
|
|
137
350
|
);
|
|
138
351
|
if (previousVersion) {
|
|
139
352
|
this.logger.info(
|
|
@@ -146,7 +359,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
146
359
|
}
|
|
147
360
|
|
|
148
361
|
if (previousVersion !== version) {
|
|
149
|
-
this.setItem(
|
|
362
|
+
this.setItem(CacheKeys.VERSION_CACHE_KEY, version, correlationId);
|
|
150
363
|
}
|
|
151
364
|
}
|
|
152
365
|
|
|
@@ -155,6 +368,9 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
155
368
|
* @param input
|
|
156
369
|
*/
|
|
157
370
|
protected validateAndParseJson(jsonValue: string): object | null {
|
|
371
|
+
if (!jsonValue) {
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
158
374
|
try {
|
|
159
375
|
const parsedJson = JSON.parse(jsonValue);
|
|
160
376
|
/**
|
|
@@ -177,6 +393,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
177
393
|
* @param value
|
|
178
394
|
*/
|
|
179
395
|
setItem(key: string, value: string, correlationId: string): void {
|
|
396
|
+
let tokenKeysV0Count = 0;
|
|
180
397
|
let accessTokenKeys: Array<string> = [];
|
|
181
398
|
const maxRetries = 20;
|
|
182
399
|
for (let i = 0; i <= maxRetries; i++) {
|
|
@@ -184,10 +401,23 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
184
401
|
this.browserStorage.setItem(key, value);
|
|
185
402
|
if (i > 0) {
|
|
186
403
|
// Finally update the token keys array with the tokens removed
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
404
|
+
if (i <= tokenKeysV0Count) {
|
|
405
|
+
this.removeAccessTokenKeys(
|
|
406
|
+
accessTokenKeys.slice(0, i),
|
|
407
|
+
correlationId,
|
|
408
|
+
0
|
|
409
|
+
);
|
|
410
|
+
} else {
|
|
411
|
+
this.removeAccessTokenKeys(
|
|
412
|
+
accessTokenKeys.slice(0, tokenKeysV0Count),
|
|
413
|
+
correlationId,
|
|
414
|
+
0
|
|
415
|
+
);
|
|
416
|
+
this.removeAccessTokenKeys(
|
|
417
|
+
accessTokenKeys.slice(tokenKeysV0Count, i),
|
|
418
|
+
correlationId
|
|
419
|
+
);
|
|
420
|
+
}
|
|
191
421
|
}
|
|
192
422
|
break; // If setItem succeeds, exit the loop
|
|
193
423
|
} catch (e) {
|
|
@@ -198,17 +428,19 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
198
428
|
i < maxRetries
|
|
199
429
|
) {
|
|
200
430
|
if (!accessTokenKeys.length) {
|
|
201
|
-
|
|
431
|
+
// If we are currently trying to set the token keys, use the value we're trying to set
|
|
432
|
+
const tokenKeys0 =
|
|
433
|
+
key ===
|
|
434
|
+
CacheKeys.getTokenKeysCacheKey(this.clientId, 0)
|
|
435
|
+
? (JSON.parse(value) as TokenKeys).accessToken
|
|
436
|
+
: this.getTokenKeys(0).accessToken;
|
|
437
|
+
const tokenKeys1 =
|
|
202
438
|
key ===
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
} else {
|
|
209
|
-
// If token keys have not been initialized, get them
|
|
210
|
-
accessTokenKeys = this.getTokenKeys().accessToken;
|
|
211
|
-
}
|
|
439
|
+
CacheKeys.getTokenKeysCacheKey(this.clientId)
|
|
440
|
+
? (JSON.parse(value) as TokenKeys).accessToken
|
|
441
|
+
: this.getTokenKeys().accessToken;
|
|
442
|
+
accessTokenKeys = [...tokenKeys0, ...tokenKeys1];
|
|
443
|
+
tokenKeysV0Count = tokenKeys0.length;
|
|
212
444
|
}
|
|
213
445
|
if (accessTokenKeys.length <= i) {
|
|
214
446
|
// Nothing to remove, rethrow the error
|
|
@@ -240,6 +472,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
240
472
|
correlationId: string,
|
|
241
473
|
timestamp: string
|
|
242
474
|
): Promise<void> {
|
|
475
|
+
let tokenKeysV0Count = 0;
|
|
243
476
|
let accessTokenKeys: Array<string> = [];
|
|
244
477
|
const maxRetries = 20;
|
|
245
478
|
for (let i = 0; i <= maxRetries; i++) {
|
|
@@ -252,10 +485,23 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
252
485
|
)(key, value, correlationId, timestamp);
|
|
253
486
|
if (i > 0) {
|
|
254
487
|
// Finally update the token keys array with the tokens removed
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
488
|
+
if (i <= tokenKeysV0Count) {
|
|
489
|
+
this.removeAccessTokenKeys(
|
|
490
|
+
accessTokenKeys.slice(0, i),
|
|
491
|
+
correlationId,
|
|
492
|
+
0
|
|
493
|
+
);
|
|
494
|
+
} else {
|
|
495
|
+
this.removeAccessTokenKeys(
|
|
496
|
+
accessTokenKeys.slice(0, tokenKeysV0Count),
|
|
497
|
+
correlationId,
|
|
498
|
+
0
|
|
499
|
+
);
|
|
500
|
+
this.removeAccessTokenKeys(
|
|
501
|
+
accessTokenKeys.slice(tokenKeysV0Count, i),
|
|
502
|
+
correlationId
|
|
503
|
+
);
|
|
504
|
+
}
|
|
259
505
|
}
|
|
260
506
|
break; // If setItem succeeds, exit the loop
|
|
261
507
|
} catch (e) {
|
|
@@ -266,7 +512,10 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
266
512
|
i < maxRetries
|
|
267
513
|
) {
|
|
268
514
|
if (!accessTokenKeys.length) {
|
|
269
|
-
|
|
515
|
+
const tokenKeys0 = this.getTokenKeys(0).accessToken;
|
|
516
|
+
const tokenKeys1 = this.getTokenKeys().accessToken;
|
|
517
|
+
accessTokenKeys = [...tokenKeys0, ...tokenKeys1];
|
|
518
|
+
tokenKeysV0Count = tokenKeys0.length;
|
|
270
519
|
}
|
|
271
520
|
if (accessTokenKeys.length <= i) {
|
|
272
521
|
// Nothing left to remove, rethrow the error
|
|
@@ -323,7 +572,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
323
572
|
correlationId: string
|
|
324
573
|
): Promise<void> {
|
|
325
574
|
this.logger.trace("BrowserCacheManager.setAccount called");
|
|
326
|
-
const key =
|
|
575
|
+
const key = this.generateAccountKey(account.getAccountInfo());
|
|
327
576
|
const timestamp = Date.now().toString();
|
|
328
577
|
account.lastUpdatedAt = timestamp;
|
|
329
578
|
await this.setUserData(
|
|
@@ -372,7 +621,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
372
621
|
// Only add key if it does not already exist in the map
|
|
373
622
|
accountKeys.push(key);
|
|
374
623
|
this.setItem(
|
|
375
|
-
|
|
624
|
+
CacheKeys.getAccountKeysCacheKey(),
|
|
376
625
|
JSON.stringify(accountKeys),
|
|
377
626
|
correlationId
|
|
378
627
|
);
|
|
@@ -403,11 +652,11 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
403
652
|
accountKeys.splice(removalIndex, 1);
|
|
404
653
|
if (accountKeys.length === 0) {
|
|
405
654
|
// If no keys left, remove the map
|
|
406
|
-
this.removeItem(
|
|
655
|
+
this.removeItem(CacheKeys.getAccountKeysCacheKey());
|
|
407
656
|
return;
|
|
408
657
|
} else {
|
|
409
658
|
this.setItem(
|
|
410
|
-
|
|
659
|
+
CacheKeys.getAccountKeysCacheKey(),
|
|
411
660
|
JSON.stringify(accountKeys),
|
|
412
661
|
correlationId
|
|
413
662
|
);
|
|
@@ -426,17 +675,30 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
426
675
|
* Extends inherited removeAccount function to include removal of the account key from the map
|
|
427
676
|
* @param key
|
|
428
677
|
*/
|
|
429
|
-
removeAccount(
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
678
|
+
removeAccount(account: AccountInfo, correlationId: string): void {
|
|
679
|
+
const activeAccount = this.getActiveAccount(correlationId);
|
|
680
|
+
if (
|
|
681
|
+
activeAccount?.homeAccountId === account.homeAccountId &&
|
|
682
|
+
activeAccount?.environment === account.environment
|
|
683
|
+
) {
|
|
684
|
+
this.setActiveAccount(null, correlationId);
|
|
685
|
+
}
|
|
433
686
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
687
|
+
super.removeAccount(account, correlationId);
|
|
688
|
+
this.removeAccountKeyFromMap(
|
|
689
|
+
this.generateAccountKey(account),
|
|
690
|
+
correlationId
|
|
691
|
+
);
|
|
692
|
+
|
|
693
|
+
// Remove all other associated cache items
|
|
694
|
+
this.browserStorage.getKeys().forEach((key) => {
|
|
695
|
+
if (
|
|
696
|
+
key.includes(account.homeAccountId) &&
|
|
697
|
+
key.includes(account.environment)
|
|
698
|
+
) {
|
|
699
|
+
this.browserStorage.removeItem(key);
|
|
700
|
+
}
|
|
701
|
+
});
|
|
440
702
|
|
|
441
703
|
/**
|
|
442
704
|
* @deprecated - Remove this in next major version in favor of more consistent LOGOUT event
|
|
@@ -447,7 +709,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
447
709
|
this.eventHandler.emitEvent(
|
|
448
710
|
EventType.ACCOUNT_REMOVED,
|
|
449
711
|
undefined,
|
|
450
|
-
account
|
|
712
|
+
account
|
|
451
713
|
);
|
|
452
714
|
}
|
|
453
715
|
}
|
|
@@ -486,9 +748,13 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
486
748
|
* @param correlationId
|
|
487
749
|
* @param tokenKeys
|
|
488
750
|
*/
|
|
489
|
-
removeAccessTokenKeys(
|
|
751
|
+
removeAccessTokenKeys(
|
|
752
|
+
keys: Array<string>,
|
|
753
|
+
correlationId: string,
|
|
754
|
+
schemaVersion: number = CacheKeys.CREDENTIAL_SCHEMA_VERSION
|
|
755
|
+
): void {
|
|
490
756
|
this.logger.trace("removeAccessTokenKey called");
|
|
491
|
-
const tokenKeys = this.getTokenKeys();
|
|
757
|
+
const tokenKeys = this.getTokenKeys(schemaVersion);
|
|
492
758
|
let keysRemoved = 0;
|
|
493
759
|
keys.forEach((key) => {
|
|
494
760
|
const accessRemoval = tokenKeys.accessToken.indexOf(key);
|
|
@@ -502,7 +768,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
502
768
|
this.logger.info(
|
|
503
769
|
`removed ${keysRemoved} accessToken keys from tokenKeys map`
|
|
504
770
|
);
|
|
505
|
-
this.setTokenKeys(tokenKeys, correlationId);
|
|
771
|
+
this.setTokenKeys(tokenKeys, correlationId, schemaVersion);
|
|
506
772
|
return;
|
|
507
773
|
}
|
|
508
774
|
}
|
|
@@ -526,8 +792,10 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
526
792
|
* Gets the keys for the cached tokens associated with this clientId
|
|
527
793
|
* @returns
|
|
528
794
|
*/
|
|
529
|
-
getTokenKeys(
|
|
530
|
-
|
|
795
|
+
getTokenKeys(
|
|
796
|
+
schemaVersion: number = CacheKeys.CREDENTIAL_SCHEMA_VERSION
|
|
797
|
+
): TokenKeys {
|
|
798
|
+
return getTokenKeys(this.clientId, this.browserStorage, schemaVersion);
|
|
531
799
|
}
|
|
532
800
|
|
|
533
801
|
/**
|
|
@@ -536,18 +804,24 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
536
804
|
* @param correlationId
|
|
537
805
|
* @returns
|
|
538
806
|
*/
|
|
539
|
-
setTokenKeys(
|
|
807
|
+
setTokenKeys(
|
|
808
|
+
tokenKeys: TokenKeys,
|
|
809
|
+
correlationId: string,
|
|
810
|
+
schemaVersion: number = CacheKeys.CREDENTIAL_SCHEMA_VERSION
|
|
811
|
+
): void {
|
|
540
812
|
if (
|
|
541
813
|
tokenKeys.idToken.length === 0 &&
|
|
542
814
|
tokenKeys.accessToken.length === 0 &&
|
|
543
815
|
tokenKeys.refreshToken.length === 0
|
|
544
816
|
) {
|
|
545
817
|
// If no keys left, remove the map
|
|
546
|
-
this.removeItem(
|
|
818
|
+
this.removeItem(
|
|
819
|
+
CacheKeys.getTokenKeysCacheKey(this.clientId, schemaVersion)
|
|
820
|
+
);
|
|
547
821
|
return;
|
|
548
822
|
} else {
|
|
549
823
|
this.setItem(
|
|
550
|
-
|
|
824
|
+
CacheKeys.getTokenKeysCacheKey(this.clientId, schemaVersion),
|
|
551
825
|
JSON.stringify(tokenKeys),
|
|
552
826
|
correlationId
|
|
553
827
|
);
|
|
@@ -594,7 +868,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
594
868
|
correlationId: string
|
|
595
869
|
): Promise<void> {
|
|
596
870
|
this.logger.trace("BrowserCacheManager.setIdTokenCredential called");
|
|
597
|
-
const idTokenKey =
|
|
871
|
+
const idTokenKey = this.generateCredentialKey(idToken);
|
|
598
872
|
const timestamp = Date.now().toString();
|
|
599
873
|
idToken.lastUpdatedAt = timestamp;
|
|
600
874
|
|
|
@@ -659,7 +933,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
659
933
|
this.logger.trace(
|
|
660
934
|
"BrowserCacheManager.setAccessTokenCredential called"
|
|
661
935
|
);
|
|
662
|
-
const accessTokenKey =
|
|
936
|
+
const accessTokenKey = this.generateCredentialKey(accessToken);
|
|
663
937
|
const timestamp = Date.now().toString();
|
|
664
938
|
accessToken.lastUpdatedAt = timestamp;
|
|
665
939
|
|
|
@@ -726,8 +1000,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
726
1000
|
this.logger.trace(
|
|
727
1001
|
"BrowserCacheManager.setRefreshTokenCredential called"
|
|
728
1002
|
);
|
|
729
|
-
const refreshTokenKey =
|
|
730
|
-
CacheHelpers.generateCredentialKey(refreshToken);
|
|
1003
|
+
const refreshTokenKey = this.generateCredentialKey(refreshToken);
|
|
731
1004
|
const timestamp = Date.now().toString();
|
|
732
1005
|
refreshToken.lastUpdatedAt = timestamp;
|
|
733
1006
|
|
|
@@ -1141,7 +1414,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1141
1414
|
// Remove temp storage first to make sure any cookies are cleared
|
|
1142
1415
|
this.temporaryCacheStorage.getKeys().forEach((cacheKey: string) => {
|
|
1143
1416
|
if (
|
|
1144
|
-
cacheKey.indexOf(
|
|
1417
|
+
cacheKey.indexOf(CacheKeys.PREFIX) !== -1 ||
|
|
1145
1418
|
cacheKey.indexOf(this.clientId) !== -1
|
|
1146
1419
|
) {
|
|
1147
1420
|
this.removeTemporaryItem(cacheKey);
|
|
@@ -1151,7 +1424,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1151
1424
|
// Removes all remaining MSAL cache items
|
|
1152
1425
|
this.browserStorage.getKeys().forEach((cacheKey: string) => {
|
|
1153
1426
|
if (
|
|
1154
|
-
cacheKey.indexOf(
|
|
1427
|
+
cacheKey.indexOf(CacheKeys.PREFIX) !== -1 ||
|
|
1155
1428
|
cacheKey.indexOf(this.clientId) !== -1
|
|
1156
1429
|
) {
|
|
1157
1430
|
this.browserStorage.removeItem(cacheKey);
|
|
@@ -1199,20 +1472,66 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1199
1472
|
}
|
|
1200
1473
|
|
|
1201
1474
|
/**
|
|
1202
|
-
* Prepend msal.<client-id> to each key
|
|
1475
|
+
* Prepend msal.<client-id> to each key
|
|
1203
1476
|
* @param key
|
|
1204
1477
|
* @param addInstanceId
|
|
1205
1478
|
*/
|
|
1206
1479
|
generateCacheKey(key: string): string {
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
if (StringUtils.startsWith(key, Constants.CACHE_PREFIX)) {
|
|
1210
|
-
return key;
|
|
1211
|
-
}
|
|
1212
|
-
return `${Constants.CACHE_PREFIX}.${this.clientId}.${key}`;
|
|
1480
|
+
if (StringUtils.startsWith(key, CacheKeys.PREFIX)) {
|
|
1481
|
+
return key;
|
|
1213
1482
|
}
|
|
1483
|
+
return `${CacheKeys.PREFIX}.${this.clientId}.${key}`;
|
|
1484
|
+
}
|
|
1214
1485
|
|
|
1215
|
-
|
|
1486
|
+
/**
|
|
1487
|
+
* Cache Key: msal.<schema_version>-<home_account_id>-<environment>-<credential_type>-<client_id or familyId>-<realm>-<scopes>-<claims hash>-<scheme>
|
|
1488
|
+
* IdToken Example: uid.utid-login.microsoftonline.com-idtoken-app_client_id-contoso.com
|
|
1489
|
+
* AccessToken Example: uid.utid-login.microsoftonline.com-accesstoken-app_client_id-contoso.com-scope1 scope2--pop
|
|
1490
|
+
* RefreshToken Example: uid.utid-login.microsoftonline.com-refreshtoken-1-contoso.com
|
|
1491
|
+
* @param credentialEntity
|
|
1492
|
+
* @returns
|
|
1493
|
+
*/
|
|
1494
|
+
generateCredentialKey(credential: CredentialEntity): string {
|
|
1495
|
+
const familyId =
|
|
1496
|
+
(credential.credentialType === CredentialType.REFRESH_TOKEN &&
|
|
1497
|
+
credential.familyId) ||
|
|
1498
|
+
credential.clientId;
|
|
1499
|
+
const scheme =
|
|
1500
|
+
credential.tokenType &&
|
|
1501
|
+
credential.tokenType.toLowerCase() !==
|
|
1502
|
+
AuthenticationScheme.BEARER.toLowerCase()
|
|
1503
|
+
? credential.tokenType.toLowerCase()
|
|
1504
|
+
: "";
|
|
1505
|
+
const credentialKey = [
|
|
1506
|
+
`${CacheKeys.PREFIX}.${CacheKeys.CREDENTIAL_SCHEMA_VERSION}`,
|
|
1507
|
+
credential.homeAccountId,
|
|
1508
|
+
credential.environment,
|
|
1509
|
+
credential.credentialType,
|
|
1510
|
+
familyId,
|
|
1511
|
+
credential.realm || "",
|
|
1512
|
+
credential.target || "",
|
|
1513
|
+
credential.requestedClaimsHash || "",
|
|
1514
|
+
scheme,
|
|
1515
|
+
];
|
|
1516
|
+
|
|
1517
|
+
return credentialKey.join(CacheKeys.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
1518
|
+
}
|
|
1519
|
+
|
|
1520
|
+
/**
|
|
1521
|
+
* Cache Key: msal.<schema_version>.<home_account_id>.<environment>.<tenant_id>
|
|
1522
|
+
* @param account
|
|
1523
|
+
* @returns
|
|
1524
|
+
*/
|
|
1525
|
+
generateAccountKey(account: AccountInfo): string {
|
|
1526
|
+
const homeTenantId = account.homeAccountId.split(".")[1];
|
|
1527
|
+
const accountKey = [
|
|
1528
|
+
`${CacheKeys.PREFIX}.${CacheKeys.ACCOUNT_SCHEMA_VERSION}`,
|
|
1529
|
+
account.homeAccountId,
|
|
1530
|
+
account.environment,
|
|
1531
|
+
homeTenantId || account.tenantId || "",
|
|
1532
|
+
];
|
|
1533
|
+
|
|
1534
|
+
return accountKey.join(CacheKeys.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
1216
1535
|
}
|
|
1217
1536
|
|
|
1218
1537
|
/**
|
|
@@ -1346,7 +1665,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1346
1665
|
clientId: string;
|
|
1347
1666
|
type: INTERACTION_TYPE;
|
|
1348
1667
|
} | null {
|
|
1349
|
-
const key = `${
|
|
1668
|
+
const key = `${CacheKeys.PREFIX}.${TemporaryCacheKeys.INTERACTION_STATUS_KEY}`;
|
|
1350
1669
|
const value = this.getTemporaryCache(key, false);
|
|
1351
1670
|
try {
|
|
1352
1671
|
return value ? JSON.parse(value) : null;
|
|
@@ -1367,7 +1686,7 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1367
1686
|
type: INTERACTION_TYPE = INTERACTION_TYPE.SIGNIN
|
|
1368
1687
|
): void {
|
|
1369
1688
|
// Ensure we don't overwrite interaction in progress for a different clientId
|
|
1370
|
-
const key = `${
|
|
1689
|
+
const key = `${CacheKeys.PREFIX}.${TemporaryCacheKeys.INTERACTION_STATUS_KEY}`;
|
|
1371
1690
|
if (inProgress) {
|
|
1372
1691
|
if (this.getInteractionInProgress()) {
|
|
1373
1692
|
throw createBrowserAuthError(
|
|
@@ -1530,6 +1849,7 @@ export const DEFAULT_BROWSER_CACHE_MANAGER = (
|
|
|
1530
1849
|
): BrowserCacheManager => {
|
|
1531
1850
|
const cacheOptions: Required<CacheOptions> = {
|
|
1532
1851
|
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
1852
|
+
cacheRetentionDays: 5,
|
|
1533
1853
|
temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
1534
1854
|
storeAuthStateInCookie: false,
|
|
1535
1855
|
secureCookies: false,
|