protected AccountRegistrationResponse buildAccountRegistrationResponse(final HttpResponse response) {
        return FunctionUtils.doUnchecked(() -> {
            if (HttpStatus.valueOf(response.getCode()).is2xxSuccessful()) {
                try (val content = ((HttpEntityContainer) response).getEntity().getContent()) {
                    val entity = IOUtils.toString(content, StandardCharsets.UTF_8);
                    val success = AccountRegistrationResponse.success();
                    Arrays.stream(response.getHeaders())
                            .forEach(header -> success.putProperty(header.getName(), header.getValue()));
                    FunctionUtils.doIf(StringUtils.isNotBlank(entity),
                            value -> success.putProperty("entity", value)).accept(StringUtils.defaultString(entity));
                    success.putProperty("status", response.getCode());
                    success.putProperty("entity", StringUtils.defaultString(entity));
                    return success;
                }
            }
            val details = CollectionUtils.wrap("status", response.getCode(),
                "reason", response.getReasonPhrase());
            Arrays.stream(response.getHeaders())
                .forEach(header -> details.put(header.getName(), header.getValue()));
            return new AccountRegistrationResponse(details);
        });
    }
This is {@link RestfulAccountRegistrationProvisioner}.

@author Misagh Moayyed
@since 6.5.0
support/cas-server-support-account-mgmt-core/src/main/java/org/apereo/cas/acct/provision/RestfulAccountRegistrationProvisioner.java