public static IApplicationBuilder UseContentSecurityPolicy(this IApplicationBuilder app, Action <ContentSecurityPolicyOptionsBuilder> builder)
        {
            ContentSecurityPolicyOptionsBuilder newBuilder = new ContentSecurityPolicyOptionsBuilder();

            builder(newBuilder);
            ContentSecurityPolicyOptions options = newBuilder.Build();

            return(app.UseMiddleware <ContentSecurityPolicyMiddleware>(options));
        }
示例#2
0
 public ContentSecurityPolicyMiddleware(RequestDelegate next, ContentSecurityPolicyOptions options)
 {
     this.next    = next;
     this.options = options;
 }