Class ContentSecurityPolicy
Provides helper methods for content security policy.
Inherited Members
Namespace: ComponentSpace.SAML2.Utility
Assembly: ComponentSpace.Saml2.dll
Syntax
public static class ContentSecurityPolicy
Methods
CreateHashedScriptSource(string)
Creates a SHA-256 hashed script source for inclusion in a Content-Security-Policy header.
Declaration
public static string CreateHashedScriptSource(string script)
Parameters
Type | Name | Description |
---|---|---|
string | script | The script |
Returns
Type | Description |
---|---|
string | The hashed script source. |
GetScript(string)
Gets the JavaScript contained within HTML.
Declaration
public static string GetScript(string html)
Parameters
Type | Name | Description |
---|---|---|
string | html | The HTML. |
Returns
Type | Description |
---|---|
string | The JavaScript contained within the script tags. |
HashScript(string)
Returns the SHA-256 hash of the JavaScript.
Declaration
public static string HashScript(string script)
Parameters
Type | Name | Description |
---|---|---|
string | script | The script. |
Returns
Type | Description |
---|---|
string | The hash of the script. |