@Override
    public Response build(final WebApplicationService service, final String serviceTicketId,
                          final Authentication authentication) {
        val parameters = new HashMap<String, String>();
        if (StringUtils.hasText(serviceTicketId)) {
            parameters.put(CasProtocolConstants.PARAMETER_TICKET, serviceTicketId);
        }

        val finalService = buildInternal(service, parameters);
        val responseType = getWebApplicationServiceResponseType(finalService);
        if (responseType == ResponseType.POST) {
            return buildPost(finalService, parameters);
        }
        if (responseType == ResponseType.REDIRECT) {
            return buildRedirect(finalService, parameters);
        }
        if (responseType == ResponseType.HEADER) {
            return buildHeader(finalService, parameters);
        }

        throw new IllegalArgumentException("Response type is invalid. Only " + Arrays.toString(ResponseType.values()) + " are supported");
    }
Default response builder that passes back the ticket
id to the original url of the service based on the response type.

@author Misagh Moayyed
@since 4.2
core/cas-server-core-services-authentication/src/main/java/org/apereo/cas/authentication/principal/WebApplicationServiceResponseBuilder.java