@Override
    protected Envelope buildResponse(final Optional<Assertion> assertion, final SamlProfileBuilderContext context) {
        val ticket = (SamlArtifactTicket) context.getAuthenticatedAssertion().orElseThrow().getAttributes().get("artifact");
        val artifactResponse = new ArtifactResponseBuilder().buildObject();
        artifactResponse.setIssueInstant(ZonedDateTime.now(ZoneOffset.UTC).toInstant());
        artifactResponse.setIssuer(newIssuer(ticket.getIssuer()));
        artifactResponse.setInResponseTo(ticket.getRelyingPartyId());
        artifactResponse.setID(ticket.getId());
        artifactResponse.setStatus(newStatus(StatusCode.SUCCESS, "Success"));

        val samlResponse = SamlUtils.transformSamlObject(openSamlConfigBean, ticket.getObject(), SAMLObject.class);
        artifactResponse.setMessage(samlResponse);

        val header = SamlUtils.newSoapObject(Header.class);

        val body = SamlUtils.newSoapObject(Body.class);
        body.getUnknownXMLObjects().add(artifactResponse);

        val envelope = SamlUtils.newSoapObject(Envelope.class);
        envelope.setHeader(header);
        envelope.setBody(body);
        openSamlConfigBean.logObject(envelope);
        return envelope;
    }
This is {@link SamlProfileArtifactResponseBuilder}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/builders/response/artifact/SamlProfileArtifactResponseBuilder.java