public static Func<Func<IDictionary<string, object>, Task>, Func<IDictionary<string, object>, Task>> ContentSecurityPolicyHeader(ContentSecurityPolicyConfiguration configuration)
 {
     return next =>
         env => {
             var context = env.AsContext();
             var state = new State<ContentSecurityPolicyConfiguration> {
                 Settings = configuration,
                 Response = context.Response
             };
             context.Response.OnSendingHeaders(ApplyHeader, state);
             return next(env);
         };
 }
Exemplo n.º 2
0
 public static Func <Func <IDictionary <string, object>, Task>, Func <IDictionary <string, object>, Task> > ContentSecurityPolicyHeader(ContentSecurityPolicyConfiguration configuration)
 {
     return(next =>
            env => {
         var context = env.AsContext();
         var state = new State <ContentSecurityPolicyConfiguration> {
             Settings = configuration,
             Response = context.Response
         };
         context.Response.OnSendingHeaders(ApplyHeader, state);
         return next(env);
     });
 }
 /// <summary>
 ///     Adds the "Content-Security-Policy-Report-Only" (CSP) header with the given configuration to the response.
 /// </summary>
 /// <param name="builder">The OWIN builder instance.</param>
 /// <param name="configuration">The Content-Security-Policy configuration.</param>
 /// <returns>The OWIN builder instance.</returns>
 public static BuildFunc ContentSecurityPolicyReportOnly(this BuildFunc builder, ContentSecurityPolicyConfiguration configuration)
 {
     configuration.MustNotNull("configuration");
     builder(_ => ContentSecurityPolicyReportOnlyMiddleware.ContentSecurityPolicyHeader(configuration));
     return(builder);
 }
 /// <summary>
 ///     Adds the "Content-Security-Policy-Report-Only" (CSP) header with the given configuration to the response.
 /// </summary>
 /// <param name="builder">The OWIN builder instance.</param>
 /// <param name="configuration">The Content-Security-Policy configuration.</param>
 /// <returns>The OWIN builder instance.</returns>
 public static BuildFunc ContentSecurityPolicyReportOnly(this BuildFunc builder, ContentSecurityPolicyConfiguration configuration)
 {
     configuration.MustNotNull("configuration");
     builder(_ => ContentSecurityPolicyReportOnlyMiddleware.ContentSecurityPolicyHeader(configuration));
     return builder;
 }