Exemple #1
0
        public override Task <T> CookieAuthGET <T>(D8Cookie cookie, string resourceUrl, CancellationToken cancelTkn)
        {
            var client = new JsonServiceClient(Creds.BaseURL);

            client.SetCookie(cookie.Name, cookie.Id);

            return(Retry.Forever <T>(resourceUrl, (x, ct)
                                     => client.GetAsync <string>(resourceUrl), cancelTkn));
        }
Exemple #2
0
        public override Task <T> CookieAuthPOST <T>(D8Cookie cookie, string resourceUrl, CancellationToken cancelTkn)
        {
            var client = new JsonServiceClient(Creds.BaseURL);

            client.SetCookie(cookie.Name, cookie.Id);

            return(Retry.Forever <T>(resourceUrl, (url, ct)
                                     //=> client.PostAsync<string>(resourceUrl, null), cancelTkn);
                                     //=> resourceUrl.PostToUrlAsync(string.Empty, requestFilter: req => { req.Headers["X-CSRF-Token"] = CsrfToken; }), cancelTkn);
                                     => url.PostToUrlAsync(string.Empty, "application/json", r => SetBasicAuthRequest(r)), cancelTkn));
        }
Exemple #3
0
        private JsonServiceClient CookieAuthClient()
        {
            if (_cookie == null)
            {
                throw new InvalidOperationException("POST a Session Cookie request first before performing an CookieAuth operation.");
            }

            var client = new JsonServiceClient(_creds.ApiBaseURL);

            client.SetCookie(_cookie.Name, _cookie.Id);
            //client.SetCookie(_cookie.Id, _cookie.Name + "sdasdas");
            return(client);
        }