private static String getRelativeRedirectUrlFor(final WsFederationConfiguration config,
                                                    final WebApplicationService service,
                                                    final HttpServletRequest request) throws Exception {
        val builder = new URIBuilder(WsFederationNavigationController.ENDPOINT_REDIRECT);
        builder.addParameter(WsFederationNavigationController.PARAMETER_NAME, config.getId());
        if (service != null) {
            builder.addParameter(service.getSource(), service.getId());
        }
        val method = request.getParameter(CasProtocolConstants.PARAMETER_METHOD);
        if (StringUtils.isNotBlank(method)) {
            builder.addParameter(CasProtocolConstants.PARAMETER_METHOD, method);
        }
        return builder.toString();
    }
This is {@link WsFederationRequestBuilder}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-wsfederation-webflow/src/main/java/org/apereo/cas/web/flow/WsFederationRequestBuilder.java