/// <summary>
        /// Adds a <c>X-Frame-Options</c> header to the response.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="option">Determines whether the header value is <c>DENY</c> or <c>SAMEORIGIN</c>.</param>
        /// <returns></returns>
        public static IApplicationBuilder UseXFrameOptionsHeader(this IApplicationBuilder builder, XFrameOption option)
        {
            var options = new XFrameOptions
            {
                Option = option
            };

            return(builder.UseMiddleware <XFrameOptionsHeaderMiddleware>(Options.Create(options)));
        }
示例#2
0
 /// <summary>
 /// Initialises a new <see cref="XFrameOptionsHeaderMiddleware"/> instance.
 /// </summary>
 /// <param name="next">The next middleware in the request pipeline.</param>
 /// <param name="options">The options to configure this middleware.</param>
 public XFrameOptionsHeaderMiddleware(RequestDelegate next, IOptions <XFrameOptions> options)
 {
     _next    = next;
     _options = options.Value;
 }