예제 #1
0
 /// <summary>
 /// Initialises a new <see cref="XFrameOptions"/> instance.
 /// </summary>
 /// <param name="option">The <see cref="XFrameOption"/> to use.</param>
 public XFrameOptions(XFrameOption option)
 {
     Option = option;
 }
        /// <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)));
        }