@azure/msal-browser 4.18.0 → 4.19.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.mjs +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 +2 -1
- 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.mjs +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 +2 -1
- 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 +2619 -2498
- 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/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 +2762 -2629
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +2762 -2629
- 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/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/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 +1 -0
- 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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessTokenEntity, AccountEntity, AccountInfo, AppMetadataEntity, AuthorityMetadataEntity, CacheManager, CacheRecord, CommonAuthorizationUrlRequest, ICrypto, IdTokenEntity, IPerformanceClient, Logger, RefreshTokenEntity, ServerTelemetryEntity, StaticAuthorityOptions, StoreInCache, ThrottlingEntity, TokenKeys } from "@azure/msal-common/browser";
|
|
1
|
+
import { AccessTokenEntity, AccountEntity, AccountInfo, AppMetadataEntity, AuthorityMetadataEntity, CacheManager, CacheRecord, CommonAuthorizationUrlRequest, ICrypto, IdTokenEntity, IPerformanceClient, Logger, RefreshTokenEntity, ServerTelemetryEntity, StaticAuthorityOptions, StoreInCache, ThrottlingEntity, TokenKeys, CredentialEntity } from "@azure/msal-common/browser";
|
|
2
2
|
import { CacheOptions } from "../config/Configuration.js";
|
|
3
3
|
import { INTERACTION_TYPE } from "../utils/BrowserConstants.js";
|
|
4
4
|
import { MemoryStorage } from "./MemoryStorage.js";
|
|
@@ -26,6 +26,11 @@ export declare class BrowserCacheManager extends CacheManager {
|
|
|
26
26
|
private eventHandler;
|
|
27
27
|
constructor(clientId: string, cacheConfig: Required<CacheOptions>, cryptoImpl: ICrypto, logger: Logger, performanceClient: IPerformanceClient, eventHandler: EventHandler, staticAuthorityOptions?: StaticAuthorityOptions);
|
|
28
28
|
initialize(correlationId: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Migrates any existing cache data from previous versions of MSAL.js into the current cache structure.
|
|
31
|
+
*/
|
|
32
|
+
migrateExistingCache(correlationId: string): Promise<void>;
|
|
33
|
+
updateV0ToCurrent(currentSchema: number, v0Keys: Array<string>, v1Keys: Array<string>, correlationId: string): Promise<void[]>;
|
|
29
34
|
/**
|
|
30
35
|
* Tracks upgrades and downgrades for telemetry and debugging purposes
|
|
31
36
|
*/
|
|
@@ -79,12 +84,7 @@ export declare class BrowserCacheManager extends CacheManager {
|
|
|
79
84
|
* Extends inherited removeAccount function to include removal of the account key from the map
|
|
80
85
|
* @param key
|
|
81
86
|
*/
|
|
82
|
-
removeAccount(
|
|
83
|
-
/**
|
|
84
|
-
* Removes credentials associated with the provided account
|
|
85
|
-
* @param account
|
|
86
|
-
*/
|
|
87
|
-
removeAccountContext(account: AccountEntity, correlationId: string): void;
|
|
87
|
+
removeAccount(account: AccountInfo, correlationId: string): void;
|
|
88
88
|
/**
|
|
89
89
|
* Removes given idToken from the cache and from the key map
|
|
90
90
|
* @param key
|
|
@@ -101,7 +101,7 @@ export declare class BrowserCacheManager extends CacheManager {
|
|
|
101
101
|
* @param correlationId
|
|
102
102
|
* @param tokenKeys
|
|
103
103
|
*/
|
|
104
|
-
removeAccessTokenKeys(keys: Array<string>, correlationId: string): void;
|
|
104
|
+
removeAccessTokenKeys(keys: Array<string>, correlationId: string, schemaVersion?: number): void;
|
|
105
105
|
/**
|
|
106
106
|
* Removes given refreshToken from the cache and from the key map
|
|
107
107
|
* @param key
|
|
@@ -111,14 +111,14 @@ export declare class BrowserCacheManager extends CacheManager {
|
|
|
111
111
|
* Gets the keys for the cached tokens associated with this clientId
|
|
112
112
|
* @returns
|
|
113
113
|
*/
|
|
114
|
-
getTokenKeys(): TokenKeys;
|
|
114
|
+
getTokenKeys(schemaVersion?: number): TokenKeys;
|
|
115
115
|
/**
|
|
116
116
|
* Stores the token keys in the cache
|
|
117
117
|
* @param tokenKeys
|
|
118
118
|
* @param correlationId
|
|
119
119
|
* @returns
|
|
120
120
|
*/
|
|
121
|
-
setTokenKeys(tokenKeys: TokenKeys, correlationId: string): void;
|
|
121
|
+
setTokenKeys(tokenKeys: TokenKeys, correlationId: string, schemaVersion?: number): void;
|
|
122
122
|
/**
|
|
123
123
|
* generates idToken entity from a string
|
|
124
124
|
* @param idTokenKey
|
|
@@ -254,11 +254,26 @@ export declare class BrowserCacheManager extends CacheManager {
|
|
|
254
254
|
*/
|
|
255
255
|
clearTokensAndKeysWithClaims(correlationId: string): void;
|
|
256
256
|
/**
|
|
257
|
-
* Prepend msal.<client-id> to each key
|
|
257
|
+
* Prepend msal.<client-id> to each key
|
|
258
258
|
* @param key
|
|
259
259
|
* @param addInstanceId
|
|
260
260
|
*/
|
|
261
261
|
generateCacheKey(key: string): string;
|
|
262
|
+
/**
|
|
263
|
+
* Cache Key: msal.<schema_version>-<home_account_id>-<environment>-<credential_type>-<client_id or familyId>-<realm>-<scopes>-<claims hash>-<scheme>
|
|
264
|
+
* IdToken Example: uid.utid-login.microsoftonline.com-idtoken-app_client_id-contoso.com
|
|
265
|
+
* AccessToken Example: uid.utid-login.microsoftonline.com-accesstoken-app_client_id-contoso.com-scope1 scope2--pop
|
|
266
|
+
* RefreshToken Example: uid.utid-login.microsoftonline.com-refreshtoken-1-contoso.com
|
|
267
|
+
* @param credentialEntity
|
|
268
|
+
* @returns
|
|
269
|
+
*/
|
|
270
|
+
generateCredentialKey(credential: CredentialEntity): string;
|
|
271
|
+
/**
|
|
272
|
+
* Cache Key: msal.<schema_version>.<home_account_id>.<environment>.<tenant_id>
|
|
273
|
+
* @param account
|
|
274
|
+
* @returns
|
|
275
|
+
*/
|
|
276
|
+
generateAccountKey(account: AccountInfo): string;
|
|
262
277
|
/**
|
|
263
278
|
* Reset all temporary cache items
|
|
264
279
|
* @param state
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserCacheManager.d.ts","sourceRoot":"","sources":["../../../src/cache/BrowserCacheManager.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,iBAAiB,EACjB,aAAa,EACb,WAAW,EAEX,iBAAiB,EAEjB,uBAAuB,EAIvB,YAAY,EACZ,WAAW,EACX,6BAA6B,EAI7B,OAAO,EACP,aAAa,EAEb,kBAAkB,EAClB,MAAM,EAGN,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,YAAY,EAEZ,gBAAgB,EAEhB,SAAS,
|
|
1
|
+
{"version":3,"file":"BrowserCacheManager.d.ts","sourceRoot":"","sources":["../../../src/cache/BrowserCacheManager.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,iBAAiB,EACjB,aAAa,EACb,WAAW,EAEX,iBAAiB,EAEjB,uBAAuB,EAIvB,YAAY,EACZ,WAAW,EACX,6BAA6B,EAI7B,OAAO,EACP,aAAa,EAEb,kBAAkB,EAClB,MAAM,EAGN,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,EACtB,YAAY,EAEZ,gBAAgB,EAEhB,SAAS,EACT,gBAAgB,EAGnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAK1D,OAAO,EAGH,gBAAgB,EAEnB,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,O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|
-
import { CacheManager, createCacheError, CacheErrorCodes, invokeAsync, PerformanceEvents, AccountEntity,
|
|
3
|
+
import { CacheManager, CacheHelpers, TimeUtils, DEFAULT_TOKEN_RENEWAL_OFFSET_SEC, createCacheError, CacheErrorCodes, invokeAsync, PerformanceEvents, AccountEntity, Constants, PersistentCacheKeys, StringUtils, AuthenticationScheme, CacheError, DEFAULT_CRYPTO_IMPLEMENTATION, CredentialType } from '@azure/msal-common/browser';
|
|
4
4
|
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { BrowserCacheLocation, InMemoryCacheKeys, TemporaryCacheKeys, INTERACTION_TYPE } from '../utils/BrowserConstants.mjs';
|
|
6
|
+
import { ACCOUNT_SCHEMA_VERSION, CREDENTIAL_SCHEMA_VERSION, getAccountKeysCacheKey, PREFIX, CACHE_KEY_SEPARATOR, VERSION_CACHE_KEY, getTokenKeysCacheKey } from './CacheKeys.mjs';
|
|
6
7
|
import { LocalStorage } from './LocalStorage.mjs';
|
|
7
8
|
import { SessionStorage } from './SessionStorage.mjs';
|
|
8
9
|
import { MemoryStorage } from './MemoryStorage.mjs';
|
|
@@ -13,6 +14,8 @@ import { getAccountKeys, getTokenKeys } from './CacheHelpers.mjs';
|
|
|
13
14
|
import { EventType } from '../event/EventType.mjs';
|
|
14
15
|
import { clearHash } from '../utils/BrowserUtils.mjs';
|
|
15
16
|
import { version } from '../packageMetadata.mjs';
|
|
17
|
+
import { removeElementFromArray } from '../utils/Helpers.mjs';
|
|
18
|
+
import { isEncrypted } from './EncryptedData.mjs';
|
|
16
19
|
import { noTokenRequestCacheError, unableToParseTokenRequestCacheError, interactionInProgress } from '../error/BrowserAuthErrorCodes.mjs';
|
|
17
20
|
|
|
18
21
|
/*
|
|
@@ -36,20 +39,132 @@ class BrowserCacheManager extends CacheManager {
|
|
|
36
39
|
this.eventHandler = eventHandler;
|
|
37
40
|
}
|
|
38
41
|
async initialize(correlationId) {
|
|
42
|
+
this.performanceClient.addFields({
|
|
43
|
+
cacheLocation: this.cacheConfig.cacheLocation,
|
|
44
|
+
cacheRetentionDays: this.cacheConfig.cacheRetentionDays,
|
|
45
|
+
}, correlationId);
|
|
39
46
|
await this.browserStorage.initialize(correlationId);
|
|
47
|
+
await this.migrateExistingCache(correlationId);
|
|
40
48
|
this.trackVersionChanges(correlationId);
|
|
41
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Migrates any existing cache data from previous versions of MSAL.js into the current cache structure.
|
|
52
|
+
*/
|
|
53
|
+
async migrateExistingCache(correlationId) {
|
|
54
|
+
const accountKeys0 = getAccountKeys(this.browserStorage, 0);
|
|
55
|
+
const tokenKeys0 = getTokenKeys(this.clientId, this.browserStorage, 0);
|
|
56
|
+
this.performanceClient.addFields({
|
|
57
|
+
oldAccountCount: accountKeys0.length,
|
|
58
|
+
oldAccessCount: tokenKeys0.accessToken.length,
|
|
59
|
+
oldIdCount: tokenKeys0.idToken.length,
|
|
60
|
+
oldRefreshCount: tokenKeys0.refreshToken.length,
|
|
61
|
+
}, correlationId);
|
|
62
|
+
const accountKeys1 = getAccountKeys(this.browserStorage, 1);
|
|
63
|
+
const tokenKeys1 = getTokenKeys(this.clientId, this.browserStorage, 1);
|
|
64
|
+
this.performanceClient.addFields({
|
|
65
|
+
currAccountCount: accountKeys1.length,
|
|
66
|
+
currAccessCount: tokenKeys1.accessToken.length,
|
|
67
|
+
currIdCount: tokenKeys1.idToken.length,
|
|
68
|
+
currRefreshCount: tokenKeys1.refreshToken.length,
|
|
69
|
+
}, correlationId);
|
|
70
|
+
await Promise.all([
|
|
71
|
+
this.updateV0ToCurrent(ACCOUNT_SCHEMA_VERSION, accountKeys0, accountKeys1, correlationId),
|
|
72
|
+
this.updateV0ToCurrent(CREDENTIAL_SCHEMA_VERSION, tokenKeys0.idToken, tokenKeys1.idToken, correlationId),
|
|
73
|
+
this.updateV0ToCurrent(CREDENTIAL_SCHEMA_VERSION, tokenKeys0.accessToken, tokenKeys1.accessToken, correlationId),
|
|
74
|
+
this.updateV0ToCurrent(CREDENTIAL_SCHEMA_VERSION, tokenKeys0.refreshToken, tokenKeys1.refreshToken, correlationId),
|
|
75
|
+
]);
|
|
76
|
+
if (accountKeys0.length > 0) {
|
|
77
|
+
this.browserStorage.setItem(getAccountKeysCacheKey(0), JSON.stringify(accountKeys0));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
this.browserStorage.removeItem(getAccountKeysCacheKey(0));
|
|
81
|
+
}
|
|
82
|
+
if (accountKeys1.length > 0) {
|
|
83
|
+
this.browserStorage.setItem(getAccountKeysCacheKey(1), JSON.stringify(accountKeys1));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.browserStorage.removeItem(getAccountKeysCacheKey(1));
|
|
87
|
+
}
|
|
88
|
+
this.setTokenKeys(tokenKeys0, correlationId, 0);
|
|
89
|
+
this.setTokenKeys(tokenKeys1, correlationId, 1);
|
|
90
|
+
}
|
|
91
|
+
async updateV0ToCurrent(currentSchema, v0Keys, v1Keys, correlationId) {
|
|
92
|
+
const upgradePromises = [];
|
|
93
|
+
for (const v0Key of [...v0Keys]) {
|
|
94
|
+
const rawV0Value = this.browserStorage.getItem(v0Key);
|
|
95
|
+
const parsedV0Value = this.validateAndParseJson(rawV0Value || "");
|
|
96
|
+
if (!parsedV0Value) {
|
|
97
|
+
removeElementFromArray(v0Keys, v0Key);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (!parsedV0Value.lastUpdatedAt) {
|
|
101
|
+
// Add lastUpdatedAt to the existing v0 entry if it doesnt exist so we know when it's safe to remove it
|
|
102
|
+
parsedV0Value.lastUpdatedAt = Date.now().toString();
|
|
103
|
+
this.setItem(v0Key, JSON.stringify(parsedV0Value), correlationId);
|
|
104
|
+
}
|
|
105
|
+
const decryptedData = isEncrypted(parsedV0Value)
|
|
106
|
+
? await this.browserStorage.decryptData(v0Key, parsedV0Value, correlationId)
|
|
107
|
+
: parsedV0Value;
|
|
108
|
+
let expirationTime;
|
|
109
|
+
if (decryptedData) {
|
|
110
|
+
if (CacheHelpers.isAccessTokenEntity(decryptedData)) {
|
|
111
|
+
expirationTime = decryptedData.expiresOn;
|
|
112
|
+
}
|
|
113
|
+
else if (CacheHelpers.isRefreshTokenEntity(decryptedData)) {
|
|
114
|
+
expirationTime = decryptedData.expiresOn;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (!decryptedData ||
|
|
118
|
+
TimeUtils.isCacheExpired(parsedV0Value.lastUpdatedAt, this.cacheConfig.cacheRetentionDays) ||
|
|
119
|
+
(expirationTime &&
|
|
120
|
+
TimeUtils.isTokenExpired(expirationTime, DEFAULT_TOKEN_RENEWAL_OFFSET_SEC))) {
|
|
121
|
+
this.browserStorage.removeItem(v0Key);
|
|
122
|
+
removeElementFromArray(v0Keys, v0Key);
|
|
123
|
+
this.performanceClient.incrementFields({ expiredCacheRemovedCount: 1 }, correlationId);
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (this.cacheConfig.cacheLocation !==
|
|
127
|
+
BrowserCacheLocation.LocalStorage ||
|
|
128
|
+
isEncrypted(parsedV0Value)) {
|
|
129
|
+
const v1Key = `${PREFIX}.${currentSchema}${CACHE_KEY_SEPARATOR}${v0Key}`;
|
|
130
|
+
const rawV1Entry = this.browserStorage.getItem(v1Key);
|
|
131
|
+
if (!rawV1Entry) {
|
|
132
|
+
upgradePromises.push(this.setUserData(v1Key, JSON.stringify(decryptedData), correlationId, parsedV0Value.lastUpdatedAt).then(() => {
|
|
133
|
+
v1Keys.push(v1Key);
|
|
134
|
+
this.performanceClient.incrementFields({ upgradedCacheCount: 1 }, correlationId);
|
|
135
|
+
}));
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const parsedV1Entry = this.validateAndParseJson(rawV1Entry);
|
|
140
|
+
// If the entry already exists but is older than the v0 entry, replace it
|
|
141
|
+
if (Number(parsedV0Value.lastUpdatedAt) >
|
|
142
|
+
Number(parsedV1Entry.lastUpdatedAt)) {
|
|
143
|
+
upgradePromises.push(this.setUserData(v1Key, JSON.stringify(decryptedData), correlationId, parsedV0Value.lastUpdatedAt).then(() => {
|
|
144
|
+
this.performanceClient.incrementFields({ updatedCacheFromV0Count: 1 }, correlationId);
|
|
145
|
+
}));
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/*
|
|
151
|
+
* Note: If we reach here for unencrypted localStorage data, we continue without migrating
|
|
152
|
+
* as we can't migrate unencrypted localStorage data right now since we can't guarantee KMSI=no
|
|
153
|
+
*/
|
|
154
|
+
}
|
|
155
|
+
return Promise.all(upgradePromises);
|
|
156
|
+
}
|
|
42
157
|
/**
|
|
43
158
|
* Tracks upgrades and downgrades for telemetry and debugging purposes
|
|
44
159
|
*/
|
|
45
160
|
trackVersionChanges(correlationId) {
|
|
46
|
-
const previousVersion = this.browserStorage.getItem(
|
|
161
|
+
const previousVersion = this.browserStorage.getItem(VERSION_CACHE_KEY);
|
|
47
162
|
if (previousVersion) {
|
|
48
163
|
this.logger.info(`MSAL.js was last initialized by version: ${previousVersion}`);
|
|
49
164
|
this.performanceClient.addFields({ previousLibraryVersion: previousVersion }, correlationId);
|
|
50
165
|
}
|
|
51
166
|
if (previousVersion !== version) {
|
|
52
|
-
this.setItem(
|
|
167
|
+
this.setItem(VERSION_CACHE_KEY, version, correlationId);
|
|
53
168
|
}
|
|
54
169
|
}
|
|
55
170
|
/**
|
|
@@ -57,6 +172,9 @@ class BrowserCacheManager extends CacheManager {
|
|
|
57
172
|
* @param input
|
|
58
173
|
*/
|
|
59
174
|
validateAndParseJson(jsonValue) {
|
|
175
|
+
if (!jsonValue) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
60
178
|
try {
|
|
61
179
|
const parsedJson = JSON.parse(jsonValue);
|
|
62
180
|
/**
|
|
@@ -79,6 +197,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
79
197
|
* @param value
|
|
80
198
|
*/
|
|
81
199
|
setItem(key, value, correlationId) {
|
|
200
|
+
let tokenKeysV0Count = 0;
|
|
82
201
|
let accessTokenKeys = [];
|
|
83
202
|
const maxRetries = 20;
|
|
84
203
|
for (let i = 0; i <= maxRetries; i++) {
|
|
@@ -86,7 +205,13 @@ class BrowserCacheManager extends CacheManager {
|
|
|
86
205
|
this.browserStorage.setItem(key, value);
|
|
87
206
|
if (i > 0) {
|
|
88
207
|
// Finally update the token keys array with the tokens removed
|
|
89
|
-
|
|
208
|
+
if (i <= tokenKeysV0Count) {
|
|
209
|
+
this.removeAccessTokenKeys(accessTokenKeys.slice(0, i), correlationId, 0);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
this.removeAccessTokenKeys(accessTokenKeys.slice(0, tokenKeysV0Count), correlationId, 0);
|
|
213
|
+
this.removeAccessTokenKeys(accessTokenKeys.slice(tokenKeysV0Count, i), correlationId);
|
|
214
|
+
}
|
|
90
215
|
}
|
|
91
216
|
break; // If setItem succeeds, exit the loop
|
|
92
217
|
}
|
|
@@ -96,16 +221,17 @@ class BrowserCacheManager extends CacheManager {
|
|
|
96
221
|
CacheErrorCodes.cacheQuotaExceeded &&
|
|
97
222
|
i < maxRetries) {
|
|
98
223
|
if (!accessTokenKeys.length) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
224
|
+
// If we are currently trying to set the token keys, use the value we're trying to set
|
|
225
|
+
const tokenKeys0 = key ===
|
|
226
|
+
getTokenKeysCacheKey(this.clientId, 0)
|
|
227
|
+
? JSON.parse(value).accessToken
|
|
228
|
+
: this.getTokenKeys(0).accessToken;
|
|
229
|
+
const tokenKeys1 = key ===
|
|
230
|
+
getTokenKeysCacheKey(this.clientId)
|
|
231
|
+
? JSON.parse(value).accessToken
|
|
232
|
+
: this.getTokenKeys().accessToken;
|
|
233
|
+
accessTokenKeys = [...tokenKeys0, ...tokenKeys1];
|
|
234
|
+
tokenKeysV0Count = tokenKeys0.length;
|
|
109
235
|
}
|
|
110
236
|
if (accessTokenKeys.length <= i) {
|
|
111
237
|
// Nothing to remove, rethrow the error
|
|
@@ -129,6 +255,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
129
255
|
* @param correlationId
|
|
130
256
|
*/
|
|
131
257
|
async setUserData(key, value, correlationId, timestamp) {
|
|
258
|
+
let tokenKeysV0Count = 0;
|
|
132
259
|
let accessTokenKeys = [];
|
|
133
260
|
const maxRetries = 20;
|
|
134
261
|
for (let i = 0; i <= maxRetries; i++) {
|
|
@@ -136,7 +263,13 @@ class BrowserCacheManager extends CacheManager {
|
|
|
136
263
|
await invokeAsync(this.browserStorage.setUserData.bind(this.browserStorage), PerformanceEvents.SetUserData, this.logger, this.performanceClient)(key, value, correlationId, timestamp);
|
|
137
264
|
if (i > 0) {
|
|
138
265
|
// Finally update the token keys array with the tokens removed
|
|
139
|
-
|
|
266
|
+
if (i <= tokenKeysV0Count) {
|
|
267
|
+
this.removeAccessTokenKeys(accessTokenKeys.slice(0, i), correlationId, 0);
|
|
268
|
+
}
|
|
269
|
+
else {
|
|
270
|
+
this.removeAccessTokenKeys(accessTokenKeys.slice(0, tokenKeysV0Count), correlationId, 0);
|
|
271
|
+
this.removeAccessTokenKeys(accessTokenKeys.slice(tokenKeysV0Count, i), correlationId);
|
|
272
|
+
}
|
|
140
273
|
}
|
|
141
274
|
break; // If setItem succeeds, exit the loop
|
|
142
275
|
}
|
|
@@ -146,7 +279,10 @@ class BrowserCacheManager extends CacheManager {
|
|
|
146
279
|
CacheErrorCodes.cacheQuotaExceeded &&
|
|
147
280
|
i < maxRetries) {
|
|
148
281
|
if (!accessTokenKeys.length) {
|
|
149
|
-
|
|
282
|
+
const tokenKeys0 = this.getTokenKeys(0).accessToken;
|
|
283
|
+
const tokenKeys1 = this.getTokenKeys().accessToken;
|
|
284
|
+
accessTokenKeys = [...tokenKeys0, ...tokenKeys1];
|
|
285
|
+
tokenKeysV0Count = tokenKeys0.length;
|
|
150
286
|
}
|
|
151
287
|
if (accessTokenKeys.length <= i) {
|
|
152
288
|
// Nothing left to remove, rethrow the error
|
|
@@ -188,7 +324,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
188
324
|
*/
|
|
189
325
|
async setAccount(account, correlationId) {
|
|
190
326
|
this.logger.trace("BrowserCacheManager.setAccount called");
|
|
191
|
-
const key =
|
|
327
|
+
const key = this.generateAccountKey(account.getAccountInfo());
|
|
192
328
|
const timestamp = Date.now().toString();
|
|
193
329
|
account.lastUpdatedAt = timestamp;
|
|
194
330
|
await this.setUserData(key, JSON.stringify(account), correlationId, timestamp);
|
|
@@ -220,7 +356,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
220
356
|
if (accountKeys.indexOf(key) === -1) {
|
|
221
357
|
// Only add key if it does not already exist in the map
|
|
222
358
|
accountKeys.push(key);
|
|
223
|
-
this.setItem(
|
|
359
|
+
this.setItem(getAccountKeysCacheKey(), JSON.stringify(accountKeys), correlationId);
|
|
224
360
|
this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added");
|
|
225
361
|
return true;
|
|
226
362
|
}
|
|
@@ -242,11 +378,11 @@ class BrowserCacheManager extends CacheManager {
|
|
|
242
378
|
accountKeys.splice(removalIndex, 1);
|
|
243
379
|
if (accountKeys.length === 0) {
|
|
244
380
|
// If no keys left, remove the map
|
|
245
|
-
this.removeItem(
|
|
381
|
+
this.removeItem(getAccountKeysCacheKey());
|
|
246
382
|
return;
|
|
247
383
|
}
|
|
248
384
|
else {
|
|
249
|
-
this.setItem(
|
|
385
|
+
this.setItem(getAccountKeysCacheKey(), JSON.stringify(accountKeys), correlationId);
|
|
250
386
|
}
|
|
251
387
|
this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed");
|
|
252
388
|
}
|
|
@@ -258,21 +394,26 @@ class BrowserCacheManager extends CacheManager {
|
|
|
258
394
|
* Extends inherited removeAccount function to include removal of the account key from the map
|
|
259
395
|
* @param key
|
|
260
396
|
*/
|
|
261
|
-
removeAccount(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
397
|
+
removeAccount(account, correlationId) {
|
|
398
|
+
const activeAccount = this.getActiveAccount(correlationId);
|
|
399
|
+
if (activeAccount?.homeAccountId === account.homeAccountId &&
|
|
400
|
+
activeAccount?.environment === account.environment) {
|
|
401
|
+
this.setActiveAccount(null, correlationId);
|
|
402
|
+
}
|
|
403
|
+
super.removeAccount(account, correlationId);
|
|
404
|
+
this.removeAccountKeyFromMap(this.generateAccountKey(account), correlationId);
|
|
405
|
+
// Remove all other associated cache items
|
|
406
|
+
this.browserStorage.getKeys().forEach((key) => {
|
|
407
|
+
if (key.includes(account.homeAccountId) &&
|
|
408
|
+
key.includes(account.environment)) {
|
|
409
|
+
this.browserStorage.removeItem(key);
|
|
410
|
+
}
|
|
411
|
+
});
|
|
271
412
|
/**
|
|
272
413
|
* @deprecated - Remove this in next major version in favor of more consistent LOGOUT event
|
|
273
414
|
*/
|
|
274
415
|
if (this.cacheConfig.cacheLocation === BrowserCacheLocation.LocalStorage) {
|
|
275
|
-
this.eventHandler.emitEvent(EventType.ACCOUNT_REMOVED, undefined, account
|
|
416
|
+
this.eventHandler.emitEvent(EventType.ACCOUNT_REMOVED, undefined, account);
|
|
276
417
|
}
|
|
277
418
|
}
|
|
278
419
|
/**
|
|
@@ -303,9 +444,9 @@ class BrowserCacheManager extends CacheManager {
|
|
|
303
444
|
* @param correlationId
|
|
304
445
|
* @param tokenKeys
|
|
305
446
|
*/
|
|
306
|
-
removeAccessTokenKeys(keys, correlationId) {
|
|
447
|
+
removeAccessTokenKeys(keys, correlationId, schemaVersion = CREDENTIAL_SCHEMA_VERSION) {
|
|
307
448
|
this.logger.trace("removeAccessTokenKey called");
|
|
308
|
-
const tokenKeys = this.getTokenKeys();
|
|
449
|
+
const tokenKeys = this.getTokenKeys(schemaVersion);
|
|
309
450
|
let keysRemoved = 0;
|
|
310
451
|
keys.forEach((key) => {
|
|
311
452
|
const accessRemoval = tokenKeys.accessToken.indexOf(key);
|
|
@@ -316,7 +457,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
316
457
|
});
|
|
317
458
|
if (keysRemoved > 0) {
|
|
318
459
|
this.logger.info(`removed ${keysRemoved} accessToken keys from tokenKeys map`);
|
|
319
|
-
this.setTokenKeys(tokenKeys, correlationId);
|
|
460
|
+
this.setTokenKeys(tokenKeys, correlationId, schemaVersion);
|
|
320
461
|
return;
|
|
321
462
|
}
|
|
322
463
|
}
|
|
@@ -338,8 +479,8 @@ class BrowserCacheManager extends CacheManager {
|
|
|
338
479
|
* Gets the keys for the cached tokens associated with this clientId
|
|
339
480
|
* @returns
|
|
340
481
|
*/
|
|
341
|
-
getTokenKeys() {
|
|
342
|
-
return getTokenKeys(this.clientId, this.browserStorage);
|
|
482
|
+
getTokenKeys(schemaVersion = CREDENTIAL_SCHEMA_VERSION) {
|
|
483
|
+
return getTokenKeys(this.clientId, this.browserStorage, schemaVersion);
|
|
343
484
|
}
|
|
344
485
|
/**
|
|
345
486
|
* Stores the token keys in the cache
|
|
@@ -347,16 +488,16 @@ class BrowserCacheManager extends CacheManager {
|
|
|
347
488
|
* @param correlationId
|
|
348
489
|
* @returns
|
|
349
490
|
*/
|
|
350
|
-
setTokenKeys(tokenKeys, correlationId) {
|
|
491
|
+
setTokenKeys(tokenKeys, correlationId, schemaVersion = CREDENTIAL_SCHEMA_VERSION) {
|
|
351
492
|
if (tokenKeys.idToken.length === 0 &&
|
|
352
493
|
tokenKeys.accessToken.length === 0 &&
|
|
353
494
|
tokenKeys.refreshToken.length === 0) {
|
|
354
495
|
// If no keys left, remove the map
|
|
355
|
-
this.removeItem(
|
|
496
|
+
this.removeItem(getTokenKeysCacheKey(this.clientId, schemaVersion));
|
|
356
497
|
return;
|
|
357
498
|
}
|
|
358
499
|
else {
|
|
359
|
-
this.setItem(
|
|
500
|
+
this.setItem(getTokenKeysCacheKey(this.clientId, schemaVersion), JSON.stringify(tokenKeys), correlationId);
|
|
360
501
|
}
|
|
361
502
|
}
|
|
362
503
|
/**
|
|
@@ -384,7 +525,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
384
525
|
*/
|
|
385
526
|
async setIdTokenCredential(idToken, correlationId) {
|
|
386
527
|
this.logger.trace("BrowserCacheManager.setIdTokenCredential called");
|
|
387
|
-
const idTokenKey =
|
|
528
|
+
const idTokenKey = this.generateCredentialKey(idToken);
|
|
388
529
|
const timestamp = Date.now().toString();
|
|
389
530
|
idToken.lastUpdatedAt = timestamp;
|
|
390
531
|
await this.setUserData(idTokenKey, JSON.stringify(idToken), correlationId, timestamp);
|
|
@@ -421,7 +562,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
421
562
|
*/
|
|
422
563
|
async setAccessTokenCredential(accessToken, correlationId) {
|
|
423
564
|
this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");
|
|
424
|
-
const accessTokenKey =
|
|
565
|
+
const accessTokenKey = this.generateCredentialKey(accessToken);
|
|
425
566
|
const timestamp = Date.now().toString();
|
|
426
567
|
accessToken.lastUpdatedAt = timestamp;
|
|
427
568
|
await this.setUserData(accessTokenKey, JSON.stringify(accessToken), correlationId, timestamp);
|
|
@@ -460,7 +601,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
460
601
|
*/
|
|
461
602
|
async setRefreshTokenCredential(refreshToken, correlationId) {
|
|
462
603
|
this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");
|
|
463
|
-
const refreshTokenKey =
|
|
604
|
+
const refreshTokenKey = this.generateCredentialKey(refreshToken);
|
|
464
605
|
const timestamp = Date.now().toString();
|
|
465
606
|
refreshToken.lastUpdatedAt = timestamp;
|
|
466
607
|
await this.setUserData(refreshTokenKey, JSON.stringify(refreshToken), correlationId, timestamp);
|
|
@@ -732,14 +873,14 @@ class BrowserCacheManager extends CacheManager {
|
|
|
732
873
|
this.removeAppMetadata(correlationId);
|
|
733
874
|
// Remove temp storage first to make sure any cookies are cleared
|
|
734
875
|
this.temporaryCacheStorage.getKeys().forEach((cacheKey) => {
|
|
735
|
-
if (cacheKey.indexOf(
|
|
876
|
+
if (cacheKey.indexOf(PREFIX) !== -1 ||
|
|
736
877
|
cacheKey.indexOf(this.clientId) !== -1) {
|
|
737
878
|
this.removeTemporaryItem(cacheKey);
|
|
738
879
|
}
|
|
739
880
|
});
|
|
740
881
|
// Removes all remaining MSAL cache items
|
|
741
882
|
this.browserStorage.getKeys().forEach((cacheKey) => {
|
|
742
|
-
if (cacheKey.indexOf(
|
|
883
|
+
if (cacheKey.indexOf(PREFIX) !== -1 ||
|
|
743
884
|
cacheKey.indexOf(this.clientId) !== -1) {
|
|
744
885
|
this.browserStorage.removeItem(cacheKey);
|
|
745
886
|
}
|
|
@@ -771,19 +912,60 @@ class BrowserCacheManager extends CacheManager {
|
|
|
771
912
|
}
|
|
772
913
|
}
|
|
773
914
|
/**
|
|
774
|
-
* Prepend msal.<client-id> to each key
|
|
915
|
+
* Prepend msal.<client-id> to each key
|
|
775
916
|
* @param key
|
|
776
917
|
* @param addInstanceId
|
|
777
918
|
*/
|
|
778
919
|
generateCacheKey(key) {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
if (StringUtils.startsWith(key, Constants.CACHE_PREFIX)) {
|
|
782
|
-
return key;
|
|
783
|
-
}
|
|
784
|
-
return `${Constants.CACHE_PREFIX}.${this.clientId}.${key}`;
|
|
920
|
+
if (StringUtils.startsWith(key, PREFIX)) {
|
|
921
|
+
return key;
|
|
785
922
|
}
|
|
786
|
-
return
|
|
923
|
+
return `${PREFIX}.${this.clientId}.${key}`;
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Cache Key: msal.<schema_version>-<home_account_id>-<environment>-<credential_type>-<client_id or familyId>-<realm>-<scopes>-<claims hash>-<scheme>
|
|
927
|
+
* IdToken Example: uid.utid-login.microsoftonline.com-idtoken-app_client_id-contoso.com
|
|
928
|
+
* AccessToken Example: uid.utid-login.microsoftonline.com-accesstoken-app_client_id-contoso.com-scope1 scope2--pop
|
|
929
|
+
* RefreshToken Example: uid.utid-login.microsoftonline.com-refreshtoken-1-contoso.com
|
|
930
|
+
* @param credentialEntity
|
|
931
|
+
* @returns
|
|
932
|
+
*/
|
|
933
|
+
generateCredentialKey(credential) {
|
|
934
|
+
const familyId = (credential.credentialType === CredentialType.REFRESH_TOKEN &&
|
|
935
|
+
credential.familyId) ||
|
|
936
|
+
credential.clientId;
|
|
937
|
+
const scheme = credential.tokenType &&
|
|
938
|
+
credential.tokenType.toLowerCase() !==
|
|
939
|
+
AuthenticationScheme.BEARER.toLowerCase()
|
|
940
|
+
? credential.tokenType.toLowerCase()
|
|
941
|
+
: "";
|
|
942
|
+
const credentialKey = [
|
|
943
|
+
`${PREFIX}.${CREDENTIAL_SCHEMA_VERSION}`,
|
|
944
|
+
credential.homeAccountId,
|
|
945
|
+
credential.environment,
|
|
946
|
+
credential.credentialType,
|
|
947
|
+
familyId,
|
|
948
|
+
credential.realm || "",
|
|
949
|
+
credential.target || "",
|
|
950
|
+
credential.requestedClaimsHash || "",
|
|
951
|
+
scheme,
|
|
952
|
+
];
|
|
953
|
+
return credentialKey.join(CACHE_KEY_SEPARATOR).toLowerCase();
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Cache Key: msal.<schema_version>.<home_account_id>.<environment>.<tenant_id>
|
|
957
|
+
* @param account
|
|
958
|
+
* @returns
|
|
959
|
+
*/
|
|
960
|
+
generateAccountKey(account) {
|
|
961
|
+
const homeTenantId = account.homeAccountId.split(".")[1];
|
|
962
|
+
const accountKey = [
|
|
963
|
+
`${PREFIX}.${ACCOUNT_SCHEMA_VERSION}`,
|
|
964
|
+
account.homeAccountId,
|
|
965
|
+
account.environment,
|
|
966
|
+
homeTenantId || account.tenantId || "",
|
|
967
|
+
];
|
|
968
|
+
return accountKey.join(CACHE_KEY_SEPARATOR).toLowerCase();
|
|
787
969
|
}
|
|
788
970
|
/**
|
|
789
971
|
* Reset all temporary cache items
|
|
@@ -860,7 +1042,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
860
1042
|
}
|
|
861
1043
|
}
|
|
862
1044
|
getInteractionInProgress() {
|
|
863
|
-
const key = `${
|
|
1045
|
+
const key = `${PREFIX}.${TemporaryCacheKeys.INTERACTION_STATUS_KEY}`;
|
|
864
1046
|
const value = this.getTemporaryCache(key, false);
|
|
865
1047
|
try {
|
|
866
1048
|
return value ? JSON.parse(value) : null;
|
|
@@ -876,7 +1058,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
876
1058
|
}
|
|
877
1059
|
setInteractionInProgress(inProgress, type = INTERACTION_TYPE.SIGNIN) {
|
|
878
1060
|
// Ensure we don't overwrite interaction in progress for a different clientId
|
|
879
|
-
const key = `${
|
|
1061
|
+
const key = `${PREFIX}.${TemporaryCacheKeys.INTERACTION_STATUS_KEY}`;
|
|
880
1062
|
if (inProgress) {
|
|
881
1063
|
if (this.getInteractionInProgress()) {
|
|
882
1064
|
throw createBrowserAuthError(interactionInProgress);
|
|
@@ -976,6 +1158,7 @@ function getStorageImplementation(clientId, cacheLocation, logger, performanceCl
|
|
|
976
1158
|
const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger, performanceClient, eventHandler) => {
|
|
977
1159
|
const cacheOptions = {
|
|
978
1160
|
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
1161
|
+
cacheRetentionDays: 5,
|
|
979
1162
|
temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
980
1163
|
storeAuthStateInCookie: false,
|
|
981
1164
|
secureCookies: false,
|