protected void buildRequiredValidUntilFilterIfNeeded(final SamlRegisteredService service,
                                                         final List<MetadataFilter> metadataFilterList) throws Exception {
        if (service.getMetadataMaxValidity() > 0) {
            val filter = new RequiredValidUntilFilter();
            filter.setMaxValidityInterval(Duration.ofSeconds(service.getMetadataMaxValidity()));
            filter.initialize();
            metadataFilterList.add(filter);
            LOGGER.debug("Added metadata RequiredValidUntilFilter with max validity of [{}]", service.getMetadataMaxValidity());
        } else {
            LOGGER.debug("No metadata maximum validity criteria is defined for [{}], so RequiredValidUntilFilter will not be invoked",
                service.getMetadataLocation());
        }
    }
Build required valid until filter if needed. See {@link RequiredValidUntilFilter}.

@param service            the service
@param metadataFilterList the metadata filter list
support/cas-server-support-saml-idp-metadata/src/main/java/org/apereo/cas/support/saml/services/idp/metadata/cache/resolver/BaseSamlRegisteredServiceMetadataResolver.java