NSWDPC\Utilities\ContentSecurityPolicy\Nonce
Model handling creation and retrieval of a nonce
- Author: james.ellis@dpc.nsw.gov.au
Synopsis
class Nonce
{
- // constants
- const MIN_LENGTH = 16;
- // methods
- public void __construct()
- private static void create()
- public static string getNonce()
- public static void addToAttributes()
- public static void addToElements()
- protected static bool applicableElement()
Constants
Name | Value |
---|---|
MIN_LENGTH | 16 |
Members
private
- $length — int
- $nonce — string
Methods
private
- create() — Create a nonce
protected
- applicableElement() — Inline script and all style elements are given a nonce Elements referencing an external resource should have their hosts referenced in the CSP script-src directive
public
- __construct()
- addToAttributes() — Add nonce to an array of HTML attributes
- addToElements() — Add nonce to HTML nodes
- getNonce() — Return the nonce