public static RedirectionAction buildFormPostContentAction(final WebContext context, final String content) {
        // is this an automatic form post generated by OpenSAML?
        if (content != null && content.contains("onload=\"document.forms[0].submit()\"")) {
            val url = StringEscapeUtils.unescapeHtml4(StringUtils.substringBetween(content, "<form action=\"", "\" method=\"post\">"));
            if (StringUtils.isNotBlank(url)) {
                val data = new HashMap<String, String>();
                val samlRequest = StringEscapeUtils
                    .unescapeHtml4(StringUtils.substringBetween(content, "name=\"SAMLRequest\" value=\"", "\"/>"));
                if (StringUtils.isNotBlank(samlRequest)) {
                    data.put("SAMLRequest", samlRequest);
                }
                val relayState = StringEscapeUtils
                    .unescapeHtml4(StringUtils.substringBetween(content, "name=\"RelayState\" value=\"", "\"/>"));
                if (StringUtils.isNotBlank(relayState)) {
                    data.put("RelayState", relayState);
                }
                val samlResponse = StringEscapeUtils
                    .unescapeHtml4(StringUtils.substringBetween(content, "name=\"SAMLResponse\" value=\"", "\"/>"));
                if (StringUtils.isNotBlank(samlResponse)) {
                    data.put("SAMLResponse", samlResponse);
                }
                return new AutomaticFormPostAction(url, data, content);
            }
        }
        return new OkAction(content);
    }
Build the appropriate redirection action for a content which is a form post.

@param context the web context
@param content the content
@return the appropriate redirection action
pac4j-core/src/main/java/org/pac4j/core/util/HttpActionHelper.java