@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
            public ResponseEntity<String> findAll(
                @RequestParam(required = false)
                final String principal,
                @RequestParam(required = false)
                final String service) throws Exception {

                if (StringUtils.isNotBlank(principal)) {
                    val consentDecisions = storage.getRecords().get(principal);
                    if (consentDecisions != null && StringUtils.isNotBlank(principal) && StringUtils.isNotBlank(service)) {
                        val results = consentDecisions
                            .stream()
                            .filter(consentDecision -> consentDecision.getService().equals(service))
                            .findFirst();

                        if (results.isPresent()) {
                            return ResponseEntity.ok(MAPPER.writeValueAsString(results.get()));
                        }
                        return ResponseEntity.notFound().build();
                    }
                    return ResponseEntity.ok(MAPPER.writeValueAsString(consentDecisions));
                }
                val results = storage.getRecords()
                    .values()
                    .stream()
                    .flatMap(List::stream)
                    .collect(Collectors.toList());
                return ResponseEntity.ok(MAPPER.writeValueAsString(results));
            }
This is {@link RestfulConsentRepositoryTests}.

@author Misagh Moayyed
@since 5.2.0
support/cas-server-support-consent-rest/src/test/java/org/apereo/cas/consent/RestfulConsentRepositoryTests.java