public static void ResetInternalStaticCaches() { // This initializes the classes so that the statics inside them are fully initialized, and clears any cached content in them. new InstanceDiscoveryManager( Substitute.For <IHttpManager>(), true, null, null); AuthorityManager.ClearValidationCache(); SingletonThrottlingManager.GetInstance().ResetCache(); }
internal ServiceBundle( ApplicationConfiguration config, bool shouldClearCaches = false) { Config = config; ApplicationLogger = new MsalLogger( Guid.Empty, config.ClientName, config.ClientVersion, config.LogLevel, config.EnablePiiLogging, config.IsDefaultPlatformLoggingEnabled, config.LoggingCallback); PlatformProxy = config.PlatformProxy ?? PlatformProxyFactory.CreatePlatformProxy(ApplicationLogger); HttpManager = config.HttpManager ?? new HttpManager( config.HttpClientFactory ?? PlatformProxy.CreateDefaultHttpClientFactory()); HttpTelemetryManager = new HttpTelemetryManager(); if (config.TelemetryConfig != null) { // This can return null if the device isn't sampled in. There's no need for processing MATS events if we're not going to send them. Mats = TelemetryClient.CreateMats(config, PlatformProxy, config.TelemetryConfig); MatsTelemetryManager = Mats?.TelemetryManager ?? new TelemetryManager(config, PlatformProxy, config.TelemetryCallback); } else { MatsTelemetryManager = new TelemetryManager(config, PlatformProxy, config.TelemetryCallback); } InstanceDiscoveryManager = new InstanceDiscoveryManager( HttpManager, shouldClearCaches, config.CustomInstanceDiscoveryMetadata, config.CustomInstanceDiscoveryMetadataUri); WsTrustWebRequestManager = new WsTrustWebRequestManager(HttpManager); ThrottlingManager = SingletonThrottlingManager.GetInstance(); DeviceAuthManager = config.DeviceAuthManagerForTest ?? PlatformProxy.CreateDeviceAuthManager(); if (shouldClearCaches) { AuthorityManager.ClearValidationCache(); } }
internal ServiceBundle( ApplicationConfiguration config, bool shouldClearCaches = false) { Config = config; ApplicationLogger = new MsalLogger( Guid.Empty, config.ClientName, config.ClientVersion, config.LogLevel, config.EnablePiiLogging, config.IsDefaultPlatformLoggingEnabled, config.LoggingCallback); PlatformProxy = config.PlatformProxy ?? PlatformProxyFactory.CreatePlatformProxy(ApplicationLogger); HttpManager = config.HttpManager ?? new HttpManager( config.HttpClientFactory ?? PlatformProxy.CreateDefaultHttpClientFactory()); HttpTelemetryManager = new HttpTelemetryManager(); InstanceDiscoveryManager = new InstanceDiscoveryManager( HttpManager, shouldClearCaches, config.CustomInstanceDiscoveryMetadata, config.CustomInstanceDiscoveryMetadataUri); WsTrustWebRequestManager = new WsTrustWebRequestManager(HttpManager); ThrottlingManager = SingletonThrottlingManager.GetInstance(); DeviceAuthManager = config.DeviceAuthManagerForTest ?? PlatformProxy.CreateDeviceAuthManager(); if (shouldClearCaches) // for test { AuthorityManager.ClearValidationCache(); PoPProviderFactory.Reset(); } }