Exemplo n.º 1
0
        public static void RegisterCardFileClientComponents(this IServiceCollection services,
                                                            CardFilesCommunicationConfiguration configuration = null)
        {
            if (configuration != null)
            {
                services.AddSingleton(configuration);
            }

            services.AddSingleton <CardFilesRestClient>();
            services.AddScoped <CardFilesClient>();
        }
Exemplo n.º 2
0
        public CardFilesRestClient(CardFilesCommunicationConfiguration configuration) : base(configuration)
        {
            var networkCredentials = new NetworkCredential(configuration.Username, configuration.Password);
            var credCache          = new CredentialCache {
                { configuration.Url, "Digest", networkCredentials }
            };

            HttpClientHandler.Credentials = credCache;

            HttpClient.DefaultRequestHeaders.Accept.Clear();
            HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/xml"));
            DeserializationType = DeserializationType.Xml;
        }