protected void insertContentSecurityPolicyHeader(final HttpServletResponse httpServletResponse,
                                                     final HttpServletRequest httpServletRequest,
                                                     final String contentSecurityPolicy) {
        val uri = httpServletRequest.getRequestURI();
        var currentContentSecurityPolicy = contentSecurityPolicy;
        if (contentSecurityPolicy != null && contentSecurityPolicy.contains(CSP_DYNAMIC_NONCE)) {
            var generatedNonce = (String) httpServletRequest.getAttribute(CSP_GENERATED_NONCE);
            if (StringUtils.isBlank(generatedNonce)) {
                generatedNonce = RandomUtils.randomAlphanumeric(CSP_DYNAMIC_NONCE_SIZE);
                httpServletRequest.setAttribute(CSP_GENERATED_NONCE, generatedNonce);
            }
            currentContentSecurityPolicy = currentContentSecurityPolicy.replace(CSP_DYNAMIC_NONCE, generatedNonce);
        }
        httpServletResponse.addHeader("Content-Security-Policy", currentContentSecurityPolicy);
        LOGGER.trace("Adding Content-Security-Policy response header [{}] for [{}]", currentContentSecurityPolicy, uri);
    }
Insert content security policy header.

@param httpServletResponse the http servlet response
@param httpServletRequest  the http servlet request
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/filters/ResponseHeadersEnforcementFilter.java