@Override
    public boolean authorizeRequest(final RegisteredServiceAccessStrategyRequest request) {
        HttpResponse response = null;
        try {
            val attributes = new HashMap<>(request.getAttributes());
            attributes.put("serviceUrl", List.of(request.getService().getId()));
            attributes.put("serviceName", List.of(request.getRegisteredService().getName()));
            attributes.put("serviceId", List.of(request.getRegisteredService().getId()));
            attributes.put("serviceFriendlyName", List.of(request.getRegisteredService().getFriendlyName()));
            attributes.put("serviceType", List.of(request.getRegisteredService().getClass().getSimpleName()));

            val roles = attributes.getOrDefault(this.rolesAttribute, List.of()).stream().map(Object::toString).toList();
            val cerbosRequest = CerbosRequest
                .builder()
                .requestId(SpringExpressionLanguageValueResolver.getInstance().resolve(this.requestId))
                .principal(CerbosPrincipal.builder()
                    .id(request.getPrincipalId())
                    .scope(this.scope)
                    .roles(roles)
                    .attr(attributes)
                    .build())
                .resources(List.of(CerbosResources.builder()
                    .resource(CerbosResource.builder()
                        .id(String.valueOf(request.getRegisteredService().getId()))
                        .kind(this.kind)
                        .scope(this.scope)
                        .attr(attributes)
                        .build())
                    .actions(this.actions.toArray(ArrayUtils.EMPTY_STRING_ARRAY))
                    .build()))
                .auxData(this.auxData)
                .build();
            val headers = new HashMap<String, String>();
            headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
            if (StringUtils.isNotBlank(token)) {
                headers.put(HttpHeaders.AUTHORIZATION, "Bearer " + SpringExpressionLanguageValueResolver.getInstance().resolve(this.token));
            }

            val givenUrl = StringUtils.defaultIfBlank(SpringExpressionLanguageValueResolver.getInstance()
                .resolve(this.apiUrl), "http://localhost:3592");
            val url = StringUtils.removeEnd(givenUrl, "/") + "/api/check/resources";
            val exec = HttpExecutionRequest.builder()
                .method(HttpMethod.POST)
                .url(url)
                .headers(headers)
                .entity(cerbosRequest.toJson())
                .build();
            LOGGER.debug("Submitting authorization request to [{}] for [{}]", url, cerbosRequest);
            response = HttpUtils.execute(exec);

            try (val content = ((HttpEntityContainer) response).getEntity().getContent()) {
                val results = IOUtils.toString(content, StandardCharsets.UTF_8);
                LOGGER.trace("Received response from endpoint [{}] as [{}]", url, results);
                val payload = MAPPER.readValue(results, CerboseResponse.class);
                if (HttpStatus.resolve(response.getCode()).is2xxSuccessful()
                    && StringUtils.equals(cerbosRequest.getRequestId(), payload.getRequestId())) {
                    return payload.getResults().isEmpty() || payload.getResults().stream().allMatch(result -> actions.stream().allMatch(action -> {
                        val actionResult = result.getActions().get(action);
                        return actionResult != Actions.EFFECT_DENY;
                    }));
                }
            }
        } catch (final Exception e) {
            LoggingUtils.error(LOGGER, e);
        } finally {
            HttpUtils.close(response);
        }
        return false;
    }
This is {@link CerbosRegisteredServiceAccessStrategy} that reaches out
to Cerbos to check for resource access.

@author Misagh Moayyed
@since 7.1.0
core/cas-server-core-services-api/src/main/java/org/apereo/cas/services/CerbosRegisteredServiceAccessStrategy.java