Exemplo n.º 1
0
        public ContentSecurityPolicyActionFilterAttribute(Action <ContentSecurityPolicyOptionsBuilder> builder)
        {
            var newBuilder = new ContentSecurityPolicyOptionsBuilder();

            builder(newBuilder);

            var contentSecurityPolicyOptions = newBuilder.Build();

            _handleHeader = new HandleHeader(contentSecurityPolicyOptions);
        }
Exemplo n.º 2
0
        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));
        }