Search in sources :

Example 1 with HTTPSOAP11Encoder

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;
}
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.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();
}
Also used : SAMLObject(org.opensaml.saml.common.SAMLObject) HTTPSOAP11Encoder(org.opensaml.saml.saml1.binding.encoding.impl.HTTPSOAP11Encoder) MessageContext(org.opensaml.messaging.context.MessageContext)

Aggregations

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