@Override
    public boolean submit(final RequestContext requestContext) {
        HttpResponse response = null;
        try {
            val rest = aupProperties.getRest();
            val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(requestContext);
            val principal = WebUtils.getAuthentication(requestContext).getPrincipal();
            val parameters = CollectionUtils.<String, String>wrap(
                "username", principal.getId(),
                "locale", request.getLocale().toString());
            val service = WebUtils.getService(requestContext);
            FunctionUtils.doIfNotNull(service, __ -> parameters.put("service", service.getId()));
            LOGGER.debug("Sending AUP acceptance payload [{}] to [{}]", rest.getUrl(), parameters);
            val exec = HttpExecutionRequest.builder()
                .basicAuthPassword(rest.getBasicAuthPassword())
                .basicAuthUsername(rest.getBasicAuthUsername())
                .method(HttpMethod.POST)
                .url(rest.getUrl())
                .httpClient(this.httpClient)
                .parameters(parameters)
                .headers(rest.getHeaders())
                .build();
            response = HttpUtils.execute(exec);
            val statusCode = Optional.ofNullable(response).map(HttpResponse::getCode).orElseGet(HttpStatus.SERVICE_UNAVAILABLE::value);
            LOGGER.debug("AUP submit policy request returned with response code [{}]", statusCode);
            return HttpStatus.valueOf(statusCode).is2xxSuccessful();
        } finally {
            HttpUtils.close(response);
        }
    }
This is {@link RestAcceptableUsagePolicyRepository}.
Examines the principal attribute collection to determine if
the policy has been accepted, and if not, allows for a configurable
way so that user's choice can later be remembered and saved back via REST.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-aup-rest/src/main/java/org/apereo/cas/aup/RestAcceptableUsagePolicyRepository.java