Search in sources :

Example 1 with SOAP11Context

use of org.opensaml.soap.messaging.context.SOAP11Context 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;
}
Also used : SOAP11Context(org.opensaml.soap.messaging.context.SOAP11Context) HTTPSOAP11Encoder(org.opensaml.saml.saml2.binding.encoding.impl.HTTPSOAP11Encoder) MessageContext(org.opensaml.messaging.context.MessageContext) SamlException(org.apereo.cas.support.saml.SamlException)

Example 2 with SOAP11Context

use of org.opensaml.soap.messaging.context.SOAP11Context in project cas by apereo.

the class SamlProfileSamlSoap11ResponseBuilder method encode.

@Override
@SneakyThrows
protected Envelope encode(final SamlRegisteredService service, final Envelope envelope, final HttpServletResponse httpResponse, final HttpServletRequest httpRequest, final SamlRegisteredServiceServiceProviderMetadataFacade adaptor, final String relayState, final String binding, final RequestAbstractType authnRequest, final Object assertion) throws SamlException {
    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();
    return envelope;
}
Also used : SOAP11Context(org.opensaml.soap.messaging.context.SOAP11Context) HTTPSOAP11Encoder(org.opensaml.saml.saml2.binding.encoding.impl.HTTPSOAP11Encoder) MessageContext(org.opensaml.messaging.context.MessageContext) SneakyThrows(lombok.SneakyThrows)

Aggregations

MessageContext (org.opensaml.messaging.context.MessageContext)2 HTTPSOAP11Encoder (org.opensaml.saml.saml2.binding.encoding.impl.HTTPSOAP11Encoder)2 SOAP11Context (org.opensaml.soap.messaging.context.SOAP11Context)2 SneakyThrows (lombok.SneakyThrows)1 SamlException (org.apereo.cas.support.saml.SamlException)1