code: 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);
              this.samlResponseBuilder.encodeSamlResponse(samlResponse, request, response);
          }
      }
docs: 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