private List <string> GetSandboxDirectiveList(ICspSandboxDirectiveConfiguration directive) { if (directive == null || !directive.Enabled) { return(null); } var sources = new List <string>(); if (directive.AllowForms) { sources.Add("allow-forms"); } if (directive.AllowPointerLock) { sources.Add("allow-pointer-lock"); } if (directive.AllowPopups) { sources.Add("allow-popups"); } if (directive.AllowSameOrigin) { sources.Add("allow-same-origin"); } if (directive.AllowScripts) { sources.Add("allow-scripts"); } if (directive.AllowTopNavigation) { sources.Add("allow-top-navigation"); } return(sources); //We want to return empty list and not null }
public ICspSandboxDirectiveConfiguration GetOverridenCspSandboxConfig(CspSandboxOverride directiveOverride, ICspSandboxDirectiveConfiguration directiveConfig) { var result = directiveConfig ?? new CspSandboxDirectiveConfiguration(); result.Enabled = directiveOverride.Enabled; if (directiveOverride.AllowForms.HasValue) { result.AllowForms = (bool)directiveOverride.AllowForms; } if (directiveOverride.AllowPointerLock.HasValue) { result.AllowPointerLock = (bool)directiveOverride.AllowPointerLock; } if (directiveOverride.AllowPopups.HasValue) { result.AllowPopups = (bool)directiveOverride.AllowPopups; } if (directiveOverride.AllowSameOrigin.HasValue) { result.AllowSameOrigin = (bool)directiveOverride.AllowSameOrigin; } if (directiveOverride.AllowScripts.HasValue) { result.AllowScripts = (bool)directiveOverride.AllowScripts; } if (directiveOverride.AllowTopNavigation.HasValue) { result.AllowTopNavigation = (bool)directiveOverride.AllowTopNavigation; } return result; }
public ICspSandboxDirectiveConfiguration GetOverridenCspSandboxConfig(CspSandboxOverride directiveOverride, ICspSandboxDirectiveConfiguration directiveConfig) { var result = directiveConfig ?? new CspSandboxDirectiveConfiguration(); result.Enabled = directiveOverride.Enabled; if (directiveOverride.AllowForms.HasValue) { result.AllowForms = (bool)directiveOverride.AllowForms; } if (directiveOverride.AllowPointerLock.HasValue) { result.AllowPointerLock = (bool)directiveOverride.AllowPointerLock; } if (directiveOverride.AllowPopups.HasValue) { result.AllowPopups = (bool)directiveOverride.AllowPopups; } if (directiveOverride.AllowSameOrigin.HasValue) { result.AllowSameOrigin = (bool)directiveOverride.AllowSameOrigin; } if (directiveOverride.AllowScripts.HasValue) { result.AllowScripts = (bool)directiveOverride.AllowScripts; } if (directiveOverride.AllowTopNavigation.HasValue) { result.AllowTopNavigation = (bool)directiveOverride.AllowTopNavigation; } return(result); }
private List<string> GetSandboxDirectiveList(ICspSandboxDirectiveConfiguration directive) { if (directive == null || !directive.Enabled) return null; var sources = new List<string>(); if (directive.AllowForms) { sources.Add("allow-forms"); } if (directive.AllowPointerLock) { sources.Add("allow-pointer-lock"); } if (directive.AllowPopups) { sources.Add("allow-popups"); } if (directive.AllowSameOrigin) { sources.Add("allow-same-origin"); } if (directive.AllowScripts) { sources.Add("allow-scripts"); } if (directive.AllowTopNavigation) { sources.Add("allow-top-navigation"); } return sources; //We want to return empty list and not null }