protected String determineServiceResponseUrl(final WebApplicationService service) {
        val registeredService = servicesManager.findServiceBy(service);
        if (registeredService instanceof final CasModelRegisteredService casService
            && StringUtils.isNotBlank(casService.getRedirectUrl())
            && getUrlValidator().isValid(casService.getRedirectUrl())) {
            return casService.getRedirectUrl();
        }
        return CollectionUtils.firstElement(service.getAttributes().get(Service.class.getName()))
            .map(Object::toString)
            .orElseGet(service::getOriginalUrl);
    }
Abstract response builder that provides wrappers for building
post and redirect responses.

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