@Override
    public boolean isConsentRequired(final Service service, final RegisteredService registeredService,
                                     final Authentication authentication,
                                     final HttpServletRequest requestContext) throws Throwable {
        val consentPolicy = registeredService.getAttributeReleasePolicy().getConsentPolicy();
        if (consentPolicy != null) {
            switch (consentPolicy.getStatus()) {
                case TRUE -> {
                    LOGGER.trace("Attribute consent is enabled for registered service [{}]", registeredService.getName());
                    return consentEngine.isConsentRequiredFor(service, registeredService, authentication).isRequired();
                }
                case FALSE -> {
                    LOGGER.trace("Attribute consent will be skipped as the attribute consent policy for service [{}] "
                                 + "is disabled for this request", registeredService.getName());
                    return false;
                }
                case UNDEFINED -> LOGGER.trace("Attribute consent policy for service [{}] is undefined", registeredService.getName());
            }
        }
        if (casProperties.getConsent().getCore().isActive()) {
            LOGGER.trace("Attribute consent is enabled globally for all requests");
            return consentEngine.isConsentRequiredFor(service, registeredService, authentication).isRequired();
        }
        LOGGER.trace("Attribute consent will be skipped as neither the attribute consent policy for service [{}] "
                     + "nor the global CAS consent policy are enabled for this request", registeredService.getName());
        return false;
    }
This is {@link DefaultConsentActivationStrategy}.

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