@azure/msal-browser 2.36.0 → 3.0.0-alpha.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/LICENSE +21 -21
- package/README.md +213 -213
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.js +33 -33
- package/dist/app/IPublicClientApplication.js.map +1 -1
- package/dist/app/PublicClientApplication.d.ts +198 -24
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.js +263 -220
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +5 -4
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.js +118 -124
- package/dist/broker/nativeBroker/NativeMessageHandler.js.map +1 -1
- package/dist/broker/nativeBroker/NativeRequest.d.ts +4 -4
- package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeResponse.d.ts +4 -4
- package/dist/broker/nativeBroker/NativeResponse.d.ts.map +1 -1
- package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/dist/cache/AsyncMemoryStorage.js +83 -152
- package/dist/cache/AsyncMemoryStorage.js.map +1 -1
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.js +420 -412
- package/dist/cache/BrowserCacheManager.js.map +1 -1
- package/dist/cache/BrowserStorage.d.ts.map +1 -1
- package/dist/cache/BrowserStorage.js +19 -19
- package/dist/cache/BrowserStorage.js.map +1 -1
- package/dist/cache/CryptoKeyStore.d.ts.map +1 -1
- package/dist/cache/CryptoKeyStore.js +26 -36
- package/dist/cache/CryptoKeyStore.js.map +1 -1
- package/dist/cache/DatabaseStorage.d.ts.map +1 -1
- package/dist/cache/DatabaseStorage.js +127 -191
- package/dist/cache/DatabaseStorage.js.map +1 -1
- package/dist/cache/ITokenCache.d.ts.map +1 -1
- package/dist/cache/MemoryStorage.d.ts.map +1 -1
- package/dist/cache/MemoryStorage.js +18 -19
- package/dist/cache/MemoryStorage.js.map +1 -1
- package/dist/cache/TokenCache.d.ts +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.js +55 -49
- package/dist/cache/TokenCache.js.map +1 -1
- package/dist/config/Configuration.d.ts +8 -8
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +53 -31
- package/dist/config/Configuration.js.map +1 -1
- package/dist/controllers/ControllerFactory.d.ts +10 -0
- package/dist/controllers/ControllerFactory.d.ts.map +1 -0
- package/dist/controllers/ControllerFactory.js +47 -0
- package/dist/controllers/ControllerFactory.js.map +1 -0
- package/dist/controllers/IController.d.ts +67 -0
- package/dist/controllers/IController.d.ts.map +1 -0
- package/dist/{app/ClientApplication.d.ts → controllers/StandardController.d.ts} +96 -15
- package/dist/controllers/StandardController.d.ts.map +1 -0
- package/dist/controllers/StandardController.js +1299 -0
- package/dist/controllers/StandardController.js.map +1 -0
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.js +36 -60
- package/dist/crypto/BrowserCrypto.js.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +1 -1
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.js +93 -151
- package/dist/crypto/CryptoOps.js.map +1 -1
- package/dist/crypto/GuidGenerator.d.ts.map +1 -1
- package/dist/crypto/GuidGenerator.js +36 -25
- package/dist/crypto/GuidGenerator.js.map +1 -1
- package/dist/crypto/ISubtleCrypto.d.ts.map +1 -1
- package/dist/crypto/ModernBrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/ModernBrowserCrypto.js +20 -44
- package/dist/crypto/ModernBrowserCrypto.js.map +1 -1
- package/dist/crypto/MsBrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/MsBrowserCrypto.js +65 -89
- package/dist/crypto/MsBrowserCrypto.js.map +1 -1
- package/dist/crypto/MsrBrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/MsrBrowserCrypto.js +23 -47
- package/dist/crypto/MsrBrowserCrypto.js.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.js +28 -49
- package/dist/crypto/PkceGenerator.js.map +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts +1 -1
- package/dist/crypto/SignedHttpRequest.d.ts.map +1 -1
- package/dist/crypto/SignedHttpRequest.js +15 -37
- package/dist/crypto/SignedHttpRequest.js.map +1 -1
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.js +32 -33
- package/dist/encode/Base64Decode.js.map +1 -1
- package/dist/encode/Base64Encode.d.ts.map +1 -1
- package/dist/encode/Base64Encode.js +34 -35
- package/dist/encode/Base64Encode.js.map +1 -1
- package/dist/error/BrowserAuthError.d.ts +1 -1
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.js +161 -163
- package/dist/error/BrowserAuthError.js.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.d.ts.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +32 -36
- package/dist/error/BrowserConfigurationAuthError.js.map +1 -1
- package/dist/error/NativeAuthError.d.ts +1 -1
- package/dist/error/NativeAuthError.d.ts.map +1 -1
- package/dist/error/NativeAuthError.js +26 -27
- package/dist/error/NativeAuthError.js.map +1 -1
- package/dist/event/EventHandler.d.ts.map +1 -1
- package/dist/event/EventHandler.js +33 -33
- package/dist/event/EventHandler.js.map +1 -1
- package/dist/event/EventMessage.d.ts +5 -5
- package/dist/event/EventMessage.d.ts.map +1 -1
- package/dist/event/EventMessage.js +18 -14
- package/dist/event/EventMessage.js.map +1 -1
- package/dist/event/EventType.js +1 -1
- package/dist/event/EventType.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +92 -123
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +6 -10
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.js +336 -393
- package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +224 -246
- package/dist/interaction_client/PopupClient.js.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.js +244 -292
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +50 -63
- package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +50 -81
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +107 -125
- package/dist/interaction_client/SilentIframeClient.js.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +44 -72
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +144 -180
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +84 -110
- package/dist/interaction_handler/InteractionHandler.js.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.js +105 -122
- package/dist/interaction_handler/RedirectHandler.js.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.js +76 -65
- package/dist/interaction_handler/SilentHandler.js.map +1 -1
- package/dist/internals.js +1 -1
- package/dist/internals.js.map +1 -1
- package/dist/navigation/NavigationClient.d.ts.map +1 -1
- package/dist/navigation/NavigationClient.js +11 -14
- package/dist/navigation/NavigationClient.js.map +1 -1
- package/dist/navigation/NavigationOptions.d.ts +1 -1
- package/dist/navigation/NavigationOptions.d.ts.map +1 -1
- package/dist/network/FetchClient.d.ts.map +1 -1
- package/dist/network/FetchClient.js +66 -96
- package/dist/network/FetchClient.js.map +1 -1
- package/dist/network/XhrClient.d.ts.map +1 -1
- package/dist/network/XhrClient.js +38 -51
- package/dist/network/XhrClient.js.map +1 -1
- package/dist/operatingcontext/BaseOperatingContext.d.ts +41 -0
- package/dist/operatingcontext/BaseOperatingContext.d.ts.map +1 -0
- package/dist/operatingcontext/BaseOperatingContext.js +53 -0
- package/dist/operatingcontext/BaseOperatingContext.js.map +1 -0
- package/dist/operatingcontext/StandardOperatingContext.d.ts +26 -0
- package/dist/operatingcontext/StandardOperatingContext.d.ts.map +1 -0
- package/dist/operatingcontext/StandardOperatingContext.js +50 -0
- package/dist/operatingcontext/StandardOperatingContext.js.map +1 -0
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +26 -0
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -0
- package/dist/operatingcontext/TeamsAppOperatingContext.js +49 -0
- package/dist/operatingcontext/TeamsAppOperatingContext.js.map +1 -0
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.js +3 -3
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/EndSessionPopupRequest.d.ts +1 -1
- package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
- package/dist/request/EndSessionRequest.d.ts +1 -1
- package/dist/request/EndSessionRequest.d.ts.map +1 -1
- package/dist/request/PopupRequest.d.ts +1 -1
- package/dist/request/PopupRequest.d.ts.map +1 -1
- package/dist/request/PopupWindowAttributes.d.ts +3 -3
- package/dist/request/PopupWindowAttributes.d.ts.map +1 -1
- package/dist/request/RedirectRequest.d.ts +1 -1
- package/dist/request/RedirectRequest.d.ts.map +1 -1
- package/dist/request/SilentRequest.d.ts +1 -1
- package/dist/request/SilentRequest.d.ts.map +1 -1
- package/dist/request/SsoSilentRequest.d.ts +1 -1
- package/dist/request/SsoSilentRequest.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.js +62 -57
- package/dist/telemetry/BrowserPerformanceClient.js.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.js +30 -31
- package/dist/telemetry/BrowserPerformanceMeasurement.js.map +1 -1
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.js +10 -10
- package/dist/utils/BrowserConstants.js.map +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
- package/dist/utils/BrowserProtocolUtils.js +9 -12
- package/dist/utils/BrowserProtocolUtils.js.map +1 -1
- package/dist/utils/BrowserStringUtils.d.ts.map +1 -1
- package/dist/utils/BrowserStringUtils.js +83 -49
- package/dist/utils/BrowserStringUtils.js.map +1 -1
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.js +51 -49
- package/dist/utils/BrowserUtils.js.map +1 -1
- package/dist/utils/MathUtils.d.ts.map +1 -1
- package/dist/utils/MathUtils.js +6 -9
- package/dist/utils/MathUtils.js.map +1 -1
- package/node_modules/@azure/msal-common/LICENSE +21 -0
- package/node_modules/@azure/msal-common/README.md +62 -0
- package/node_modules/@azure/msal-common/dist/account/AccountInfo.d.ts +32 -0
- package/node_modules/@azure/msal-common/dist/account/AccountInfo.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/AuthToken.d.ts +21 -0
- package/node_modules/@azure/msal-common/dist/account/AuthToken.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/AuthToken.js +56 -0
- package/node_modules/@azure/msal-common/dist/account/AuthToken.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/CcsCredential.d.ts +9 -0
- package/node_modules/@azure/msal-common/dist/account/CcsCredential.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/CcsCredential.js +14 -0
- package/node_modules/@azure/msal-common/dist/account/CcsCredential.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/ClientCredentials.d.ts +15 -0
- package/node_modules/@azure/msal-common/dist/account/ClientCredentials.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/ClientInfo.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/account/ClientInfo.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/ClientInfo.js +46 -0
- package/node_modules/@azure/msal-common/dist/account/ClientInfo.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/DecodedAuthToken.d.ts +9 -0
- package/node_modules/@azure/msal-common/dist/account/DecodedAuthToken.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/account/TokenClaims.d.ts +66 -0
- package/node_modules/@azure/msal-common/dist/account/TokenClaims.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/Authority.d.ts +216 -0
- package/node_modules/@azure/msal-common/dist/authority/Authority.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/Authority.js +688 -0
- package/node_modules/@azure/msal-common/dist/authority/Authority.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityFactory.d.ts +31 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityFactory.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityFactory.js +58 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityFactory.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.d.ts +623 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.js +881 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityMetadata.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityOptions.d.ts +19 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityOptions.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityOptions.js +24 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityOptions.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityType.d.ts +10 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityType.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityType.js +19 -0
- package/node_modules/@azure/msal-common/dist/authority/AuthorityType.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AzureRegion.d.ts +2 -0
- package/node_modules/@azure/msal-common/dist/authority/AzureRegion.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/AzureRegionConfiguration.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/authority/AzureRegionConfiguration.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudDiscoveryMetadata.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudDiscoveryMetadata.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.js +13 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryErrorResponse.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.d.ts +10 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.js +13 -0
- package/node_modules/@azure/msal-common/dist/authority/CloudInstanceDiscoveryResponse.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/ImdsOptions.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/authority/ImdsOptions.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.d.ts +12 -0
- package/node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.js +15 -0
- package/node_modules/@azure/msal-common/dist/authority/OpenIdConfigResponse.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/ProtocolMode.d.ts +8 -0
- package/node_modules/@azure/msal-common/dist/authority/ProtocolMode.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/ProtocolMode.js +17 -0
- package/node_modules/@azure/msal-common/dist/authority/ProtocolMode.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscovery.d.ts +31 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscovery.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscovery.js +116 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscovery.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscoveryMetadata.d.ts +7 -0
- package/node_modules/@azure/msal-common/dist/authority/RegionDiscoveryMetadata.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts +16 -0
- package/node_modules/@azure/msal-common/dist/broker/nativeBroker/INativeBrokerPlugin.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/CacheManager.d.ts +444 -0
- package/node_modules/@azure/msal-common/dist/cache/CacheManager.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/CacheManager.js +1024 -0
- package/node_modules/@azure/msal-common/dist/cache/CacheManager.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccessTokenEntity.d.ts +57 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccessTokenEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccessTokenEntity.js +123 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccessTokenEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.d.ts +100 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.js +259 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AppMetadataEntity.d.ts +40 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AppMetadataEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AppMetadataEntity.js +73 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AppMetadataEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AuthorityMetadataEntity.d.ts +48 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AuthorityMetadataEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AuthorityMetadataEntity.js +85 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/AuthorityMetadataEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CacheRecord.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CacheRecord.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CacheRecord.js +18 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CacheRecord.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CredentialEntity.d.ts +89 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CredentialEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CredentialEntity.js +144 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/CredentialEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/IdTokenEntity.d.ts +35 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/IdTokenEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/IdTokenEntity.js +64 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/IdTokenEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/RefreshTokenEntity.d.ts +37 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/RefreshTokenEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/RefreshTokenEntity.js +67 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/RefreshTokenEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ServerTelemetryEntity.d.ts +13 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ServerTelemetryEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ServerTelemetryEntity.js +34 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ServerTelemetryEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ThrottlingEntity.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ThrottlingEntity.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ThrottlingEntity.js +30 -0
- package/node_modules/@azure/msal-common/dist/cache/entities/ThrottlingEntity.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ICacheManager.d.ts +166 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ICacheManager.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ICachePlugin.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ICachePlugin.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ISerializableTokenCache.d.ts +5 -0
- package/node_modules/@azure/msal-common/dist/cache/interface/ISerializableTokenCache.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.d.ts +24 -0
- package/node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.js +30 -0
- package/node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/cache/utils/CacheTypes.d.ts +63 -0
- package/node_modules/@azure/msal-common/dist/cache/utils/CacheTypes.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.d.ts +72 -0
- package/node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.js +453 -0
- package/node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/BaseClient.d.ts +51 -0
- package/node_modules/@azure/msal-common/dist/client/BaseClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/BaseClient.js +107 -0
- package/node_modules/@azure/msal-common/dist/client/BaseClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/RefreshTokenClient.d.ts +35 -0
- package/node_modules/@azure/msal-common/dist/client/RefreshTokenClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/RefreshTokenClient.js +260 -0
- package/node_modules/@azure/msal-common/dist/client/RefreshTokenClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/SilentFlowClient.d.ts +25 -0
- package/node_modules/@azure/msal-common/dist/client/SilentFlowClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/client/SilentFlowClient.js +108 -0
- package/node_modules/@azure/msal-common/dist/client/SilentFlowClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/config/AppTokenProvider.d.ts +39 -0
- package/node_modules/@azure/msal-common/dist/config/AppTokenProvider.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/config/ClientConfiguration.d.ts +134 -0
- package/node_modules/@azure/msal-common/dist/config/ClientConfiguration.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/config/ClientConfiguration.js +101 -0
- package/node_modules/@azure/msal-common/dist/config/ClientConfiguration.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/ICrypto.d.ts +63 -0
- package/node_modules/@azure/msal-common/dist/crypto/ICrypto.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/ICrypto.js +49 -0
- package/node_modules/@azure/msal-common/dist/crypto/ICrypto.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/IGuidGenerator.d.ts +5 -0
- package/node_modules/@azure/msal-common/dist/crypto/IGuidGenerator.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/JoseHeader.d.ts +22 -0
- package/node_modules/@azure/msal-common/dist/crypto/JoseHeader.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/JoseHeader.js +44 -0
- package/node_modules/@azure/msal-common/dist/crypto/JoseHeader.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.d.ts +58 -0
- package/node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.js +92 -0
- package/node_modules/@azure/msal-common/dist/crypto/PopTokenGenerator.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/crypto/SignedHttpRequest.d.ts +12 -0
- package/node_modules/@azure/msal-common/dist/crypto/SignedHttpRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/AuthError.d.ts +48 -0
- package/node_modules/@azure/msal-common/dist/error/AuthError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/AuthError.js +58 -0
- package/node_modules/@azure/msal-common/dist/error/AuthError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ClientAuthError.d.ts +413 -0
- package/node_modules/@azure/msal-common/dist/error/ClientAuthError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ClientAuthError.js +526 -0
- package/node_modules/@azure/msal-common/dist/error/ClientAuthError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ClientConfigurationError.d.ts +199 -0
- package/node_modules/@azure/msal-common/dist/error/ClientConfigurationError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ClientConfigurationError.js +256 -0
- package/node_modules/@azure/msal-common/dist/error/ClientConfigurationError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.d.ts +60 -0
- package/node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.js +86 -0
- package/node_modules/@azure/msal-common/dist/error/InteractionRequiredAuthError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/JoseHeaderError.d.ts +29 -0
- package/node_modules/@azure/msal-common/dist/error/JoseHeaderError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/JoseHeaderError.js +46 -0
- package/node_modules/@azure/msal-common/dist/error/JoseHeaderError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ServerError.d.ts +8 -0
- package/node_modules/@azure/msal-common/dist/error/ServerError.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/error/ServerError.js +21 -0
- package/node_modules/@azure/msal-common/dist/error/ServerError.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/index.cjs.js +8975 -0
- package/node_modules/@azure/msal-common/dist/index.cjs.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/index.d.ts +94 -0
- package/node_modules/@azure/msal-common/dist/index.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/index.js +54 -0
- package/node_modules/@azure/msal-common/dist/index.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/logger/Logger.d.ts +96 -0
- package/node_modules/@azure/msal-common/dist/logger/Logger.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/logger/Logger.js +205 -0
- package/node_modules/@azure/msal-common/dist/logger/Logger.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/INetworkModule.d.ts +30 -0
- package/node_modules/@azure/msal-common/dist/network/INetworkModule.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/INetworkModule.js +21 -0
- package/node_modules/@azure/msal-common/dist/network/INetworkModule.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/NetworkManager.d.ts +33 -0
- package/node_modules/@azure/msal-common/dist/network/NetworkManager.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/NetworkManager.js +42 -0
- package/node_modules/@azure/msal-common/dist/network/NetworkManager.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/RequestThumbprint.d.ts +17 -0
- package/node_modules/@azure/msal-common/dist/network/RequestThumbprint.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/ThrottlingUtils.d.ts +42 -0
- package/node_modules/@azure/msal-common/dist/network/ThrottlingUtils.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/network/ThrottlingUtils.js +102 -0
- package/node_modules/@azure/msal-common/dist/network/ThrottlingUtils.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/packageMetadata.d.ts +3 -0
- package/node_modules/@azure/msal-common/dist/packageMetadata.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/packageMetadata.js +8 -0
- package/node_modules/@azure/msal-common/dist/packageMetadata.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/AuthenticationHeaderParser.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/request/AuthenticationHeaderParser.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/AuthenticationHeaderParser.js +63 -0
- package/node_modules/@azure/msal-common/dist/request/AuthenticationHeaderParser.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/BaseAuthRequest.d.ts +38 -0
- package/node_modules/@azure/msal-common/dist/request/BaseAuthRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonAuthorizationCodeRequest.d.ts +28 -0
- package/node_modules/@azure/msal-common/dist/request/CommonAuthorizationCodeRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonAuthorizationUrlRequest.d.ts +51 -0
- package/node_modules/@azure/msal-common/dist/request/CommonAuthorizationUrlRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonClientCredentialRequest.d.ts +18 -0
- package/node_modules/@azure/msal-common/dist/request/CommonClientCredentialRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonDeviceCodeRequest.d.ts +22 -0
- package/node_modules/@azure/msal-common/dist/request/CommonDeviceCodeRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonEndSessionRequest.d.ts +22 -0
- package/node_modules/@azure/msal-common/dist/request/CommonEndSessionRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonOnBehalfOfRequest.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/request/CommonOnBehalfOfRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonRefreshTokenRequest.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/request/CommonRefreshTokenRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonSilentFlowRequest.d.ts +19 -0
- package/node_modules/@azure/msal-common/dist/request/CommonSilentFlowRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/CommonUsernamePasswordRequest.d.ts +18 -0
- package/node_modules/@azure/msal-common/dist/request/CommonUsernamePasswordRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/NativeRequest.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/request/NativeRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/NativeSignOutRequest.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/request/NativeSignOutRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.d.ts +217 -0
- package/node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.js +385 -0
- package/node_modules/@azure/msal-common/dist/request/RequestParameterBuilder.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/RequestValidator.d.ts +34 -0
- package/node_modules/@azure/msal-common/dist/request/RequestValidator.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/RequestValidator.js +92 -0
- package/node_modules/@azure/msal-common/dist/request/RequestValidator.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/ScopeSet.d.ts +89 -0
- package/node_modules/@azure/msal-common/dist/request/ScopeSet.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/request/ScopeSet.js +207 -0
- package/node_modules/@azure/msal-common/dist/request/ScopeSet.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/AuthenticationResult.d.ts +40 -0
- package/node_modules/@azure/msal-common/dist/response/AuthenticationResult.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/AuthorizationCodePayload.d.ts +14 -0
- package/node_modules/@azure/msal-common/dist/response/AuthorizationCodePayload.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/DeviceCodeResponse.d.ts +26 -0
- package/node_modules/@azure/msal-common/dist/response/DeviceCodeResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ExternalTokenResponse.d.ts +16 -0
- package/node_modules/@azure/msal-common/dist/response/ExternalTokenResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/IMDSBadResponse.d.ts +5 -0
- package/node_modules/@azure/msal-common/dist/response/IMDSBadResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ResponseHandler.d.ts +73 -0
- package/node_modules/@azure/msal-common/dist/response/ResponseHandler.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ResponseHandler.js +325 -0
- package/node_modules/@azure/msal-common/dist/response/ResponseHandler.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ServerAuthorizationCodeResponse.d.ts +26 -0
- package/node_modules/@azure/msal-common/dist/response/ServerAuthorizationCodeResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/response/ServerAuthorizationTokenResponse.d.ts +45 -0
- package/node_modules/@azure/msal-common/dist/response/ServerAuthorizationTokenResponse.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/IPerformanceClient.d.ts +43 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/IPerformanceClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/IPerformanceMeasurement.d.ts +6 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/IPerformanceMeasurement.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceClient.d.ts +190 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceClient.js +413 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.d.ts +440 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.js +232 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/PerformanceEvent.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.d.ts +20 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.js +43 -0
- package/node_modules/@azure/msal-common/dist/telemetry/performance/StubPerformanceClient.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.d.ts +66 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.js +206 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryManager.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryRequest.d.ts +9 -0
- package/node_modules/@azure/msal-common/dist/telemetry/server/ServerTelemetryRequest.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/url/IUri.d.ts +13 -0
- package/node_modules/@azure/msal-common/dist/url/IUri.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/url/UrlString.d.ts +71 -0
- package/node_modules/@azure/msal-common/dist/url/UrlString.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/url/UrlString.js +252 -0
- package/node_modules/@azure/msal-common/dist/url/UrlString.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/Constants.d.ts +332 -0
- package/node_modules/@azure/msal-common/dist/utils/Constants.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/Constants.js +378 -0
- package/node_modules/@azure/msal-common/dist/utils/Constants.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/MsalTypes.d.ts +7 -0
- package/node_modules/@azure/msal-common/dist/utils/MsalTypes.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/ProtocolUtils.d.ts +43 -0
- package/node_modules/@azure/msal-common/dist/utils/ProtocolUtils.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/ProtocolUtils.js +80 -0
- package/node_modules/@azure/msal-common/dist/utils/ProtocolUtils.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/StringUtils.d.ts +54 -0
- package/node_modules/@azure/msal-common/dist/utils/StringUtils.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/StringUtils.js +131 -0
- package/node_modules/@azure/msal-common/dist/utils/StringUtils.js.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/TimeUtils.d.ts +28 -0
- package/node_modules/@azure/msal-common/dist/utils/TimeUtils.d.ts.map +1 -0
- package/node_modules/@azure/msal-common/dist/utils/TimeUtils.js +50 -0
- package/node_modules/@azure/msal-common/dist/utils/TimeUtils.js.map +1 -0
- package/node_modules/@azure/msal-common/package.json +79 -0
- package/package.json +99 -95
- package/dist/_virtual/_tslib.js +0 -117
- package/dist/_virtual/_tslib.js.map +0 -1
- package/dist/app/ClientApplication.d.ts.map +0 -1
- package/dist/app/ClientApplication.js +0 -1053
- package/dist/app/ClientApplication.js.map +0 -1
- package/dist/index.cjs.js +0 -18045
- package/dist/index.cjs.js.map +0 -1
- package/lib/msal-browser.js +0 -18051
- package/lib/msal-browser.js.map +0 -1
- package/lib/msal-browser.min.js +0 -70
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/*! @azure/msal-browser
|
|
1
|
+
/*! @azure/msal-browser v3.0.0-alpha.0 2023-05-03 */
|
|
2
2
|
'use strict';
|
|
3
|
-
import {
|
|
4
|
-
import { CredentialType, RefreshTokenEntity, CacheManager, AccessTokenEntity, IdTokenEntity, AccountEntity, ClientAuthError, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, Constants, PersistentCacheKeys, ThrottlingEntity, StringUtils, ProtocolUtils, CcsCredentialType, IdToken, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
|
|
3
|
+
import { CacheManager, CredentialType, RefreshTokenEntity, AccessTokenEntity, IdTokenEntity, AccountEntity, ClientAuthError, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, Constants, PersistentCacheKeys, ThrottlingEntity, StringUtils, ProtocolUtils, IdToken, CcsCredentialType, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
|
|
5
4
|
import { BrowserAuthError } from '../error/BrowserAuthError.js';
|
|
6
5
|
import { BrowserCacheLocation, StaticCacheKeys, InMemoryCacheKeys, TemporaryCacheKeys } from '../utils/BrowserConstants.js';
|
|
7
6
|
import { BrowserStorage } from './BrowserStorage.js';
|
|
@@ -17,29 +16,27 @@ import { BrowserProtocolUtils } from '../utils/BrowserProtocolUtils.js';
|
|
|
17
16
|
* Cookies are only used if storeAuthStateInCookie is true, and are only used for
|
|
18
17
|
* parameters such as state and nonce, generally.
|
|
19
18
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _this = _super.call(this, clientId, cryptoImpl, logger) || this;
|
|
19
|
+
class BrowserCacheManager extends CacheManager {
|
|
20
|
+
constructor(clientId, cacheConfig, cryptoImpl, logger) {
|
|
21
|
+
super(clientId, cryptoImpl, logger);
|
|
24
22
|
// Cookie life calculation (hours * minutes * seconds * ms)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
this.COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;
|
|
24
|
+
this.cacheConfig = cacheConfig;
|
|
25
|
+
this.logger = logger;
|
|
26
|
+
this.internalStorage = new MemoryStorage();
|
|
27
|
+
this.browserStorage = this.setupBrowserStorage(this.cacheConfig.cacheLocation);
|
|
28
|
+
this.temporaryCacheStorage = this.setupTemporaryCacheStorage(this.cacheConfig.temporaryCacheLocation, this.cacheConfig.cacheLocation);
|
|
31
29
|
// Migrate cache entries from older versions of MSAL.
|
|
32
30
|
if (cacheConfig.cacheMigrationEnabled) {
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
this.migrateCacheEntries();
|
|
32
|
+
this.createKeyMaps();
|
|
35
33
|
}
|
|
36
|
-
return _this;
|
|
37
34
|
}
|
|
38
35
|
/**
|
|
39
36
|
* Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured cacheLocation.
|
|
40
37
|
* @param cacheLocation
|
|
41
38
|
*/
|
|
42
|
-
|
|
39
|
+
setupBrowserStorage(cacheLocation) {
|
|
43
40
|
switch (cacheLocation) {
|
|
44
41
|
case BrowserCacheLocation.LocalStorage:
|
|
45
42
|
case BrowserCacheLocation.SessionStorage:
|
|
@@ -53,22 +50,20 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
53
50
|
}
|
|
54
51
|
this.cacheConfig.cacheLocation = BrowserCacheLocation.MemoryStorage;
|
|
55
52
|
return new MemoryStorage();
|
|
56
|
-
}
|
|
53
|
+
}
|
|
57
54
|
/**
|
|
58
55
|
* Returns a window storage class implementing the IWindowStorage interface that corresponds to the configured temporaryCacheLocation.
|
|
59
56
|
* @param temporaryCacheLocation
|
|
60
57
|
* @param cacheLocation
|
|
61
58
|
*/
|
|
62
|
-
|
|
59
|
+
setupTemporaryCacheStorage(temporaryCacheLocation, cacheLocation) {
|
|
63
60
|
switch (cacheLocation) {
|
|
64
61
|
case BrowserCacheLocation.LocalStorage:
|
|
65
62
|
case BrowserCacheLocation.SessionStorage:
|
|
66
63
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
*/
|
|
71
|
-
return new BrowserStorage(temporaryCacheLocation || BrowserCacheLocation.SessionStorage);
|
|
64
|
+
// Temporary cache items will always be stored in session storage to mitigate problems caused by multiple tabs
|
|
65
|
+
return new BrowserStorage(temporaryCacheLocation ||
|
|
66
|
+
BrowserCacheLocation.SessionStorage);
|
|
72
67
|
}
|
|
73
68
|
catch (e) {
|
|
74
69
|
this.logger.verbose(e);
|
|
@@ -78,101 +73,109 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
78
73
|
default:
|
|
79
74
|
return this.internalStorage;
|
|
80
75
|
}
|
|
81
|
-
}
|
|
76
|
+
}
|
|
82
77
|
/**
|
|
83
78
|
* Migrate all old cache entries to new schema. No rollback supported.
|
|
84
79
|
* @param storeAuthStateInCookie
|
|
85
80
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
81
|
+
migrateCacheEntries() {
|
|
82
|
+
const idTokenKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.ID_TOKEN}`;
|
|
83
|
+
const clientInfoKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.CLIENT_INFO}`;
|
|
84
|
+
const errorKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.ERROR}`;
|
|
85
|
+
const errorDescKey = `${Constants.CACHE_PREFIX}.${PersistentCacheKeys.ERROR_DESC}`;
|
|
86
|
+
const idTokenValue = this.browserStorage.getItem(idTokenKey);
|
|
87
|
+
const clientInfoValue = this.browserStorage.getItem(clientInfoKey);
|
|
88
|
+
const errorValue = this.browserStorage.getItem(errorKey);
|
|
89
|
+
const errorDescValue = this.browserStorage.getItem(errorDescKey);
|
|
90
|
+
const values = [
|
|
91
|
+
idTokenValue,
|
|
92
|
+
clientInfoValue,
|
|
93
|
+
errorValue,
|
|
94
|
+
errorDescValue,
|
|
95
|
+
];
|
|
96
|
+
const keysToMigrate = [
|
|
97
|
+
PersistentCacheKeys.ID_TOKEN,
|
|
98
|
+
PersistentCacheKeys.CLIENT_INFO,
|
|
99
|
+
PersistentCacheKeys.ERROR,
|
|
100
|
+
PersistentCacheKeys.ERROR_DESC,
|
|
101
|
+
];
|
|
102
|
+
keysToMigrate.forEach((cacheKey, index) => this.migrateCacheEntry(cacheKey, values[index]));
|
|
103
|
+
}
|
|
100
104
|
/**
|
|
101
105
|
* Utility function to help with migration.
|
|
102
106
|
* @param newKey
|
|
103
107
|
* @param value
|
|
104
108
|
* @param storeAuthStateInCookie
|
|
105
109
|
*/
|
|
106
|
-
|
|
110
|
+
migrateCacheEntry(newKey, value) {
|
|
107
111
|
if (value) {
|
|
108
112
|
this.setTemporaryCache(newKey, value, true);
|
|
109
113
|
}
|
|
110
|
-
}
|
|
114
|
+
}
|
|
111
115
|
/**
|
|
112
116
|
* Searches all cache entries for MSAL accounts and creates the account key map
|
|
113
117
|
* This is used to migrate users from older versions of MSAL which did not create the map.
|
|
114
118
|
* @returns
|
|
115
119
|
*/
|
|
116
|
-
|
|
117
|
-
var _this = this;
|
|
120
|
+
createKeyMaps() {
|
|
118
121
|
this.logger.trace("BrowserCacheManager - createKeyMaps called.");
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
const accountKeys = this.getItem(StaticCacheKeys.ACCOUNT_KEYS);
|
|
123
|
+
const tokenKeys = this.getItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`);
|
|
121
124
|
if (accountKeys && tokenKeys) {
|
|
122
125
|
this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");
|
|
123
126
|
// Key maps already exist, no need to iterate through cache
|
|
124
127
|
return;
|
|
125
128
|
}
|
|
126
|
-
|
|
127
|
-
allKeys.forEach(
|
|
128
|
-
if (
|
|
129
|
+
const allKeys = this.browserStorage.getKeys();
|
|
130
|
+
allKeys.forEach((key) => {
|
|
131
|
+
if (this.isCredentialKey(key)) {
|
|
129
132
|
// Get item, parse, validate and write key to map
|
|
130
|
-
|
|
133
|
+
const value = this.getItem(key);
|
|
131
134
|
if (value) {
|
|
132
|
-
|
|
135
|
+
const credObj = this.validateAndParseJson(value);
|
|
133
136
|
if (credObj && credObj.hasOwnProperty("credentialType")) {
|
|
134
137
|
switch (credObj["credentialType"]) {
|
|
135
138
|
case CredentialType.ID_TOKEN:
|
|
136
139
|
if (IdTokenEntity.isIdTokenEntity(credObj)) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map");
|
|
141
|
+
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - idToken with key: ${key} found, saving key to token key map`);
|
|
142
|
+
const idTokenEntity = CacheManager.toObject(new IdTokenEntity(), credObj);
|
|
143
|
+
const newKey = this.updateCredentialCacheKey(key, idTokenEntity);
|
|
144
|
+
this.addTokenKey(newKey, CredentialType.ID_TOKEN);
|
|
142
145
|
return;
|
|
143
146
|
}
|
|
144
147
|
else {
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping.");
|
|
149
|
+
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed idToken validation on key: ${key}`);
|
|
147
150
|
}
|
|
148
151
|
break;
|
|
149
152
|
case CredentialType.ACCESS_TOKEN:
|
|
150
153
|
case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
|
|
151
154
|
if (AccessTokenEntity.isAccessTokenEntity(credObj)) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map");
|
|
156
|
+
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - accessToken with key: ${key} found, saving key to token key map`);
|
|
157
|
+
const accessTokenEntity = CacheManager.toObject(new AccessTokenEntity(), credObj);
|
|
158
|
+
const newKey = this.updateCredentialCacheKey(key, accessTokenEntity);
|
|
159
|
+
this.addTokenKey(newKey, CredentialType.ACCESS_TOKEN);
|
|
157
160
|
return;
|
|
158
161
|
}
|
|
159
162
|
else {
|
|
160
|
-
|
|
161
|
-
|
|
163
|
+
this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping.");
|
|
164
|
+
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed accessToken validation on key: ${key}`);
|
|
162
165
|
}
|
|
163
166
|
break;
|
|
164
167
|
case CredentialType.REFRESH_TOKEN:
|
|
165
168
|
if (RefreshTokenEntity.isRefreshTokenEntity(credObj)) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map");
|
|
170
|
+
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - refreshToken with key: ${key} found, saving key to token key map`);
|
|
171
|
+
const refreshTokenEntity = CacheManager.toObject(new RefreshTokenEntity(), credObj);
|
|
172
|
+
const newKey = this.updateCredentialCacheKey(key, refreshTokenEntity);
|
|
173
|
+
this.addTokenKey(newKey, CredentialType.REFRESH_TOKEN);
|
|
171
174
|
return;
|
|
172
175
|
}
|
|
173
176
|
else {
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping.");
|
|
178
|
+
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: ${key}`);
|
|
176
179
|
}
|
|
177
180
|
break;
|
|
178
181
|
// If credentialType isn't one of our predefined ones, it may not be an MSAL cache value. Ignore.
|
|
@@ -180,103 +183,106 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
180
183
|
}
|
|
181
184
|
}
|
|
182
185
|
}
|
|
183
|
-
if (
|
|
184
|
-
|
|
186
|
+
if (this.isAccountKey(key)) {
|
|
187
|
+
const value = this.getItem(key);
|
|
185
188
|
if (value) {
|
|
186
|
-
|
|
187
|
-
if (accountObj &&
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
const accountObj = this.validateAndParseJson(value);
|
|
190
|
+
if (accountObj &&
|
|
191
|
+
AccountEntity.isAccountEntity(accountObj)) {
|
|
192
|
+
this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map");
|
|
193
|
+
this.logger.tracePii(`BrowserCacheManager:createKeyMaps - account with key: ${key} found, saving key to account key map`);
|
|
194
|
+
this.addAccountKeyToMap(key);
|
|
191
195
|
}
|
|
192
196
|
}
|
|
193
197
|
}
|
|
194
198
|
});
|
|
195
|
-
}
|
|
199
|
+
}
|
|
196
200
|
/**
|
|
197
201
|
* Parses passed value as JSON object, JSON.parse() will throw an error.
|
|
198
202
|
* @param input
|
|
199
203
|
*/
|
|
200
|
-
|
|
204
|
+
validateAndParseJson(jsonValue) {
|
|
201
205
|
try {
|
|
202
|
-
|
|
206
|
+
const parsedJson = JSON.parse(jsonValue);
|
|
203
207
|
/**
|
|
204
208
|
* There are edge cases in which JSON.parse will successfully parse a non-valid JSON object
|
|
205
209
|
* (e.g. JSON.parse will parse an escaped string into an unescaped string), so adding a type check
|
|
206
210
|
* of the parsed value is necessary in order to be certain that the string represents a valid JSON object.
|
|
207
211
|
*
|
|
208
212
|
*/
|
|
209
|
-
return
|
|
213
|
+
return parsedJson && typeof parsedJson === "object"
|
|
214
|
+
? parsedJson
|
|
215
|
+
: null;
|
|
210
216
|
}
|
|
211
217
|
catch (error) {
|
|
212
218
|
return null;
|
|
213
219
|
}
|
|
214
|
-
}
|
|
220
|
+
}
|
|
215
221
|
/**
|
|
216
222
|
* fetches the entry from the browser storage based off the key
|
|
217
223
|
* @param key
|
|
218
224
|
*/
|
|
219
|
-
|
|
225
|
+
getItem(key) {
|
|
220
226
|
return this.browserStorage.getItem(key);
|
|
221
|
-
}
|
|
227
|
+
}
|
|
222
228
|
/**
|
|
223
229
|
* sets the entry in the browser storage
|
|
224
230
|
* @param key
|
|
225
231
|
* @param value
|
|
226
232
|
*/
|
|
227
|
-
|
|
233
|
+
setItem(key, value) {
|
|
228
234
|
this.browserStorage.setItem(key, value);
|
|
229
|
-
}
|
|
235
|
+
}
|
|
230
236
|
/**
|
|
231
237
|
* fetch the account entity from the platform cache
|
|
232
238
|
* @param accountKey
|
|
233
239
|
*/
|
|
234
|
-
|
|
240
|
+
getAccount(accountKey) {
|
|
235
241
|
this.logger.trace("BrowserCacheManager.getAccount called");
|
|
236
|
-
|
|
242
|
+
const account = this.getItem(accountKey);
|
|
237
243
|
if (!account) {
|
|
238
244
|
this.removeAccountKeyFromMap(accountKey);
|
|
239
245
|
return null;
|
|
240
246
|
}
|
|
241
|
-
|
|
247
|
+
const parsedAccount = this.validateAndParseJson(account);
|
|
242
248
|
if (!parsedAccount || !AccountEntity.isAccountEntity(parsedAccount)) {
|
|
243
249
|
this.removeAccountKeyFromMap(accountKey);
|
|
244
250
|
return null;
|
|
245
251
|
}
|
|
246
252
|
return CacheManager.toObject(new AccountEntity(), parsedAccount);
|
|
247
|
-
}
|
|
253
|
+
}
|
|
248
254
|
/**
|
|
249
255
|
* set account entity in the platform cache
|
|
250
256
|
* @param key
|
|
251
257
|
* @param value
|
|
252
258
|
*/
|
|
253
|
-
|
|
259
|
+
setAccount(account) {
|
|
254
260
|
this.logger.trace("BrowserCacheManager.setAccount called");
|
|
255
|
-
|
|
261
|
+
const key = account.generateAccountKey();
|
|
256
262
|
this.setItem(key, JSON.stringify(account));
|
|
257
263
|
this.addAccountKeyToMap(key);
|
|
258
|
-
}
|
|
264
|
+
}
|
|
259
265
|
/**
|
|
260
266
|
* Returns the array of account keys currently cached
|
|
261
267
|
* @returns
|
|
262
268
|
*/
|
|
263
|
-
|
|
269
|
+
getAccountKeys() {
|
|
264
270
|
this.logger.trace("BrowserCacheManager.getAccountKeys called");
|
|
265
|
-
|
|
271
|
+
const accountKeys = this.getItem(StaticCacheKeys.ACCOUNT_KEYS);
|
|
266
272
|
if (accountKeys) {
|
|
267
273
|
return JSON.parse(accountKeys);
|
|
268
274
|
}
|
|
269
275
|
this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found");
|
|
270
276
|
return [];
|
|
271
|
-
}
|
|
277
|
+
}
|
|
272
278
|
/**
|
|
273
279
|
* Add a new account to the key map
|
|
274
280
|
* @param key
|
|
275
281
|
*/
|
|
276
|
-
|
|
282
|
+
addAccountKeyToMap(key) {
|
|
277
283
|
this.logger.trace("BrowserCacheManager.addAccountKeyToMap called");
|
|
278
|
-
this.logger.tracePii(
|
|
279
|
-
|
|
284
|
+
this.logger.tracePii(`BrowserCacheManager.addAccountKeyToMap called with key: ${key}`);
|
|
285
|
+
const accountKeys = this.getAccountKeys();
|
|
280
286
|
if (accountKeys.indexOf(key) === -1) {
|
|
281
287
|
// Only add key if it does not already exist in the map
|
|
282
288
|
accountKeys.push(key);
|
|
@@ -286,16 +292,16 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
286
292
|
else {
|
|
287
293
|
this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map");
|
|
288
294
|
}
|
|
289
|
-
}
|
|
295
|
+
}
|
|
290
296
|
/**
|
|
291
297
|
* Remove an account from the key map
|
|
292
298
|
* @param key
|
|
293
299
|
*/
|
|
294
|
-
|
|
300
|
+
removeAccountKeyFromMap(key) {
|
|
295
301
|
this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called");
|
|
296
|
-
this.logger.tracePii(
|
|
297
|
-
|
|
298
|
-
|
|
302
|
+
this.logger.tracePii(`BrowserCacheManager.removeAccountKeyFromMap called with key: ${key}`);
|
|
303
|
+
const accountKeys = this.getAccountKeys();
|
|
304
|
+
const removalIndex = accountKeys.indexOf(key);
|
|
299
305
|
if (removalIndex > -1) {
|
|
300
306
|
accountKeys.splice(removalIndex, 1);
|
|
301
307
|
this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
|
|
@@ -304,58 +310,48 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
304
310
|
else {
|
|
305
311
|
this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map");
|
|
306
312
|
}
|
|
307
|
-
}
|
|
313
|
+
}
|
|
308
314
|
/**
|
|
309
315
|
* Extends inherited removeAccount function to include removal of the account key from the map
|
|
310
316
|
* @param key
|
|
311
317
|
*/
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
this.removeAccountKeyFromMap(key);
|
|
317
|
-
return [2 /*return*/];
|
|
318
|
-
});
|
|
319
|
-
});
|
|
320
|
-
};
|
|
318
|
+
async removeAccount(key) {
|
|
319
|
+
super.removeAccount(key);
|
|
320
|
+
this.removeAccountKeyFromMap(key);
|
|
321
|
+
}
|
|
321
322
|
/**
|
|
322
323
|
* Removes given idToken from the cache and from the key map
|
|
323
324
|
* @param key
|
|
324
325
|
*/
|
|
325
|
-
|
|
326
|
-
|
|
326
|
+
removeIdToken(key) {
|
|
327
|
+
super.removeIdToken(key);
|
|
327
328
|
this.removeTokenKey(key, CredentialType.ID_TOKEN);
|
|
328
|
-
}
|
|
329
|
+
}
|
|
329
330
|
/**
|
|
330
331
|
* Removes given accessToken from the cache and from the key map
|
|
331
332
|
* @param key
|
|
332
333
|
*/
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
this.removeTokenKey(key, CredentialType.ACCESS_TOKEN);
|
|
338
|
-
return [2 /*return*/];
|
|
339
|
-
});
|
|
340
|
-
});
|
|
341
|
-
};
|
|
334
|
+
async removeAccessToken(key) {
|
|
335
|
+
super.removeAccessToken(key);
|
|
336
|
+
this.removeTokenKey(key, CredentialType.ACCESS_TOKEN);
|
|
337
|
+
}
|
|
342
338
|
/**
|
|
343
339
|
* Removes given refreshToken from the cache and from the key map
|
|
344
340
|
* @param key
|
|
345
341
|
*/
|
|
346
|
-
|
|
347
|
-
|
|
342
|
+
removeRefreshToken(key) {
|
|
343
|
+
super.removeRefreshToken(key);
|
|
348
344
|
this.removeTokenKey(key, CredentialType.REFRESH_TOKEN);
|
|
349
|
-
}
|
|
345
|
+
}
|
|
350
346
|
/**
|
|
351
347
|
* Gets the keys for the cached tokens associated with this clientId
|
|
352
348
|
* @returns
|
|
353
349
|
*/
|
|
354
|
-
|
|
350
|
+
getTokenKeys() {
|
|
355
351
|
this.logger.trace("BrowserCacheManager.getTokenKeys called");
|
|
356
|
-
|
|
352
|
+
const item = this.getItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`);
|
|
357
353
|
if (item) {
|
|
358
|
-
|
|
354
|
+
const tokenKeys = this.validateAndParseJson(item);
|
|
359
355
|
if (tokenKeys &&
|
|
360
356
|
tokenKeys.hasOwnProperty("idToken") &&
|
|
361
357
|
tokenKeys.hasOwnProperty("accessToken") &&
|
|
@@ -372,17 +368,17 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
372
368
|
return {
|
|
373
369
|
idToken: [],
|
|
374
370
|
accessToken: [],
|
|
375
|
-
refreshToken: []
|
|
371
|
+
refreshToken: [],
|
|
376
372
|
};
|
|
377
|
-
}
|
|
373
|
+
}
|
|
378
374
|
/**
|
|
379
375
|
* Adds the given key to the token key map
|
|
380
376
|
* @param key
|
|
381
377
|
* @param type
|
|
382
378
|
*/
|
|
383
|
-
|
|
379
|
+
addTokenKey(key, type) {
|
|
384
380
|
this.logger.trace("BrowserCacheManager addTokenKey called");
|
|
385
|
-
|
|
381
|
+
const tokenKeys = this.getTokenKeys();
|
|
386
382
|
switch (type) {
|
|
387
383
|
case CredentialType.ID_TOKEN:
|
|
388
384
|
if (tokenKeys.idToken.indexOf(key) === -1) {
|
|
@@ -403,23 +399,23 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
403
399
|
}
|
|
404
400
|
break;
|
|
405
401
|
default:
|
|
406
|
-
this.logger.error(
|
|
402
|
+
this.logger.error(`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${type}`);
|
|
407
403
|
ClientAuthError.createUnexpectedCredentialTypeError();
|
|
408
404
|
}
|
|
409
|
-
this.setItem(StaticCacheKeys.TOKEN_KEYS
|
|
410
|
-
}
|
|
405
|
+
this.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys));
|
|
406
|
+
}
|
|
411
407
|
/**
|
|
412
408
|
* Removes the given key from the token key map
|
|
413
409
|
* @param key
|
|
414
410
|
* @param type
|
|
415
411
|
*/
|
|
416
|
-
|
|
412
|
+
removeTokenKey(key, type) {
|
|
417
413
|
this.logger.trace("BrowserCacheManager removeTokenKey called");
|
|
418
|
-
|
|
414
|
+
const tokenKeys = this.getTokenKeys();
|
|
419
415
|
switch (type) {
|
|
420
416
|
case CredentialType.ID_TOKEN:
|
|
421
|
-
this.logger.infoPii(
|
|
422
|
-
|
|
417
|
+
this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: ${key} from map`);
|
|
418
|
+
const idRemoval = tokenKeys.idToken.indexOf(key);
|
|
423
419
|
if (idRemoval > -1) {
|
|
424
420
|
this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map");
|
|
425
421
|
tokenKeys.idToken.splice(idRemoval, 1);
|
|
@@ -429,8 +425,8 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
429
425
|
}
|
|
430
426
|
break;
|
|
431
427
|
case CredentialType.ACCESS_TOKEN:
|
|
432
|
-
this.logger.infoPii(
|
|
433
|
-
|
|
428
|
+
this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: ${key} from map`);
|
|
429
|
+
const accessRemoval = tokenKeys.accessToken.indexOf(key);
|
|
434
430
|
if (accessRemoval > -1) {
|
|
435
431
|
this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map");
|
|
436
432
|
tokenKeys.accessToken.splice(accessRemoval, 1);
|
|
@@ -440,8 +436,8 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
440
436
|
}
|
|
441
437
|
break;
|
|
442
438
|
case CredentialType.REFRESH_TOKEN:
|
|
443
|
-
this.logger.infoPii(
|
|
444
|
-
|
|
439
|
+
this.logger.infoPii(`BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: ${key} from map`);
|
|
440
|
+
const refreshRemoval = tokenKeys.refreshToken.indexOf(key);
|
|
445
441
|
if (refreshRemoval > -1) {
|
|
446
442
|
this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map");
|
|
447
443
|
tokenKeys.refreshToken.splice(refreshRemoval, 1);
|
|
@@ -451,23 +447,23 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
451
447
|
}
|
|
452
448
|
break;
|
|
453
449
|
default:
|
|
454
|
-
this.logger.error(
|
|
450
|
+
this.logger.error(`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${type}`);
|
|
455
451
|
ClientAuthError.createUnexpectedCredentialTypeError();
|
|
456
452
|
}
|
|
457
|
-
this.setItem(StaticCacheKeys.TOKEN_KEYS
|
|
458
|
-
}
|
|
453
|
+
this.setItem(`${StaticCacheKeys.TOKEN_KEYS}.${this.clientId}`, JSON.stringify(tokenKeys));
|
|
454
|
+
}
|
|
459
455
|
/**
|
|
460
456
|
* generates idToken entity from a string
|
|
461
457
|
* @param idTokenKey
|
|
462
458
|
*/
|
|
463
|
-
|
|
464
|
-
|
|
459
|
+
getIdTokenCredential(idTokenKey) {
|
|
460
|
+
const value = this.getItem(idTokenKey);
|
|
465
461
|
if (!value) {
|
|
466
462
|
this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit");
|
|
467
463
|
this.removeTokenKey(idTokenKey, CredentialType.ID_TOKEN);
|
|
468
464
|
return null;
|
|
469
465
|
}
|
|
470
|
-
|
|
466
|
+
const parsedIdToken = this.validateAndParseJson(value);
|
|
471
467
|
if (!parsedIdToken || !IdTokenEntity.isIdTokenEntity(parsedIdToken)) {
|
|
472
468
|
this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit");
|
|
473
469
|
this.removeTokenKey(idTokenKey, CredentialType.ID_TOKEN);
|
|
@@ -475,198 +471,206 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
475
471
|
}
|
|
476
472
|
this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit");
|
|
477
473
|
return CacheManager.toObject(new IdTokenEntity(), parsedIdToken);
|
|
478
|
-
}
|
|
474
|
+
}
|
|
479
475
|
/**
|
|
480
476
|
* set IdToken credential to the platform cache
|
|
481
477
|
* @param idToken
|
|
482
478
|
*/
|
|
483
|
-
|
|
479
|
+
setIdTokenCredential(idToken) {
|
|
484
480
|
this.logger.trace("BrowserCacheManager.setIdTokenCredential called");
|
|
485
|
-
|
|
481
|
+
const idTokenKey = idToken.generateCredentialKey();
|
|
486
482
|
this.setItem(idTokenKey, JSON.stringify(idToken));
|
|
487
483
|
this.addTokenKey(idTokenKey, CredentialType.ID_TOKEN);
|
|
488
|
-
}
|
|
484
|
+
}
|
|
489
485
|
/**
|
|
490
486
|
* generates accessToken entity from a string
|
|
491
487
|
* @param key
|
|
492
488
|
*/
|
|
493
|
-
|
|
494
|
-
|
|
489
|
+
getAccessTokenCredential(accessTokenKey) {
|
|
490
|
+
const value = this.getItem(accessTokenKey);
|
|
495
491
|
if (!value) {
|
|
496
492
|
this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit");
|
|
497
493
|
this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
|
|
498
494
|
return null;
|
|
499
495
|
}
|
|
500
|
-
|
|
501
|
-
if (!parsedAccessToken ||
|
|
496
|
+
const parsedAccessToken = this.validateAndParseJson(value);
|
|
497
|
+
if (!parsedAccessToken ||
|
|
498
|
+
!AccessTokenEntity.isAccessTokenEntity(parsedAccessToken)) {
|
|
502
499
|
this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit");
|
|
503
500
|
this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
|
|
504
501
|
return null;
|
|
505
502
|
}
|
|
506
503
|
this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit");
|
|
507
504
|
return CacheManager.toObject(new AccessTokenEntity(), parsedAccessToken);
|
|
508
|
-
}
|
|
505
|
+
}
|
|
509
506
|
/**
|
|
510
507
|
* set accessToken credential to the platform cache
|
|
511
508
|
* @param accessToken
|
|
512
509
|
*/
|
|
513
|
-
|
|
510
|
+
setAccessTokenCredential(accessToken) {
|
|
514
511
|
this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");
|
|
515
|
-
|
|
512
|
+
const accessTokenKey = accessToken.generateCredentialKey();
|
|
516
513
|
this.setItem(accessTokenKey, JSON.stringify(accessToken));
|
|
517
514
|
this.addTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
|
|
518
|
-
}
|
|
515
|
+
}
|
|
519
516
|
/**
|
|
520
517
|
* generates refreshToken entity from a string
|
|
521
518
|
* @param refreshTokenKey
|
|
522
519
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
520
|
+
getRefreshTokenCredential(refreshTokenKey) {
|
|
521
|
+
const value = this.getItem(refreshTokenKey);
|
|
525
522
|
if (!value) {
|
|
526
523
|
this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit");
|
|
527
524
|
this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
|
|
528
525
|
return null;
|
|
529
526
|
}
|
|
530
|
-
|
|
531
|
-
if (!parsedRefreshToken ||
|
|
527
|
+
const parsedRefreshToken = this.validateAndParseJson(value);
|
|
528
|
+
if (!parsedRefreshToken ||
|
|
529
|
+
!RefreshTokenEntity.isRefreshTokenEntity(parsedRefreshToken)) {
|
|
532
530
|
this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit");
|
|
533
531
|
this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
|
|
534
532
|
return null;
|
|
535
533
|
}
|
|
536
534
|
this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit");
|
|
537
535
|
return CacheManager.toObject(new RefreshTokenEntity(), parsedRefreshToken);
|
|
538
|
-
}
|
|
536
|
+
}
|
|
539
537
|
/**
|
|
540
538
|
* set refreshToken credential to the platform cache
|
|
541
539
|
* @param refreshToken
|
|
542
540
|
*/
|
|
543
|
-
|
|
541
|
+
setRefreshTokenCredential(refreshToken) {
|
|
544
542
|
this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");
|
|
545
|
-
|
|
543
|
+
const refreshTokenKey = refreshToken.generateCredentialKey();
|
|
546
544
|
this.setItem(refreshTokenKey, JSON.stringify(refreshToken));
|
|
547
545
|
this.addTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
|
|
548
|
-
}
|
|
546
|
+
}
|
|
549
547
|
/**
|
|
550
548
|
* fetch appMetadata entity from the platform cache
|
|
551
549
|
* @param appMetadataKey
|
|
552
550
|
*/
|
|
553
|
-
|
|
554
|
-
|
|
551
|
+
getAppMetadata(appMetadataKey) {
|
|
552
|
+
const value = this.getItem(appMetadataKey);
|
|
555
553
|
if (!value) {
|
|
556
554
|
this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit");
|
|
557
555
|
return null;
|
|
558
556
|
}
|
|
559
|
-
|
|
560
|
-
if (!parsedMetadata ||
|
|
557
|
+
const parsedMetadata = this.validateAndParseJson(value);
|
|
558
|
+
if (!parsedMetadata ||
|
|
559
|
+
!AppMetadataEntity.isAppMetadataEntity(appMetadataKey, parsedMetadata)) {
|
|
561
560
|
this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit");
|
|
562
561
|
return null;
|
|
563
562
|
}
|
|
564
563
|
this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit");
|
|
565
564
|
return CacheManager.toObject(new AppMetadataEntity(), parsedMetadata);
|
|
566
|
-
}
|
|
565
|
+
}
|
|
567
566
|
/**
|
|
568
567
|
* set appMetadata entity to the platform cache
|
|
569
568
|
* @param appMetadata
|
|
570
569
|
*/
|
|
571
|
-
|
|
570
|
+
setAppMetadata(appMetadata) {
|
|
572
571
|
this.logger.trace("BrowserCacheManager.setAppMetadata called");
|
|
573
|
-
|
|
572
|
+
const appMetadataKey = appMetadata.generateAppMetadataKey();
|
|
574
573
|
this.setItem(appMetadataKey, JSON.stringify(appMetadata));
|
|
575
|
-
}
|
|
574
|
+
}
|
|
576
575
|
/**
|
|
577
576
|
* fetch server telemetry entity from the platform cache
|
|
578
577
|
* @param serverTelemetryKey
|
|
579
578
|
*/
|
|
580
|
-
|
|
581
|
-
|
|
579
|
+
getServerTelemetry(serverTelemetryKey) {
|
|
580
|
+
const value = this.getItem(serverTelemetryKey);
|
|
582
581
|
if (!value) {
|
|
583
582
|
this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit");
|
|
584
583
|
return null;
|
|
585
584
|
}
|
|
586
|
-
|
|
587
|
-
if (!parsedMetadata ||
|
|
585
|
+
const parsedMetadata = this.validateAndParseJson(value);
|
|
586
|
+
if (!parsedMetadata ||
|
|
587
|
+
!ServerTelemetryEntity.isServerTelemetryEntity(serverTelemetryKey, parsedMetadata)) {
|
|
588
588
|
this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit");
|
|
589
589
|
return null;
|
|
590
590
|
}
|
|
591
591
|
this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit");
|
|
592
592
|
return CacheManager.toObject(new ServerTelemetryEntity(), parsedMetadata);
|
|
593
|
-
}
|
|
593
|
+
}
|
|
594
594
|
/**
|
|
595
595
|
* set server telemetry entity to the platform cache
|
|
596
596
|
* @param serverTelemetryKey
|
|
597
597
|
* @param serverTelemetry
|
|
598
598
|
*/
|
|
599
|
-
|
|
599
|
+
setServerTelemetry(serverTelemetryKey, serverTelemetry) {
|
|
600
600
|
this.logger.trace("BrowserCacheManager.setServerTelemetry called");
|
|
601
601
|
this.setItem(serverTelemetryKey, JSON.stringify(serverTelemetry));
|
|
602
|
-
}
|
|
602
|
+
}
|
|
603
603
|
/**
|
|
604
604
|
*
|
|
605
605
|
*/
|
|
606
|
-
|
|
607
|
-
|
|
606
|
+
getAuthorityMetadata(key) {
|
|
607
|
+
const value = this.internalStorage.getItem(key);
|
|
608
608
|
if (!value) {
|
|
609
609
|
this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit");
|
|
610
610
|
return null;
|
|
611
611
|
}
|
|
612
|
-
|
|
613
|
-
if (parsedMetadata &&
|
|
612
|
+
const parsedMetadata = this.validateAndParseJson(value);
|
|
613
|
+
if (parsedMetadata &&
|
|
614
|
+
AuthorityMetadataEntity.isAuthorityMetadataEntity(key, parsedMetadata)) {
|
|
614
615
|
this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit");
|
|
615
616
|
return CacheManager.toObject(new AuthorityMetadataEntity(), parsedMetadata);
|
|
616
617
|
}
|
|
617
618
|
return null;
|
|
618
|
-
}
|
|
619
|
+
}
|
|
619
620
|
/**
|
|
620
621
|
*
|
|
621
622
|
*/
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
return _this.isAuthorityMetadata(key);
|
|
623
|
+
getAuthorityMetadataKeys() {
|
|
624
|
+
const allKeys = this.internalStorage.getKeys();
|
|
625
|
+
return allKeys.filter((key) => {
|
|
626
|
+
return this.isAuthorityMetadata(key);
|
|
627
627
|
});
|
|
628
|
-
}
|
|
628
|
+
}
|
|
629
629
|
/**
|
|
630
630
|
* Sets wrapper metadata in memory
|
|
631
631
|
* @param wrapperSKU
|
|
632
632
|
* @param wrapperVersion
|
|
633
633
|
*/
|
|
634
|
-
|
|
634
|
+
setWrapperMetadata(wrapperSKU, wrapperVersion) {
|
|
635
635
|
this.internalStorage.setItem(InMemoryCacheKeys.WRAPPER_SKU, wrapperSKU);
|
|
636
636
|
this.internalStorage.setItem(InMemoryCacheKeys.WRAPPER_VER, wrapperVersion);
|
|
637
|
-
}
|
|
637
|
+
}
|
|
638
638
|
/**
|
|
639
639
|
* Returns wrapper metadata from in-memory storage
|
|
640
640
|
*/
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
641
|
+
getWrapperMetadata() {
|
|
642
|
+
const sku = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_SKU) ||
|
|
643
|
+
Constants.EMPTY_STRING;
|
|
644
|
+
const version = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_VER) ||
|
|
645
|
+
Constants.EMPTY_STRING;
|
|
644
646
|
return [sku, version];
|
|
645
|
-
}
|
|
647
|
+
}
|
|
646
648
|
/**
|
|
647
649
|
*
|
|
648
650
|
* @param entity
|
|
649
651
|
*/
|
|
650
|
-
|
|
652
|
+
setAuthorityMetadata(key, entity) {
|
|
651
653
|
this.logger.trace("BrowserCacheManager.setAuthorityMetadata called");
|
|
652
654
|
this.internalStorage.setItem(key, JSON.stringify(entity));
|
|
653
|
-
}
|
|
655
|
+
}
|
|
654
656
|
/**
|
|
655
657
|
* Gets the active account
|
|
656
658
|
*/
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
659
|
+
getActiveAccount() {
|
|
660
|
+
const activeAccountKeyFilters = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
|
|
661
|
+
const activeAccountValueFilters = this.getItem(activeAccountKeyFilters);
|
|
660
662
|
if (!activeAccountValueFilters) {
|
|
661
663
|
// if new active account cache type isn't found, it's an old version, so look for that instead
|
|
662
664
|
this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters cache schema found, looking for legacy schema");
|
|
663
|
-
|
|
664
|
-
|
|
665
|
+
const activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
|
|
666
|
+
const activeAccountValueLocal = this.getItem(activeAccountKeyLocal);
|
|
665
667
|
if (!activeAccountValueLocal) {
|
|
666
668
|
this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found");
|
|
667
669
|
return null;
|
|
668
670
|
}
|
|
669
|
-
|
|
671
|
+
const activeAccount = this.getAccountInfoByFilter({
|
|
672
|
+
localAccountId: activeAccountValueLocal,
|
|
673
|
+
})[0] || null;
|
|
670
674
|
if (activeAccount) {
|
|
671
675
|
this.logger.trace("BrowserCacheManager.getActiveAccount: Legacy active account cache schema found");
|
|
672
676
|
this.logger.trace("BrowserCacheManager.getActiveAccount: Adding active account filters cache schema");
|
|
@@ -675,29 +679,29 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
675
679
|
}
|
|
676
680
|
return null;
|
|
677
681
|
}
|
|
678
|
-
|
|
682
|
+
const activeAccountValueObj = this.validateAndParseJson(activeAccountValueFilters);
|
|
679
683
|
if (activeAccountValueObj) {
|
|
680
684
|
this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found");
|
|
681
|
-
return this.getAccountInfoByFilter({
|
|
685
|
+
return (this.getAccountInfoByFilter({
|
|
682
686
|
homeAccountId: activeAccountValueObj.homeAccountId,
|
|
683
|
-
localAccountId: activeAccountValueObj.localAccountId
|
|
684
|
-
})[0] || null;
|
|
687
|
+
localAccountId: activeAccountValueObj.localAccountId,
|
|
688
|
+
})[0] || null);
|
|
685
689
|
}
|
|
686
690
|
this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found");
|
|
687
691
|
return null;
|
|
688
|
-
}
|
|
692
|
+
}
|
|
689
693
|
/**
|
|
690
694
|
* Sets the active account's localAccountId in cache
|
|
691
695
|
* @param account
|
|
692
696
|
*/
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
697
|
+
setActiveAccount(account) {
|
|
698
|
+
const activeAccountKey = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT_FILTERS);
|
|
699
|
+
const activeAccountKeyLocal = this.generateCacheKey(PersistentCacheKeys.ACTIVE_ACCOUNT);
|
|
696
700
|
if (account) {
|
|
697
701
|
this.logger.verbose("setActiveAccount: Active account set");
|
|
698
|
-
|
|
702
|
+
const activeAccountValue = {
|
|
699
703
|
homeAccountId: account.homeAccountId,
|
|
700
|
-
localAccountId: account.localAccountId
|
|
704
|
+
localAccountId: account.localAccountId,
|
|
701
705
|
};
|
|
702
706
|
this.browserStorage.setItem(activeAccountKey, JSON.stringify(activeAccountValue));
|
|
703
707
|
this.browserStorage.setItem(activeAccountKeyLocal, account.localAccountId);
|
|
@@ -707,42 +711,49 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
707
711
|
this.browserStorage.removeItem(activeAccountKey);
|
|
708
712
|
this.browserStorage.removeItem(activeAccountKeyLocal);
|
|
709
713
|
}
|
|
710
|
-
}
|
|
714
|
+
}
|
|
711
715
|
/**
|
|
712
716
|
* Gets a list of accounts that match all of the filters provided
|
|
713
717
|
* @param account
|
|
714
718
|
*/
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
this.logger.trace(
|
|
718
|
-
return allAccounts.filter(
|
|
719
|
-
if (accountFilter.username &&
|
|
719
|
+
getAccountInfoByFilter(accountFilter) {
|
|
720
|
+
const allAccounts = this.getAllAccounts();
|
|
721
|
+
this.logger.trace(`BrowserCacheManager.getAccountInfoByFilter: total ${allAccounts.length} accounts found`);
|
|
722
|
+
return allAccounts.filter((accountObj) => {
|
|
723
|
+
if (accountFilter.username &&
|
|
724
|
+
accountFilter.username.toLowerCase() !==
|
|
725
|
+
accountObj.username.toLowerCase()) {
|
|
720
726
|
return false;
|
|
721
727
|
}
|
|
722
|
-
if (accountFilter.homeAccountId &&
|
|
728
|
+
if (accountFilter.homeAccountId &&
|
|
729
|
+
accountFilter.homeAccountId !== accountObj.homeAccountId) {
|
|
723
730
|
return false;
|
|
724
731
|
}
|
|
725
|
-
if (accountFilter.localAccountId &&
|
|
732
|
+
if (accountFilter.localAccountId &&
|
|
733
|
+
accountFilter.localAccountId !== accountObj.localAccountId) {
|
|
726
734
|
return false;
|
|
727
735
|
}
|
|
728
|
-
if (accountFilter.tenantId &&
|
|
736
|
+
if (accountFilter.tenantId &&
|
|
737
|
+
accountFilter.tenantId !== accountObj.tenantId) {
|
|
729
738
|
return false;
|
|
730
739
|
}
|
|
731
|
-
if (accountFilter.environment &&
|
|
740
|
+
if (accountFilter.environment &&
|
|
741
|
+
accountFilter.environment !== accountObj.environment) {
|
|
732
742
|
return false;
|
|
733
743
|
}
|
|
734
744
|
return true;
|
|
735
745
|
});
|
|
736
|
-
}
|
|
746
|
+
}
|
|
737
747
|
/**
|
|
738
748
|
* Checks the cache for accounts matching loginHint or SID
|
|
739
749
|
* @param loginHint
|
|
740
750
|
* @param sid
|
|
741
751
|
*/
|
|
742
|
-
|
|
743
|
-
|
|
752
|
+
getAccountInfoByHints(loginHint, sid) {
|
|
753
|
+
const matchingAccounts = this.getAllAccounts().filter((accountInfo) => {
|
|
744
754
|
if (sid) {
|
|
745
|
-
|
|
755
|
+
const accountSid = accountInfo.idTokenClaims &&
|
|
756
|
+
accountInfo.idTokenClaims["sid"];
|
|
746
757
|
return sid === accountSid;
|
|
747
758
|
}
|
|
748
759
|
if (loginHint) {
|
|
@@ -757,53 +768,55 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
757
768
|
throw ClientAuthError.createMultipleMatchingAccountsInCacheError();
|
|
758
769
|
}
|
|
759
770
|
return null;
|
|
760
|
-
}
|
|
771
|
+
}
|
|
761
772
|
/**
|
|
762
773
|
* fetch throttling entity from the platform cache
|
|
763
774
|
* @param throttlingCacheKey
|
|
764
775
|
*/
|
|
765
|
-
|
|
766
|
-
|
|
776
|
+
getThrottlingCache(throttlingCacheKey) {
|
|
777
|
+
const value = this.getItem(throttlingCacheKey);
|
|
767
778
|
if (!value) {
|
|
768
779
|
this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit");
|
|
769
780
|
return null;
|
|
770
781
|
}
|
|
771
|
-
|
|
772
|
-
if (!parsedThrottlingCache ||
|
|
782
|
+
const parsedThrottlingCache = this.validateAndParseJson(value);
|
|
783
|
+
if (!parsedThrottlingCache ||
|
|
784
|
+
!ThrottlingEntity.isThrottlingEntity(throttlingCacheKey, parsedThrottlingCache)) {
|
|
773
785
|
this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit");
|
|
774
786
|
return null;
|
|
775
787
|
}
|
|
776
788
|
this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit");
|
|
777
789
|
return CacheManager.toObject(new ThrottlingEntity(), parsedThrottlingCache);
|
|
778
|
-
}
|
|
790
|
+
}
|
|
779
791
|
/**
|
|
780
792
|
* set throttling entity to the platform cache
|
|
781
793
|
* @param throttlingCacheKey
|
|
782
794
|
* @param throttlingCache
|
|
783
795
|
*/
|
|
784
|
-
|
|
796
|
+
setThrottlingCache(throttlingCacheKey, throttlingCache) {
|
|
785
797
|
this.logger.trace("BrowserCacheManager.setThrottlingCache called");
|
|
786
798
|
this.setItem(throttlingCacheKey, JSON.stringify(throttlingCache));
|
|
787
|
-
}
|
|
799
|
+
}
|
|
788
800
|
/**
|
|
789
801
|
* Gets cache item with given key.
|
|
790
802
|
* Will retrieve from cookies if storeAuthStateInCookie is set to true.
|
|
791
803
|
* @param key
|
|
792
804
|
*/
|
|
793
|
-
|
|
794
|
-
|
|
805
|
+
getTemporaryCache(cacheKey, generateKey) {
|
|
806
|
+
const key = generateKey ? this.generateCacheKey(cacheKey) : cacheKey;
|
|
795
807
|
if (this.cacheConfig.storeAuthStateInCookie) {
|
|
796
|
-
|
|
808
|
+
const itemCookie = this.getItemCookie(key);
|
|
797
809
|
if (itemCookie) {
|
|
798
810
|
this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies");
|
|
799
811
|
return itemCookie;
|
|
800
812
|
}
|
|
801
813
|
}
|
|
802
|
-
|
|
814
|
+
const value = this.temporaryCacheStorage.getItem(key);
|
|
803
815
|
if (!value) {
|
|
804
816
|
// If temp cache item not found in session/memory, check local storage for items set by old versions
|
|
805
|
-
if (this.cacheConfig.cacheLocation ===
|
|
806
|
-
|
|
817
|
+
if (this.cacheConfig.cacheLocation ===
|
|
818
|
+
BrowserCacheLocation.LocalStorage) {
|
|
819
|
+
const item = this.browserStorage.getItem(key);
|
|
807
820
|
if (item) {
|
|
808
821
|
this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage");
|
|
809
822
|
return item;
|
|
@@ -814,7 +827,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
814
827
|
}
|
|
815
828
|
this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned");
|
|
816
829
|
return value;
|
|
817
|
-
}
|
|
830
|
+
}
|
|
818
831
|
/**
|
|
819
832
|
* Sets the cache item with the key and value given.
|
|
820
833
|
* Stores in cookie if storeAuthStateInCookie is set to true.
|
|
@@ -822,94 +835,89 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
822
835
|
* @param key
|
|
823
836
|
* @param value
|
|
824
837
|
*/
|
|
825
|
-
|
|
826
|
-
|
|
838
|
+
setTemporaryCache(cacheKey, value, generateKey) {
|
|
839
|
+
const key = generateKey ? this.generateCacheKey(cacheKey) : cacheKey;
|
|
827
840
|
this.temporaryCacheStorage.setItem(key, value);
|
|
828
841
|
if (this.cacheConfig.storeAuthStateInCookie) {
|
|
829
842
|
this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie");
|
|
830
843
|
this.setItemCookie(key, value);
|
|
831
844
|
}
|
|
832
|
-
}
|
|
845
|
+
}
|
|
833
846
|
/**
|
|
834
847
|
* Removes the cache item with the given key.
|
|
835
848
|
* Will also clear the cookie item if storeAuthStateInCookie is set to true.
|
|
836
849
|
* @param key
|
|
837
850
|
*/
|
|
838
|
-
|
|
851
|
+
removeItem(key) {
|
|
839
852
|
this.browserStorage.removeItem(key);
|
|
840
853
|
this.temporaryCacheStorage.removeItem(key);
|
|
841
854
|
if (this.cacheConfig.storeAuthStateInCookie) {
|
|
842
855
|
this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie");
|
|
843
856
|
this.clearItemCookie(key);
|
|
844
857
|
}
|
|
845
|
-
}
|
|
858
|
+
}
|
|
846
859
|
/**
|
|
847
860
|
* Checks whether key is in cache.
|
|
848
861
|
* @param key
|
|
849
862
|
*/
|
|
850
|
-
|
|
851
|
-
return this.browserStorage.containsKey(key) ||
|
|
852
|
-
|
|
863
|
+
containsKey(key) {
|
|
864
|
+
return (this.browserStorage.containsKey(key) ||
|
|
865
|
+
this.temporaryCacheStorage.containsKey(key));
|
|
866
|
+
}
|
|
853
867
|
/**
|
|
854
868
|
* Gets all keys in window.
|
|
855
869
|
*/
|
|
856
|
-
|
|
857
|
-
return
|
|
858
|
-
|
|
870
|
+
getKeys() {
|
|
871
|
+
return [
|
|
872
|
+
...this.browserStorage.getKeys(),
|
|
873
|
+
...this.temporaryCacheStorage.getKeys(),
|
|
874
|
+
];
|
|
875
|
+
}
|
|
859
876
|
/**
|
|
860
877
|
* Clears all cache entries created by MSAL.
|
|
861
878
|
*/
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
this.getKeys().forEach(function (cacheKey) {
|
|
876
|
-
// Check if key contains msal prefix; For now, we are clearing all the cache items created by MSAL.js
|
|
877
|
-
if ((_this.browserStorage.containsKey(cacheKey) || _this.temporaryCacheStorage.containsKey(cacheKey)) && ((cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1) || (cacheKey.indexOf(_this.clientId) !== -1))) {
|
|
878
|
-
_this.removeItem(cacheKey);
|
|
879
|
-
}
|
|
880
|
-
});
|
|
881
|
-
this.internalStorage.clear();
|
|
882
|
-
return [2 /*return*/];
|
|
883
|
-
}
|
|
884
|
-
});
|
|
879
|
+
async clear() {
|
|
880
|
+
// Removes all accounts and their credentials
|
|
881
|
+
await this.removeAllAccounts();
|
|
882
|
+
this.removeAppMetadata();
|
|
883
|
+
// Removes all remaining MSAL cache items
|
|
884
|
+
this.getKeys().forEach((cacheKey) => {
|
|
885
|
+
// Check if key contains msal prefix; For now, we are clearing all the cache items created by MSAL.js
|
|
886
|
+
if ((this.browserStorage.containsKey(cacheKey) ||
|
|
887
|
+
this.temporaryCacheStorage.containsKey(cacheKey)) &&
|
|
888
|
+
(cacheKey.indexOf(Constants.CACHE_PREFIX) !== -1 ||
|
|
889
|
+
cacheKey.indexOf(this.clientId) !== -1)) {
|
|
890
|
+
this.removeItem(cacheKey);
|
|
891
|
+
}
|
|
885
892
|
});
|
|
886
|
-
|
|
893
|
+
this.internalStorage.clear();
|
|
894
|
+
}
|
|
887
895
|
/**
|
|
888
896
|
* Add value to cookies
|
|
889
897
|
* @param cookieName
|
|
890
898
|
* @param cookieValue
|
|
891
899
|
* @param expires
|
|
892
900
|
*/
|
|
893
|
-
|
|
894
|
-
|
|
901
|
+
setItemCookie(cookieName, cookieValue, expires) {
|
|
902
|
+
let cookieStr = `${encodeURIComponent(cookieName)}=${encodeURIComponent(cookieValue)};path=/;SameSite=Lax;`;
|
|
895
903
|
if (expires) {
|
|
896
|
-
|
|
897
|
-
cookieStr +=
|
|
904
|
+
const expireTime = this.getCookieExpirationTime(expires);
|
|
905
|
+
cookieStr += `expires=${expireTime};`;
|
|
898
906
|
}
|
|
899
907
|
if (this.cacheConfig.secureCookies) {
|
|
900
908
|
cookieStr += "Secure;";
|
|
901
909
|
}
|
|
902
910
|
document.cookie = cookieStr;
|
|
903
|
-
}
|
|
911
|
+
}
|
|
904
912
|
/**
|
|
905
913
|
* Get one item by key from cookies
|
|
906
914
|
* @param cookieName
|
|
907
915
|
*/
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
for (
|
|
912
|
-
|
|
916
|
+
getItemCookie(cookieName) {
|
|
917
|
+
const name = `${encodeURIComponent(cookieName)}=`;
|
|
918
|
+
const cookieList = document.cookie.split(";");
|
|
919
|
+
for (let i = 0; i < cookieList.length; i++) {
|
|
920
|
+
let cookie = cookieList[i];
|
|
913
921
|
while (cookie.charAt(0) === " ") {
|
|
914
922
|
cookie = cookie.substring(1);
|
|
915
923
|
}
|
|
@@ -918,148 +926,147 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
918
926
|
}
|
|
919
927
|
}
|
|
920
928
|
return Constants.EMPTY_STRING;
|
|
921
|
-
}
|
|
929
|
+
}
|
|
922
930
|
/**
|
|
923
931
|
* Clear all msal-related cookies currently set in the browser. Should only be used to clear temporary cache items.
|
|
924
932
|
*/
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
cookieList.forEach(function (cookie) {
|
|
933
|
+
clearMsalCookies() {
|
|
934
|
+
const cookiePrefix = `${Constants.CACHE_PREFIX}.${this.clientId}`;
|
|
935
|
+
const cookieList = document.cookie.split(";");
|
|
936
|
+
cookieList.forEach((cookie) => {
|
|
930
937
|
while (cookie.charAt(0) === " ") {
|
|
931
938
|
// eslint-disable-next-line no-param-reassign
|
|
932
939
|
cookie = cookie.substring(1);
|
|
933
940
|
}
|
|
934
941
|
if (cookie.indexOf(cookiePrefix) === 0) {
|
|
935
|
-
|
|
936
|
-
|
|
942
|
+
const cookieKey = cookie.split("=")[0];
|
|
943
|
+
this.clearItemCookie(cookieKey);
|
|
937
944
|
}
|
|
938
945
|
});
|
|
939
|
-
}
|
|
946
|
+
}
|
|
940
947
|
/**
|
|
941
948
|
* Clear an item in the cookies by key
|
|
942
949
|
* @param cookieName
|
|
943
950
|
*/
|
|
944
|
-
|
|
951
|
+
clearItemCookie(cookieName) {
|
|
945
952
|
this.setItemCookie(cookieName, Constants.EMPTY_STRING, -1);
|
|
946
|
-
}
|
|
953
|
+
}
|
|
947
954
|
/**
|
|
948
955
|
* Get cookie expiration time
|
|
949
956
|
* @param cookieLifeDays
|
|
950
957
|
*/
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
958
|
+
getCookieExpirationTime(cookieLifeDays) {
|
|
959
|
+
const today = new Date();
|
|
960
|
+
const expr = new Date(today.getTime() + cookieLifeDays * this.COOKIE_LIFE_MULTIPLIER);
|
|
954
961
|
return expr.toUTCString();
|
|
955
|
-
}
|
|
962
|
+
}
|
|
956
963
|
/**
|
|
957
964
|
* Gets the cache object referenced by the browser
|
|
958
965
|
*/
|
|
959
|
-
|
|
966
|
+
getCache() {
|
|
960
967
|
return this.browserStorage;
|
|
961
|
-
}
|
|
968
|
+
}
|
|
962
969
|
/**
|
|
963
970
|
* interface compat, we cannot overwrite browser cache; Functionality is supported by individual entities in browser
|
|
964
971
|
*/
|
|
965
|
-
|
|
972
|
+
setCache() {
|
|
966
973
|
// sets nothing
|
|
967
|
-
}
|
|
974
|
+
}
|
|
968
975
|
/**
|
|
969
976
|
* Prepend msal.<client-id> to each key; Skip for any JSON object as Key (defined schemas do not need the key appended: AccessToken Keys or the upcoming schema)
|
|
970
977
|
* @param key
|
|
971
978
|
* @param addInstanceId
|
|
972
979
|
*/
|
|
973
|
-
|
|
974
|
-
|
|
980
|
+
generateCacheKey(key) {
|
|
981
|
+
const generatedKey = this.validateAndParseJson(key);
|
|
975
982
|
if (!generatedKey) {
|
|
976
|
-
if (StringUtils.startsWith(key, Constants.CACHE_PREFIX) ||
|
|
983
|
+
if (StringUtils.startsWith(key, Constants.CACHE_PREFIX) ||
|
|
984
|
+
StringUtils.startsWith(key, PersistentCacheKeys.ADAL_ID_TOKEN)) {
|
|
977
985
|
return key;
|
|
978
986
|
}
|
|
979
|
-
return Constants.CACHE_PREFIX
|
|
987
|
+
return `${Constants.CACHE_PREFIX}.${this.clientId}.${key}`;
|
|
980
988
|
}
|
|
981
989
|
return JSON.stringify(key);
|
|
982
|
-
}
|
|
990
|
+
}
|
|
983
991
|
/**
|
|
984
992
|
* Create authorityKey to cache authority
|
|
985
993
|
* @param state
|
|
986
994
|
*/
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
return this.generateCacheKey(TemporaryCacheKeys.AUTHORITY
|
|
990
|
-
}
|
|
995
|
+
generateAuthorityKey(stateString) {
|
|
996
|
+
const { libraryState: { id: stateId }, } = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString);
|
|
997
|
+
return this.generateCacheKey(`${TemporaryCacheKeys.AUTHORITY}.${stateId}`);
|
|
998
|
+
}
|
|
991
999
|
/**
|
|
992
1000
|
* Create Nonce key to cache nonce
|
|
993
1001
|
* @param state
|
|
994
1002
|
*/
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
return this.generateCacheKey(TemporaryCacheKeys.NONCE_IDTOKEN
|
|
998
|
-
}
|
|
1003
|
+
generateNonceKey(stateString) {
|
|
1004
|
+
const { libraryState: { id: stateId }, } = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString);
|
|
1005
|
+
return this.generateCacheKey(`${TemporaryCacheKeys.NONCE_IDTOKEN}.${stateId}`);
|
|
1006
|
+
}
|
|
999
1007
|
/**
|
|
1000
1008
|
* Creates full cache key for the request state
|
|
1001
1009
|
* @param stateString State string for the request
|
|
1002
1010
|
*/
|
|
1003
|
-
|
|
1011
|
+
generateStateKey(stateString) {
|
|
1004
1012
|
// Use the library state id to key temp storage for uniqueness for multiple concurrent requests
|
|
1005
|
-
|
|
1006
|
-
return this.generateCacheKey(TemporaryCacheKeys.REQUEST_STATE
|
|
1007
|
-
}
|
|
1013
|
+
const { libraryState: { id: stateId }, } = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString);
|
|
1014
|
+
return this.generateCacheKey(`${TemporaryCacheKeys.REQUEST_STATE}.${stateId}`);
|
|
1015
|
+
}
|
|
1008
1016
|
/**
|
|
1009
1017
|
* Gets the cached authority based on the cached state. Returns empty if no cached state found.
|
|
1010
1018
|
*/
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1019
|
+
getCachedAuthority(cachedState) {
|
|
1020
|
+
const stateCacheKey = this.generateStateKey(cachedState);
|
|
1021
|
+
const state = this.getTemporaryCache(stateCacheKey);
|
|
1014
1022
|
if (!state) {
|
|
1015
1023
|
return null;
|
|
1016
1024
|
}
|
|
1017
|
-
|
|
1025
|
+
const authorityCacheKey = this.generateAuthorityKey(state);
|
|
1018
1026
|
return this.getTemporaryCache(authorityCacheKey);
|
|
1019
|
-
}
|
|
1027
|
+
}
|
|
1020
1028
|
/**
|
|
1021
1029
|
* Updates account, authority, and state in cache
|
|
1022
1030
|
* @param serverAuthenticationRequest
|
|
1023
1031
|
* @param account
|
|
1024
1032
|
*/
|
|
1025
|
-
|
|
1033
|
+
updateCacheEntries(state, nonce, authorityInstance, loginHint, account) {
|
|
1026
1034
|
this.logger.trace("BrowserCacheManager.updateCacheEntries called");
|
|
1027
1035
|
// Cache the request state
|
|
1028
|
-
|
|
1036
|
+
const stateCacheKey = this.generateStateKey(state);
|
|
1029
1037
|
this.setTemporaryCache(stateCacheKey, state, false);
|
|
1030
1038
|
// Cache the nonce
|
|
1031
|
-
|
|
1039
|
+
const nonceCacheKey = this.generateNonceKey(state);
|
|
1032
1040
|
this.setTemporaryCache(nonceCacheKey, nonce, false);
|
|
1033
1041
|
// Cache authorityKey
|
|
1034
|
-
|
|
1042
|
+
const authorityCacheKey = this.generateAuthorityKey(state);
|
|
1035
1043
|
this.setTemporaryCache(authorityCacheKey, authorityInstance, false);
|
|
1036
1044
|
if (account) {
|
|
1037
|
-
|
|
1045
|
+
const ccsCredential = {
|
|
1038
1046
|
credential: account.homeAccountId,
|
|
1039
|
-
type: CcsCredentialType.HOME_ACCOUNT_ID
|
|
1047
|
+
type: CcsCredentialType.HOME_ACCOUNT_ID,
|
|
1040
1048
|
};
|
|
1041
1049
|
this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
1042
1050
|
}
|
|
1043
1051
|
else if (!StringUtils.isEmpty(loginHint)) {
|
|
1044
|
-
|
|
1052
|
+
const ccsCredential = {
|
|
1045
1053
|
credential: loginHint,
|
|
1046
|
-
type: CcsCredentialType.UPN
|
|
1054
|
+
type: CcsCredentialType.UPN,
|
|
1047
1055
|
};
|
|
1048
1056
|
this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
1049
1057
|
}
|
|
1050
|
-
}
|
|
1058
|
+
}
|
|
1051
1059
|
/**
|
|
1052
1060
|
* Reset all temporary cache items
|
|
1053
1061
|
* @param state
|
|
1054
1062
|
*/
|
|
1055
|
-
|
|
1056
|
-
var _this = this;
|
|
1063
|
+
resetRequestCache(state) {
|
|
1057
1064
|
this.logger.trace("BrowserCacheManager.resetRequestCache called");
|
|
1058
1065
|
// check state and remove associated cache items
|
|
1059
1066
|
if (!StringUtils.isEmpty(state)) {
|
|
1060
|
-
this.getKeys().forEach(
|
|
1067
|
+
this.getKeys().forEach((key) => {
|
|
1061
1068
|
if (key.indexOf(state) !== -1) {
|
|
1062
|
-
|
|
1069
|
+
this.removeItem(key);
|
|
1063
1070
|
}
|
|
1064
1071
|
});
|
|
1065
1072
|
}
|
|
@@ -1076,115 +1083,115 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
1076
1083
|
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CCS_CREDENTIAL));
|
|
1077
1084
|
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
|
1078
1085
|
this.setInteractionInProgress(false);
|
|
1079
|
-
}
|
|
1086
|
+
}
|
|
1080
1087
|
/**
|
|
1081
1088
|
* Removes temporary cache for the provided state
|
|
1082
1089
|
* @param stateString
|
|
1083
1090
|
*/
|
|
1084
|
-
|
|
1091
|
+
cleanRequestByState(stateString) {
|
|
1085
1092
|
this.logger.trace("BrowserCacheManager.cleanRequestByState called");
|
|
1086
1093
|
// Interaction is completed - remove interaction status.
|
|
1087
1094
|
if (stateString) {
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
this.logger.infoPii(
|
|
1095
|
+
const stateKey = this.generateStateKey(stateString);
|
|
1096
|
+
const cachedState = this.temporaryCacheStorage.getItem(stateKey);
|
|
1097
|
+
this.logger.infoPii(`BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: ${cachedState}`);
|
|
1091
1098
|
this.resetRequestCache(cachedState || Constants.EMPTY_STRING);
|
|
1092
1099
|
}
|
|
1093
1100
|
this.clearMsalCookies();
|
|
1094
|
-
}
|
|
1101
|
+
}
|
|
1095
1102
|
/**
|
|
1096
1103
|
* Looks in temporary cache for any state values with the provided interactionType and removes all temporary cache items for that state
|
|
1097
1104
|
* Used in scenarios where temp cache needs to be cleaned but state is not known, such as clicking browser back button.
|
|
1098
1105
|
* @param interactionType
|
|
1099
1106
|
*/
|
|
1100
|
-
|
|
1101
|
-
var _this = this;
|
|
1107
|
+
cleanRequestByInteractionType(interactionType) {
|
|
1102
1108
|
this.logger.trace("BrowserCacheManager.cleanRequestByInteractionType called");
|
|
1103
1109
|
// Loop through all keys to find state key
|
|
1104
|
-
this.getKeys().forEach(
|
|
1110
|
+
this.getKeys().forEach((key) => {
|
|
1105
1111
|
// If this key is not the state key, move on
|
|
1106
1112
|
if (key.indexOf(TemporaryCacheKeys.REQUEST_STATE) === -1) {
|
|
1107
1113
|
return;
|
|
1108
1114
|
}
|
|
1109
1115
|
// Retrieve state value, return if not a valid value
|
|
1110
|
-
|
|
1116
|
+
const stateValue = this.temporaryCacheStorage.getItem(key);
|
|
1111
1117
|
if (!stateValue) {
|
|
1112
1118
|
return;
|
|
1113
1119
|
}
|
|
1114
1120
|
// Extract state and ensure it matches given InteractionType, then clean request cache
|
|
1115
|
-
|
|
1116
|
-
if (parsedState &&
|
|
1117
|
-
|
|
1118
|
-
|
|
1121
|
+
const parsedState = BrowserProtocolUtils.extractBrowserRequestState(this.cryptoImpl, stateValue);
|
|
1122
|
+
if (parsedState &&
|
|
1123
|
+
parsedState.interactionType === interactionType) {
|
|
1124
|
+
this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${stateValue}`);
|
|
1125
|
+
this.resetRequestCache(stateValue);
|
|
1119
1126
|
}
|
|
1120
1127
|
});
|
|
1121
1128
|
this.clearMsalCookies();
|
|
1122
1129
|
this.setInteractionInProgress(false);
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1130
|
+
}
|
|
1131
|
+
cacheCodeRequest(authCodeRequest, browserCrypto) {
|
|
1125
1132
|
this.logger.trace("BrowserCacheManager.cacheCodeRequest called");
|
|
1126
|
-
|
|
1133
|
+
const encodedValue = browserCrypto.base64Encode(JSON.stringify(authCodeRequest));
|
|
1127
1134
|
this.setTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);
|
|
1128
|
-
}
|
|
1135
|
+
}
|
|
1129
1136
|
/**
|
|
1130
1137
|
* Gets the token exchange parameters from the cache. Throws an error if nothing is found.
|
|
1131
1138
|
*/
|
|
1132
|
-
|
|
1139
|
+
getCachedRequest(state, browserCrypto) {
|
|
1133
1140
|
this.logger.trace("BrowserCacheManager.getCachedRequest called");
|
|
1134
1141
|
// Get token request from cache and parse as TokenExchangeParameters.
|
|
1135
|
-
|
|
1142
|
+
const encodedTokenRequest = this.getTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, true);
|
|
1136
1143
|
if (!encodedTokenRequest) {
|
|
1137
1144
|
throw BrowserAuthError.createNoTokenRequestCacheError();
|
|
1138
1145
|
}
|
|
1139
|
-
|
|
1146
|
+
const parsedRequest = this.validateAndParseJson(browserCrypto.base64Decode(encodedTokenRequest));
|
|
1140
1147
|
if (!parsedRequest) {
|
|
1141
1148
|
throw BrowserAuthError.createUnableToParseTokenRequestCacheError();
|
|
1142
1149
|
}
|
|
1143
1150
|
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
|
|
1144
1151
|
// Get cached authority and use if no authority is cached with request.
|
|
1145
1152
|
if (StringUtils.isEmpty(parsedRequest.authority)) {
|
|
1146
|
-
|
|
1147
|
-
|
|
1153
|
+
const authorityCacheKey = this.generateAuthorityKey(state);
|
|
1154
|
+
const cachedAuthority = this.getTemporaryCache(authorityCacheKey);
|
|
1148
1155
|
if (!cachedAuthority) {
|
|
1149
1156
|
throw BrowserAuthError.createNoCachedAuthorityError();
|
|
1150
1157
|
}
|
|
1151
1158
|
parsedRequest.authority = cachedAuthority;
|
|
1152
1159
|
}
|
|
1153
1160
|
return parsedRequest;
|
|
1154
|
-
}
|
|
1161
|
+
}
|
|
1155
1162
|
/**
|
|
1156
1163
|
* Gets cached native request for redirect flows
|
|
1157
1164
|
*/
|
|
1158
|
-
|
|
1165
|
+
getCachedNativeRequest() {
|
|
1159
1166
|
this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");
|
|
1160
|
-
|
|
1167
|
+
const cachedRequest = this.getTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, true);
|
|
1161
1168
|
if (!cachedRequest) {
|
|
1162
1169
|
this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found");
|
|
1163
1170
|
return null;
|
|
1164
1171
|
}
|
|
1165
|
-
|
|
1172
|
+
const parsedRequest = this.validateAndParseJson(cachedRequest);
|
|
1166
1173
|
if (!parsedRequest) {
|
|
1167
1174
|
this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request");
|
|
1168
1175
|
return null;
|
|
1169
1176
|
}
|
|
1170
1177
|
return parsedRequest;
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
|
|
1178
|
+
}
|
|
1179
|
+
isInteractionInProgress(matchClientId) {
|
|
1180
|
+
const clientId = this.getInteractionInProgress();
|
|
1174
1181
|
if (matchClientId) {
|
|
1175
1182
|
return clientId === this.clientId;
|
|
1176
1183
|
}
|
|
1177
1184
|
else {
|
|
1178
1185
|
return !!clientId;
|
|
1179
1186
|
}
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1187
|
+
}
|
|
1188
|
+
getInteractionInProgress() {
|
|
1189
|
+
const key = `${Constants.CACHE_PREFIX}.${TemporaryCacheKeys.INTERACTION_STATUS_KEY}`;
|
|
1183
1190
|
return this.getTemporaryCache(key, false);
|
|
1184
|
-
}
|
|
1185
|
-
|
|
1191
|
+
}
|
|
1192
|
+
setInteractionInProgress(inProgress) {
|
|
1186
1193
|
// Ensure we don't overwrite interaction in progress for a different clientId
|
|
1187
|
-
|
|
1194
|
+
const key = `${Constants.CACHE_PREFIX}.${TemporaryCacheKeys.INTERACTION_STATUS_KEY}`;
|
|
1188
1195
|
if (inProgress) {
|
|
1189
1196
|
if (this.getInteractionInProgress()) {
|
|
1190
1197
|
throw BrowserAuthError.createInteractionInProgressError();
|
|
@@ -1194,30 +1201,32 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
1194
1201
|
this.setTemporaryCache(key, this.clientId, false);
|
|
1195
1202
|
}
|
|
1196
1203
|
}
|
|
1197
|
-
else if (!inProgress &&
|
|
1204
|
+
else if (!inProgress &&
|
|
1205
|
+
this.getInteractionInProgress() === this.clientId) {
|
|
1198
1206
|
this.removeItem(key);
|
|
1199
1207
|
}
|
|
1200
|
-
}
|
|
1208
|
+
}
|
|
1201
1209
|
/**
|
|
1202
1210
|
* Returns username retrieved from ADAL or MSAL v1 idToken
|
|
1203
1211
|
*/
|
|
1204
|
-
|
|
1212
|
+
getLegacyLoginHint() {
|
|
1205
1213
|
// Only check for adal/msal token if no SSO params are being used
|
|
1206
|
-
|
|
1214
|
+
const adalIdTokenString = this.getTemporaryCache(PersistentCacheKeys.ADAL_ID_TOKEN);
|
|
1207
1215
|
if (adalIdTokenString) {
|
|
1208
1216
|
this.browserStorage.removeItem(PersistentCacheKeys.ADAL_ID_TOKEN);
|
|
1209
1217
|
this.logger.verbose("Cached ADAL id token retrieved.");
|
|
1210
1218
|
}
|
|
1211
1219
|
// Check for cached MSAL v1 id token
|
|
1212
|
-
|
|
1220
|
+
const msalIdTokenString = this.getTemporaryCache(PersistentCacheKeys.ID_TOKEN, true);
|
|
1213
1221
|
if (msalIdTokenString) {
|
|
1214
1222
|
this.removeItem(this.generateCacheKey(PersistentCacheKeys.ID_TOKEN));
|
|
1215
1223
|
this.logger.verbose("Cached MSAL.js v1 id token retrieved");
|
|
1216
1224
|
}
|
|
1217
|
-
|
|
1225
|
+
const cachedIdTokenString = msalIdTokenString || adalIdTokenString;
|
|
1218
1226
|
if (cachedIdTokenString) {
|
|
1219
|
-
|
|
1220
|
-
if (cachedIdToken.claims &&
|
|
1227
|
+
const cachedIdToken = new IdToken(cachedIdTokenString, this.cryptoImpl);
|
|
1228
|
+
if (cachedIdToken.claims &&
|
|
1229
|
+
cachedIdToken.claims.preferred_username) {
|
|
1221
1230
|
this.logger.verbose("No SSO params used and ADAL/MSAL v1 token retrieved, setting ADAL/MSAL v1 preferred_username as loginHint");
|
|
1222
1231
|
return cachedIdToken.claims.preferred_username;
|
|
1223
1232
|
}
|
|
@@ -1230,48 +1239,47 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
1230
1239
|
}
|
|
1231
1240
|
}
|
|
1232
1241
|
return null;
|
|
1233
|
-
}
|
|
1242
|
+
}
|
|
1234
1243
|
/**
|
|
1235
1244
|
* Updates a credential's cache key if the current cache key is outdated
|
|
1236
1245
|
*/
|
|
1237
|
-
|
|
1238
|
-
|
|
1246
|
+
updateCredentialCacheKey(currentCacheKey, credential) {
|
|
1247
|
+
const updatedCacheKey = credential.generateCredentialKey();
|
|
1239
1248
|
if (currentCacheKey !== updatedCacheKey) {
|
|
1240
|
-
|
|
1249
|
+
const cacheItem = this.getItem(currentCacheKey);
|
|
1241
1250
|
if (cacheItem) {
|
|
1242
1251
|
this.removeItem(currentCacheKey);
|
|
1243
1252
|
this.setItem(updatedCacheKey, cacheItem);
|
|
1244
|
-
this.logger.verbose(
|
|
1253
|
+
this.logger.verbose(`Updated an outdated ${credential.credentialType} cache key`);
|
|
1245
1254
|
return updatedCacheKey;
|
|
1246
1255
|
}
|
|
1247
1256
|
else {
|
|
1248
|
-
this.logger.error(
|
|
1257
|
+
this.logger.error(`Attempted to update an outdated ${credential.credentialType} cache key but no item matching the outdated key was found in storage`);
|
|
1249
1258
|
}
|
|
1250
1259
|
}
|
|
1251
1260
|
return currentCacheKey;
|
|
1252
|
-
}
|
|
1261
|
+
}
|
|
1253
1262
|
/**
|
|
1254
1263
|
* Returns application id as redirect context during AcquireTokenRedirect flow.
|
|
1255
1264
|
*/
|
|
1256
|
-
|
|
1265
|
+
getRedirectRequestContext() {
|
|
1257
1266
|
return this.getTemporaryCache(TemporaryCacheKeys.REDIRECT_CONTEXT, true);
|
|
1258
|
-
}
|
|
1267
|
+
}
|
|
1259
1268
|
/**
|
|
1260
1269
|
* Sets application id as the redirect context during AcquireTokenRedirect flow.
|
|
1261
1270
|
* @param value
|
|
1262
1271
|
*/
|
|
1263
|
-
|
|
1272
|
+
setRedirectRequestContext(value) {
|
|
1264
1273
|
this.setTemporaryCache(TemporaryCacheKeys.REDIRECT_CONTEXT, value, true);
|
|
1265
|
-
}
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
var cacheOptions = {
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger) => {
|
|
1277
|
+
const cacheOptions = {
|
|
1270
1278
|
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
1271
1279
|
temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
1272
1280
|
storeAuthStateInCookie: false,
|
|
1273
1281
|
secureCookies: false,
|
|
1274
|
-
cacheMigrationEnabled: false
|
|
1282
|
+
cacheMigrationEnabled: false,
|
|
1275
1283
|
};
|
|
1276
1284
|
return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger);
|
|
1277
1285
|
};
|