private void redirectToIdentityProvider(
        final WSFederationRequest fedRequest,
        final HttpServletResponse response,
        final HttpServletRequest request,
        final WebApplicationService service,
        final WSFederationRegisteredService registeredService) throws Exception {
        val serviceUrl = constructServiceUrl(request, response, fedRequest);
        LOGGER.debug("Created service url [{}] mapped to [{}]", serviceUrl, registeredService);
        val renew = shouldRenewAuthentication(fedRequest, request);
        var initialUrl = constructRedirectUrl(
            getConfigContext().getCasProperties().getServer().getLoginUrl(), serviceUrl, renew);
        val builder = new URIBuilder(initialUrl);
        service.getAttributes().forEach((key, value)
            -> CollectionUtils.firstElement(value).map(Object::toString).ifPresent(v -> builder.addParameter(key, v)));
        initialUrl = builder.toString();
        LOGGER.debug("Redirecting authN request to [{}]", initialUrl);
        response.sendRedirect(initialUrl);
    }
Handle federation request.

@param response the response
@param request  the request
@throws Exception the exception
support/cas-server-support-ws-idp/src/main/java/org/apereo/cas/ws/idp/web/WSFederationValidateRequestController.java