Example #1
0
        /// <summary>
        ///     Initializes a new instance of the Sentinel.OAuth.Client.SentinelOAuthClient class.
        /// </summary>
        /// <param name="settings">Options for controlling the operation.</param>
        public SentinelOAuthClient(ISentinelClientSettings settings)
        {
            this.Settings = settings;

            this.cookieContainer = new CookieContainer();

            var handler = new HttpClientHandler()
            {
                CookieContainer   = this.cookieContainer,
                UseCookies        = true,
                AllowAutoRedirect = false
            };

            if (handler.SupportsAutomaticDecompression)
            {
                handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
            }

            this.handler = handler;

            this.Client = new HttpClient(this.handler)
            {
                BaseAddress = settings.Url
            };
        }
Example #2
0
        /// <summary>Initializes a new instance of the Sentinel.OAuth.Client.SentinelOAuthClient class.</summary>
        /// <param name="settings">Options for controlling the operation.</param>
        /// <param name="handler">The http handler.</param>
        public SentinelOAuthClient(ISentinelClientSettings settings, HttpMessageHandler handler)
        {
            this.Settings = settings;

            this.handler = handler;

            this.Client = new HttpClient(this.handler)
            {
                BaseAddress = settings.Url
            };
        }
        /// <summary>
        ///     Initializes a new instance of the Sentinel.OAuth.Client.SentinelOAuthClient class.
        /// </summary>
        /// <param name="settings">Options for controlling the operation.</param>
        public SentinelOAuthClient(ISentinelClientSettings settings)
        {
            this.Settings = settings;

            this.cookieContainer = new CookieContainer();
            this.handler = new HttpClientHandler()
            {
                CookieContainer = this.cookieContainer,
                UseCookies = true,
                AllowAutoRedirect = false
            };

            if (this.handler.SupportsAutomaticDecompression)
            {
                this.handler.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
            }

            this.Client = new HttpClient(this.handler) { BaseAddress = settings.Url };
        }