private bool AnyValues() { return(BaseUri.Any() || DefaultSrc.Any() || ScriptSrc.Any() || ObjectSrc.Any() || StyleSrc.Any() || ImgSrc.Any() || MediaSrc.Any() || FrameSrc.Any() || ChildSrc.Any() || FrameAncestors.Any() || FontSrc.Any() || ConnectSrc.Any() || ManifestSrc.Any() || FormAction.Any()); }
public Tuple <string, string> ToString(ICspNonceService nonceService) { string headerName; if (ReportOnly) { headerName = "Content-Security-Policy-Report-Only"; } else { headerName = "Content-Security-Policy"; } ICollection <string> values = new List <string> { DefaultSrc.ToString(nonceService), ScriptSrc.ToString(nonceService), StyleSrc.ToString(nonceService), ChildSrc.ToString(nonceService), ConnectSrc.ToString(nonceService), FontSrc.ToString(nonceService), FormAction.ToString(nonceService), ImgSrc.ToString(nonceService), MediaSrc.ToString(nonceService), ObjectSrc.ToString(nonceService), FrameAncestors.ToString(), PluginTypes.ToString() }; if (EnableSandbox) { values.Add(Sandbox.ToString()); } if (ReportUri != null) { values.Add("report-uri " + ReportUri); } string headerValue = string.Join(";", values.Where(s => s.Length > 0)); return(new Tuple <string, string>(headerName, headerValue)); }