public ContentSecurityPolicyActionFilterAttribute(Action <ContentSecurityPolicyOptionsBuilder> builder) { var newBuilder = new ContentSecurityPolicyOptionsBuilder(); builder(newBuilder); var contentSecurityPolicyOptions = newBuilder.Build(); _handleHeader = new HandleHeader(contentSecurityPolicyOptions); }
public static IApplicationBuilder UseCsp( this IApplicationBuilder app, Action <ContentSecurityPolicyOptionsBuilder> builder) { var newBuilder = new ContentSecurityPolicyOptionsBuilder(); builder(newBuilder); var options = newBuilder.Build(); return(app.UseMiddleware <ContentSecurityPolicyMiddleware>(options)); }