예제 #1
0
    /// <summary>
    /// Construct a new XFrameOptionsHeader
    /// </summary>
    /// <param name="options">The XFrameOptionsOptions to configure the header with</param>
    public XFrameOptionsHeader(XFrameOptionsOptions options)
    {
        options.EnsureNotNull(nameof(options));

        Key   = "X-Frame-Options";
        Value = options.Value;
    }
 public void WhenSetAllowFromUrlIsRequired_ResultIsCorrect()
 {
     Assert.Throws <ArgumentException>(() =>
     {
         var options = new XFrameOptionsOptions(XFrameOptionsOptions.XFrameOptionsValues.AllowFrom);
     });
 }
        public void ValueSetIsMaintained_ResultIsCorrect()
        {
            const XFrameOptionsOptions.XFrameOptionsValues expected
                = XFrameOptionsOptions.XFrameOptionsValues.AllowAll;

            var options = new XFrameOptionsOptions(expected);

            Assert.Equal(expected, options.HeaderValue);
        }
        public void DenySetByDefault_ResultIsCorrect()
        {
            var options = new XFrameOptionsOptions();

            Assert.Equal(XFrameOptionsOptions.XFrameOptionsValues.Deny, options.HeaderValue);
        }
예제 #5
0
 /// <summary>
 /// Construct a new XFrameOptionsMiddleware.
 /// </summary>
 /// <param name="next">The next RequestDelegate</param>
 /// <param name="options">The options for configuring the header.</param>
 public XFrameOptionsMiddleware(RequestDelegate next, XFrameOptionsOptions options)
 {
     _next    = next;
     _options = options;
 }