Ejemplo n.º 1
0
        public static SecureNativeContextBuilder FromHttpRequest(HttpWebRequest request, SecureNativeOptions options)
        {
            var headers = RequestUtils.GetHeadersFromRequest(request, options);

            var clientToken = RequestUtils.GetCookieValueFromRequest(request, RequestUtils.SecurenativeCookie);

            if (string.IsNullOrEmpty(clientToken))
            {
                clientToken = RequestUtils.GetSecureHeaderFromRequest(headers);
            }

            return(new SecureNativeContextBuilder()
                   .WithUrl(request.RequestUri.ToString())
                   .WithMethod(request.Method)
                   .WithHeaders(headers)
                   .WithClientToken(clientToken)
                   .WithIp(RequestUtils.GetClientIpFromRequest(request, options))
                   .WithRemoteIp(RequestUtils.GetRemoteIpFromRequest(request))
                   .WithBody(null));
        }