internal ServiceBundle( ApplicationConfiguration config, bool shouldClearCaches = false) { Config = config; DefaultLogger = new MsalLogger( Guid.Empty, config.ClientName, config.ClientVersion, config.LogLevel, config.EnablePiiLogging, config.IsDefaultPlatformLoggingEnabled, config.LoggingCallback); PlatformProxy = config.PlatformProxy ?? PlatformProxyFactory.CreatePlatformProxy(DefaultLogger); HttpManager = config.HttpManager ?? new HttpManager(config.HttpClientFactory); 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); TelemetryManager = Mats?.TelemetryManager ?? new TelemetryManager(config, PlatformProxy, config.TelemetryCallback); } else { TelemetryManager = new TelemetryManager(config, PlatformProxy, config.TelemetryCallback); } AadInstanceDiscovery = new AadInstanceDiscovery(DefaultLogger, HttpManager, TelemetryManager, shouldClearCaches); WsTrustWebRequestManager = new WsTrustWebRequestManager(HttpManager); AuthorityEndpointResolutionManager = new AuthorityEndpointResolutionManager(this, shouldClearCaches); }
public static IDictionary <string, string> GetMsalIdParameters(ICoreLogger logger) { var platformProxy = PlatformProxyFactory.CreatePlatformProxy(logger); if (platformProxy == null) { throw new MsalClientException( MsalError.PlatformNotSupported, MsalErrorMessage.PlatformNotSupported); } var parameters = new Dictionary <string, string> { [MsalIdParameter.Product] = platformProxy.GetProductName(), [MsalIdParameter.Version] = GetMsalVersion() }; string processorInformation = platformProxy.GetProcessorArchitecture(); if (processorInformation != null) { parameters[MsalIdParameter.CpuPlatform] = processorInformation; } string osInformation = platformProxy.GetOperatingSystem(); if (osInformation != null) { parameters[MsalIdParameter.OS] = osInformation; } string deviceInformation = platformProxy.GetDeviceModel(); if (deviceInformation != null) { parameters[MsalIdParameter.DeviceModel] = deviceInformation; } return(parameters); }