private DOMMetadataResolver loadMetadataFromResource(final Resource resource) {
        LOGGER.debug("Loading idp metadata from {}", resource);
        try (var in = SpringResourceHelper.getResourceInputStream(
            resource,
            proxy,
            sslSocketFactory,
            hostnameVerifier,
            configuration.getIdentityProviderMetadataConnectTimeout(),
            configuration.getIdentityProviderMetadataReadTimeout()
        )) {
            var parsedInput = Configuration.getParserPool().parse(in);
            var metadataRoot = parsedInput.getDocumentElement();
            var resolver = new DOMMetadataResolver(metadataRoot);
            resolver.setIndexes(Collections.singleton(new RoleMetadataIndex()));
            resolver.setParserPool(Configuration.getParserPool());
            resolver.setFailFastInitialization(true);
            resolver.setRequireValidMetadata(true);
            resolver.setId(resolver.getClass().getCanonicalName());

            var entityRoleFilter = new EntityRoleFilter(List.of(IDPSSODescriptor.DEFAULT_ELEMENT_NAME));
            entityRoleFilter.initialize();

            resolver.setMetadataFilter(entityRoleFilter);
            resolver.initialize();
            return resolver;
        } catch (final FileNotFoundException e) {
            throw new TechnicalException("Error loading idp metadata", e);
        } catch (final ComponentInitializationException e) {
            throw new TechnicalException("Error initializing idp metadata resolver", e);
        } catch (final XMLParserException e) {
            throw new TechnicalException("Error parsing idp metadata", e);
        } catch (final IOException e) {
            throw new TechnicalException("Error getting idp metadata resource", e);
        }
    }
Resolve and download idp metadata to form a metadata resolver.
<p>
The resolver supports proxies using {@link Proxy} when fetching metadata over URL resources.

@author Misagh Moayyed
@since 1.7
pac4j-saml/src/main/java/org/pac4j/saml/metadata/SAML2IdentityProviderMetadataResolver.java