protected void finalizeSamlResponse(final HttpServletRequest request, final HttpServletResponse response,
                                        final String serviceId, final Response samlResponse) throws Exception {
        if (request != null && response != null) {
            LOGGER.debug("Starting to encode SAML response for service [{}]", serviceId);
            samlResponseBuilder.encodeSamlResponse(samlResponse, request, response);
        }
    }
Finalize saml response.

@param request      the request
@param response     the response
@param serviceId    the service id
@param samlResponse the saml response
@throws Exception the exception
support/cas-server-support-saml/src/main/java/org/apereo/cas/support/saml/web/view/AbstractSaml10ResponseView.java