Search in sources :

Example 1 with HTTPSOAP11Encoder

use of org.opensaml.saml.saml2.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;
}
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 HTTPSOAP11Encoder

use of org.opensaml.saml.saml2.binding.encoding.impl.HTTPSOAP11Encoder in project cas by apereo.

the class SamlProfileSamlSoap11ResponseBuilder method encode.

@Override
protected Envelope encode(final SamlProfileBuilderContext context, final Envelope envelope, final String relayState) throws Exception {
    val ctx = context.getMessageContext().getSubcontext(SOAP11Context.class, true);
    Objects.requireNonNull(ctx).setEnvelope(envelope);
    val encoder = new HTTPSOAP11Encoder();
    encoder.setHttpServletResponse(context.getHttpResponse());
    encoder.setMessageContext(context.getMessageContext());
    encoder.initialize();
    encoder.encode();
    return envelope;
}
Also used : lombok.val(lombok.val) HTTPSOAP11Encoder(org.opensaml.saml.saml2.binding.encoding.impl.HTTPSOAP11Encoder)

Example 3 with HTTPSOAP11Encoder

use of org.opensaml.saml.saml2.binding.encoding.impl.HTTPSOAP11Encoder 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

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