protected ModelAndView renderValidationView(final HttpServletRequest request,
                                                final HttpServletResponse response,
                                                final Class viewClass) throws Throwable {
        val selectedService = (WebApplicationService) configurationContext.getServiceFactory()
            .createService(request, WebApplicationService.class);
        Assert.notNull(selectedService, "Service is missing and must be specified");

        val registeredService = configurationContext.getServicesManager().findServiceBy(selectedService);
        RegisteredServiceAccessStrategyUtils.ensureServiceAccessIsAllowed(selectedService, registeredService);

        val modelAndView = configurationContext.getValidationViewFactory()
            .getModelAndView(request, true, selectedService, viewClass);

        val authentication = buildAuthentication(request, selectedService);
        val context = RegisteredServiceAttributeReleasePolicyContext.builder()
            .registeredService(registeredService)
            .applicationContext(configurationContext.getApplicationContext())
            .service(selectedService)
            .principal(authentication.getPrincipal())
            .build();

        val attributesToRelease = registeredService.getAttributeReleasePolicy().getAttributes(context);
        val builder = DefaultAuthenticationBuilder.of(
            configurationContext.getApplicationContext(),
            authentication.getPrincipal(),
            configurationContext.getPrincipalFactory(),
            attributesToRelease,
            selectedService,
            registeredService,
            authentication);

        val finalAuthentication = builder.build();
        val assertion = DefaultAssertionBuilder.builder()
            .primaryAuthentication(finalAuthentication)
            .service(selectedService)
            .authentications(CollectionUtils.wrap(finalAuthentication))
            .registeredService(registeredService)
            .build()
            .assemble();

        modelAndView.addObject(CasViewConstants.MODEL_ATTRIBUTE_NAME_ASSERTION, assertion);
        modelAndView.addObject(CasViewConstants.MODEL_ATTRIBUTE_NAME_SERVICE, selectedService);
        modelAndView.addObject(CasViewConstants.MODEL_ATTRIBUTE_REGISTERED_SERVICE, registeredService);

        val requestWrapper = new ContentCachingRequestWrapper(request);
        val responseWrapper = new ContentCachingResponseWrapper(response);
        try {
            Objects.requireNonNull(modelAndView.getView()).render(modelAndView.getModel(), requestWrapper, responseWrapper);
        } finally {
            val responseArray = responseWrapper.getContentAsByteArray();
            val output = new String(responseArray, responseWrapper.getCharacterEncoding());
            modelAndView.addObject("response", output);
            modelAndView.setView(new MappingJackson2JsonView());
            modelAndView.setStatus(HttpStatus.OK);
        }
        return modelAndView;
    }
P3 service validate.

@param request  the request
@param response the response
@throws Throwable the throwable
support/cas-server-support-reports-core/src/main/java/org/apereo/cas/web/report/CasProtocolValidationEndpoint.java