@Override
    protected SamlIdPMetadataDocument fetchInternal(final Optional<SamlRegisteredService> registeredService) throws Exception {
        return FunctionUtils.doUnchecked(() -> {
            val doc = new SamlIdPMetadataDocument();
            try (val in = resolveMetadata(registeredService).getInputStream()) {
                doc.setMetadata(IOUtils.toString(in, StandardCharsets.UTF_8));
            }
            try (val in = resolveEncryptionCertificate(registeredService).getInputStream()) {
                doc.setEncryptionCertificate(IOUtils.toString(in, StandardCharsets.UTF_8));
            }
            try (val in = resolveEncryptionKey(registeredService).getInputStream()) {
                doc.setEncryptionKey(IOUtils.toString(in, StandardCharsets.UTF_8));
            }
            try (val in = resolveSigningCertificate(registeredService).getInputStream()) {
                doc.setSigningCertificate(IOUtils.toString(in, StandardCharsets.UTF_8));
            }
            try (val in = resolveSigningKey(registeredService).getInputStream()) {
                doc.setSigningKey(IOUtils.toString(in, StandardCharsets.UTF_8));
            }
            doc.setAppliesTo(getAppliesToFor(registeredService));
            return doc;
        });
    }
This is {@link FileSystemSamlIdPMetadataLocator}.

@author Misagh Moayyed
@since 5.3.0
support/cas-server-support-saml-idp-core/src/main/java/org/apereo/cas/support/saml/idp/metadata/locator/FileSystemSamlIdPMetadataLocator.java