@Audit(action = AuditableActions.VERIFY_CONSENT,
        actionResolverName = AuditActionResolvers.VERIFY_CONSENT_ACTION_RESOLVER,
        resourceResolverName = AuditResourceResolvers.VERIFY_CONSENT_RESOURCE_RESOLVER)
    @Override
    public ConsentQueryResult isConsentRequiredFor(final Service service,
                                                   final RegisteredService registeredService,
                                                   final Authentication authentication) throws Throwable {
        val attributes = resolveConsentableAttributesFrom(authentication, service, registeredService);
        if (attributes == null || attributes.isEmpty()) {
            LOGGER.debug("Consent is conditionally ignored for service [{}] given no consentable attributes are found", registeredService.getName());
            return ConsentQueryResult.ignored()
                .withService(service).withAuthentication(authentication);
        }

        LOGGER.debug("Locating consent decision for service [{}]", service);
        val decision = findConsentDecision(service, registeredService, authentication);
        if (decision == null) {
            LOGGER.debug("No consent decision found; thus attribute consent is required");
            return ConsentQueryResult.required()
                .withService(service).withAuthentication(authentication);
        }

        LOGGER.debug("Located consentable attributes for release [{}]", attributes.keySet());
        if (consentDecisionBuilder.doesAttributeReleaseRequireConsent(decision, attributes)) {
            LOGGER.debug("Consent is required based on past decision [{}] and attribute release policy for [{}]",
                decision, registeredService.getName());
            return ConsentQueryResult.required().withService(service)
                .withConsentDecision(decision).withAuthentication(authentication);
        }

        LOGGER.debug("Consent is not required yet for [{}]; checking for reminder options", service);
        val unit = decision.getReminderTimeUnit();
        val dt = decision.getCreatedDate().plus(decision.getReminder(), unit);
        val now = LocalDateTime.now(ZoneId.systemDefault());

        LOGGER.debug("Reminder threshold date/time is calculated as [{}]", dt);
        if (now.isAfter(dt)) {
            LOGGER.debug("Consent is required based on reminder options given now at [{}] is after [{}]", now, dt);
            return ConsentQueryResult.required().withService(service)
                .withConsentDecision(decision).withAuthentication(authentication);
        }

        LOGGER.debug("Consent is not required for service [{}]", service);
        return ConsentQueryResult.ignored()
            .withService(service).withAuthentication(authentication);
    }
This is {@link DefaultConsentEngine}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-consent-core/src/main/java/org/apereo/cas/consent/DefaultConsentEngine.java