Package org.zkoss.zk.ui.http
Class CspProviderImpl
java.lang.Object
org.zkoss.zk.ui.http.CspProviderImpl
- All Implemented Interfaces:
CspProvider
An
CspProvider implementation for Csp functions
and applies.- Author:
- peakerlee
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the current CSP nonce for use in inline scripts if no nonce is available.voidsetCspHeader(Execution exec, Configuration config) Sets the CSP header for the given execution based on the configuration.
-
Constructor Details
-
CspProviderImpl
public CspProviderImpl()
-
-
Method Details
-
setCspHeader
Description copied from interface:CspProviderSets the CSP header for the given execution based on the configuration.The actual headers applied to depend on the provided configuration, including whether report-only mode is enabled and whether a custom policy is specified.
- Specified by:
setCspHeaderin interfaceCspProvider- Parameters:
exec- the execution being processedconfig- the CSP configuration
-
getCspNonce
Description copied from interface:CspProviderReturns the current CSP nonce for use in inline scripts if no nonce is available.If a nonce has already been generated for the current execution, it is returned; otherwise, a new cryptographically secure, Base64-encoded nonce is generated. The nonce is typically used for inline script tags in strict-dynamic mode but can be retrieved regardless of the mode.
- Specified by:
getCspNoncein interfaceCspProvider- Returns:
- the current CSP nonce
-