示例#1
0
 /// <inheritdoc/>
 public void SetHeaders(HttpContext context)
 {
     if (_options.Value.UseSetHeaderProperties)
     {
         SetHeaders(context, _flowDataProvider.GetFlowData());
     }
 }
示例#2
0
        public string Get()
        {
            var device = _flow.GetFlowData()?.Get <IDeviceData>();

            if (device != null)
            {
                return($"{device.IsMobile}");
            }
            return("Hash engine data was null");
        }
        public string Get()
        {
            var math = _flow.GetFlowData()?.Get(MathElement.math);

            if (math != null)
            {
                return($"{math.Operation} = {math.Result}");
            }
            return("math engine data was null");
        }
示例#4
0
        public IActionResult Index()
        {
            // Get the flow data for this request.
            var flowData = _flowDataProvider.GetFlowData();

            // Set the message to be displayed in the view. The JavaScript is
            // added in the view.
            ViewData["message"] = $"With a date of birth of" +
                                  $" {flowData.GetEvidence()["cookie.date-of-birth"]}," +
                                  $" your star sign is" +
                                  $" {flowData.Get<IStarSignData>().StarSign}.";
            return(View());
        }
        public IActionResult Index()
        {
            var math = _flow.GetFlowData()?.Get(MathElement.math);

            if (math != null)
            {
                ViewData["Message"] = $"{math.Operation} = {math.Result}";
            }
            else
            {
                ViewData["Message"] = "No 'FlowData' found. This is usually " +
                                      "because the 51Degrees middleware component has not run, " +
                                      "possibly due to being after some other middleware " +
                                      "component that has blocked further execution " +
                                      "(For example, requiring HTTPS).";
            }
            return(View());
        }
        /// <summary>
        /// Add the JavaScript from the flow data object to the HttpResponse
        /// </summary>
        /// <param name="context">
        /// The HttpContext containing the HttpResponse to add the
        /// JavaScript to.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown if a required parameter is null.
        /// </exception>
        public void ServeJavascript(HttpContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            // Get the hash code.
            var flowData = _flowDataProvider.GetFlowData();
            // TODO: Should this use a Guid version of the hash code to
            // allow a larger key space or is int sufficient?
            var hash = flowData.GenerateKey(_pipeline.EvidenceKeyFilter).GetHashCode();

            if (hash == context.Request.Headers["If-None-Match"])
            {
                // The response hasn't changed so respond with a 304.
                context.Response.StatusCode = 304;
            }
            else
            {
                // Otherwise, return the minified script to the client.
                var builder = flowData.Pipeline.GetElement <JavaScriptBuilderElement>();
                if (builder == null)
                {
                    throw new PipelineConfigurationException(
                              Messages.ExceptionNoJavaScriptBuilder);
                }
                var builderData = flowData.GetFromElement(builder);

                SetHeaders(context,
                           hash.ToString(CultureInfo.InvariantCulture),
                           builderData.JavaScript.Length);

                context.Response.WriteAsync(builderData.JavaScript);
            }
        }
        public IActionResult Index()
        {
            var data = _flow.GetFlowData().Get <IDeviceData>();

            return(View(data));
        }
 public IActionResult Index()
 {
     return(View(_flow.GetFlowData()));
 }