Log in
Helper

CspNonceProvider

Magento\Csp\Helper\CspNonceProvider

What it does

This helper class generates secure cryptographic nonces (number used once) for Content Security Policy (CSP) headers.

Developers use this when they need to allow specific inline scripts to execute by adding the nonce to both the CSP header and the script tag's nonce attribute.

The class automatically adds the generated nonce to the script-src CSP directive.

Public Methods

  • generateNonce()