protected void finalizeEncode(final RequestAbstractType authnRequest,
                                  final BaseSAML2MessageEncoder encoder,
                                  final T samlResponse,
                                  final String relayState,
                                  final MessageContext messageContext) {
        FunctionUtils.doUnchecked(__ -> {
            encoder.initialize();
            encoder.encode();
        });
    }
Build encoder message context.

@param request        the authn request
@param samlObject     the saml response
@param relayState     the relay state
@param messageContext the message context
@return the message context
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/enc/encoder/BaseHttpServletAwareSamlObjectEncoder.java