private File getMetadataArtifactFile(final Optional<SamlRegisteredService> registeredService,
                                         final String fileName) {
        val defaultMetadataDirectory = getMetadataDirectory(Optional.empty());
        val directory = getMetadataDirectory(registeredService);
        val file = new File(directory, fileName);
        if (file.exists() && file.canRead() && file.length() > 0) {
            return file;
        }
        return new File(defaultMetadataDirectory, fileName);
    }
This is {@link GitSamlIdPMetadataLocator}.

@author Misagh Moayyed
@since 6.3.0
support/cas-server-support-saml-idp-metadata-git/src/main/java/org/apereo/cas/support/saml/idp/metadata/GitSamlIdPMetadataLocator.java