use of org.opensaml.saml.saml2.core.ArtifactResponse in project cas by apereo.
the class SamlProfileArtifactResponseBuilder method buildResponse.
@Override
protected Envelope buildResponse(final Assertion assertion, final Object casAssertion, final RequestAbstractType authnRequest, final SamlRegisteredService service, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final HttpServletRequest request, final HttpServletResponse response, final String binding) throws SamlException {
final org.jasig.cas.client.validation.Assertion castedAssertion = org.jasig.cas.client.validation.Assertion.class.cast(casAssertion);
final SamlArtifactTicket ticket = (SamlArtifactTicket) castedAssertion.getAttributes().get("artifact");
final ArtifactResponse artifactResponse = new ArtifactResponseBuilder().buildObject();
artifactResponse.setIssueInstant(DateTime.now());
artifactResponse.setIssuer(newIssuer(ticket.getIssuer()));
artifactResponse.setInResponseTo(ticket.getRelyingPartyId());
artifactResponse.setID(ticket.getId());
artifactResponse.setStatus(newStatus(StatusCode.SUCCESS, "Success"));
final SAMLObject samlResponse = SamlUtils.transformSamlObject(configBean, ticket.getObject(), SAMLObject.class);
artifactResponse.setMessage(samlResponse);
final Header header = newSoapObject(Header.class);
final Body body = newSoapObject(Body.class);
body.getUnknownXMLObjects().add(artifactResponse);
final Envelope envelope = newSoapObject(Envelope.class);
envelope.setHeader(header);
envelope.setBody(body);
SamlUtils.logSamlObject(this.configBean, envelope);
return envelope;
}
Aggregations