use of org.opensaml.saml.saml1.binding.encoding.impl.HTTPSOAP11Encoder in project cas by apereo.
the class SamlProfileSamlSoap11ResponseBuilder method encode.
@Override
protected Envelope encode(final SamlRegisteredService service, final Envelope envelope, final HttpServletResponse httpResponse, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final String relayState) throws SamlException {
try {
final MessageContext result = new MessageContext();
final SOAP11Context ctx = result.getSubcontext(SOAP11Context.class, true);
ctx.setEnvelope(envelope);
final HTTPSOAP11Encoder encoder = new HTTPSOAP11Encoder();
encoder.setHttpServletResponse(httpResponse);
encoder.setMessageContext(result);
encoder.initialize();
encoder.encode();
} catch (final Exception e) {
throw Throwables.propagate(e);
}
return envelope;
}
use of org.opensaml.saml.saml1.binding.encoding.impl.HTTPSOAP11Encoder in project cas by apereo.
the class Saml10ObjectBuilder method encodeSamlResponse.
/**
* Encode response and pass it onto the outbound transport.
* Uses {@link CasHttpSoap11Encoder} to handle encoding.
*
* @param httpResponse the http response
* @param httpRequest the http request
* @param samlMessage the saml response
* @throws Exception the exception in case encoding fails.
*/
public void encodeSamlResponse(final HttpServletResponse httpResponse, final HttpServletRequest httpRequest, final Response samlMessage) throws Exception {
SamlUtils.logSamlObject(this.configBean, samlMessage);
final HTTPSOAP11Encoder encoder = new CasHttpSoap11Encoder();
final MessageContext<SAMLObject> context = new MessageContext();
context.setMessage(samlMessage);
encoder.setHttpServletResponse(httpResponse);
encoder.setMessageContext(context);
encoder.initialize();
encoder.prepareContext();
encoder.encode();
}
Aggregations