/// <summary>
 /// Appends a new Content Security Policy to the existing policy, and returns the updated policy.
 /// </summary>
 /// <param name="policy">The policy.</param>
 /// <returns></returns>
 public ContentSecurityPolicy AppendPolicy(ContentSecurityPolicy policy)
 {
     if (policy != null)
     {
         this.ParsePolicy(policy.ToString());
     }
     return(this);
 }
Beispiel #2
0
 /// <summary>
 /// Replaces the existing Content Security Policy with a new one
 /// </summary>
 /// <param name="policy">The policy.</param>
 /// <returns></returns>
 public ContentSecurityPolicyHeaders ReplacePolicy(string policy)
 {
     _policy = new ContentSecurityPolicy();
     return(AppendPolicy(policy));
 }
Beispiel #3
0
 /// <summary>
 /// Appends a Content Security Policy to the existing policy.
 /// </summary>
 /// <param name="policy">The policy.</param>
 /// <returns></returns>
 public ContentSecurityPolicyHeaders AppendPolicy(ContentSecurityPolicy policy)
 {
     _policy.AppendPolicy(policy.ToString());
     return(this);
 }
Beispiel #4
0
 private static void UpdateHeaders(HttpHeaders responseHeaders, ContentSecurityPolicy policy)
 {
     responseHeaders.Remove("Content-Security-Policy");
     responseHeaders.Add("Content-Security-Policy", policy.ToString());
 }
Beispiel #5
0
 private static void UpdateHeaders(NameValueCollection responseHeaders, ContentSecurityPolicy policy)
 {
     responseHeaders.Remove("Content-Security-Policy");
     responseHeaders.Add("Content-Security-Policy", policy.ToString());
 }
Beispiel #6
0
 /// <summary>
 /// Replaces the existing Content Security Policy with a new one
 /// </summary>
 /// <param name="policy">The policy.</param>
 /// <returns></returns>
 public ContentSecurityPolicyHeaders ReplacePolicy(ContentSecurityPolicy policy)
 {
     _policy = policy;
     return(this);
 }