Search in sources :

Example 1 with Pac4jHTTPPostEncoder

use of org.pac4j.saml.transport.Pac4jHTTPPostEncoder in project pac4j by pac4j.

the class SAML2LogoutMessageSender method getMessageEncoder.

/**
 * Build the WebSSO handler for sending and receiving SAML2 messages.
 * @param ctx
 * @return the encoder instance
 */
private MessageEncoder getMessageEncoder(final SAML2MessageContext ctx) {
    final Pac4jSAMLResponse adapter = ctx.getProfileRequestContextOutboundMessageTransportResponse();
    if (SAMLConstants.SAML2_POST_BINDING_URI.equals(destinationBindingType)) {
        final VelocityEngine velocityEngine = VelocityEngineFactory.getEngine();
        final Pac4jHTTPPostEncoder encoder = new Pac4jHTTPPostEncoder(adapter);
        encoder.setVelocityEngine(velocityEngine);
        return encoder;
    }
    if (SAMLConstants.SAML2_REDIRECT_BINDING_URI.equals(destinationBindingType)) {
        final Pac4jHTTPRedirectDeflateEncoder encoder = new Pac4jHTTPRedirectDeflateEncoder(adapter, forceSignRedirectBindingLogoutRequest);
        return encoder;
    }
    throw new UnsupportedOperationException("Binding type - " + destinationBindingType + " is not supported");
}
Also used : VelocityEngine(org.apache.velocity.app.VelocityEngine) Pac4jSAMLResponse(org.pac4j.saml.transport.Pac4jSAMLResponse) Pac4jHTTPPostEncoder(org.pac4j.saml.transport.Pac4jHTTPPostEncoder) Pac4jHTTPRedirectDeflateEncoder(org.pac4j.saml.transport.Pac4jHTTPRedirectDeflateEncoder)

Example 2 with Pac4jHTTPPostEncoder

use of org.pac4j.saml.transport.Pac4jHTTPPostEncoder in project pac4j by pac4j.

the class SAML2WebSSOMessageSender method getMessageEncoder.

/**
 * Build the WebSSO handler for sending and receiving SAML2 messages.
 *
 * @param ctx the ctx
 * @return the encoder instance
 */
private MessageEncoder getMessageEncoder(final SAML2MessageContext ctx) {
    final Pac4jSAMLResponse adapter = ctx.getProfileRequestContextOutboundMessageTransportResponse();
    if (SAMLConstants.SAML2_POST_BINDING_URI.equals(destinationBindingType)) {
        final VelocityEngine velocityEngine = VelocityEngineFactory.getEngine();
        final Pac4jHTTPPostEncoder encoder = new Pac4jHTTPPostEncoder(adapter);
        encoder.setVelocityEngine(velocityEngine);
        return encoder;
    }
    if (SAMLConstants.SAML2_REDIRECT_BINDING_URI.equals(destinationBindingType)) {
        return new Pac4jHTTPRedirectDeflateEncoder(adapter, isAuthnRequestSigned);
    }
    throw new UnsupportedOperationException("Binding type - " + destinationBindingType + " is not supported");
}
Also used : VelocityEngine(org.apache.velocity.app.VelocityEngine) Pac4jSAMLResponse(org.pac4j.saml.transport.Pac4jSAMLResponse) Pac4jHTTPPostEncoder(org.pac4j.saml.transport.Pac4jHTTPPostEncoder) Pac4jHTTPRedirectDeflateEncoder(org.pac4j.saml.transport.Pac4jHTTPRedirectDeflateEncoder)

Aggregations

VelocityEngine (org.apache.velocity.app.VelocityEngine)2 Pac4jHTTPPostEncoder (org.pac4j.saml.transport.Pac4jHTTPPostEncoder)2 Pac4jHTTPRedirectDeflateEncoder (org.pac4j.saml.transport.Pac4jHTTPRedirectDeflateEncoder)2 Pac4jSAMLResponse (org.pac4j.saml.transport.Pac4jSAMLResponse)2