@Override
    public Optional<RedirectionAction> getRedirectionAction(final CallContext ctx) {
        val context = this.client.getContextProvider().buildContext(ctx, this.client);
        val relayState = this.client.getStateGenerator().generateValue(ctx);

        val authnRequest = this.saml2ObjectBuilder.build(context);
        this.client.getWebSsoMessageSender().sendMessage(context, authnRequest, relayState);

        val adapter = context.getProfileRequestContextOutboundMessageTransportResponse();

        val webContext = ctx.webContext();

        val bindingType = this.client.getConfiguration().getAuthnRequestBindingType();
        if (SAMLConstants.SAML2_POST_BINDING_URI.equalsIgnoreCase(bindingType) ||
            SAMLConstants.SAML2_POST_SIMPLE_SIGN_BINDING_URI.equalsIgnoreCase(bindingType)) {
            val content = adapter.getOutgoingContent();
            return Optional.of(HttpActionHelper.buildFormPostContentAction(webContext, content));
        }
        val location = adapter.getRedirectUrl();
        return Optional.of(HttpActionHelper.buildRedirectUrlAction(webContext, location));
    }
Redirection action builder for SAML 2.

@author Jerome Leleu
@since 2.0.0
pac4j-saml/src/main/java/org/pac4j/saml/redirect/SAML2RedirectionActionBuilder.java