Exemplo n.º 1
0
        public Task SendMessages(IEnumerable <TPayload> payloadList)
        {
            var token = _sessionInfo.GetSignedTokenString();

            var messages = payloadList
                           .Select(payload => CreateMessage(payload))
                           .ToList();

            return(_senderClient.SendAsync(messages));
        }
Exemplo n.º 2
0
        private List <KeyValuePair <string, string> > AddCreyAuth(List <KeyValuePair <string, string> > originalHeaderContent, string uri)
        {
            List <KeyValuePair <string, string> > headerContent = originalHeaderContent;

            if (headerContent == null)
            {
                headerContent = new List <KeyValuePair <string, string> >();
            }

            if (!headerContent.Any(header => header.Key.Equals("crey-internal-key")))
            {
                var cookies = new List <CookieHeaderValue>();

                {
                    string cookieValue = sessionInfoStore_.GetSignedTokenString();
                    string cookieName  = configuration_.GetSessionCookieName();
                    if (!string.IsNullOrEmpty(cookieValue) && !string.IsNullOrEmpty(cookieName))
                    {
                        cookies.Add(new CookieHeaderValue(cookieName, cookieValue));
                    }
                }

                // Add headers
                headerContent.AddService2ServiceHeaderPolicy(configuration_, Service2ServicePolicy.InternalPolicy);
                headerContent.Add(new KeyValuePair <string, string>(Microsoft.Net.Http.Headers.HeaderNames.Cookie, string.Join("; ", cookies)));
            }

            return(headerContent);
        }