private static SAML2Configuration initialConfiguration() throws MalformedURLException {
        final ConfigurationManager mgr = new DefaultConfigurationManager();
        mgr.configure();

        val configuration = new SAML2Configuration();
        configuration.setForceKeystoreGeneration(true);
        configuration.setKeystorePath("target/keystore.jks");
        configuration.setKeystorePassword("pac4j");
        configuration.setPrivateKeyPassword("pac4j");
        configuration.setSignMetadata(true);
        configuration.setServiceProviderEntityId("urn:mace:saml:pac4j.org");
        configuration.setServiceProviderMetadataResource(new UrlResource("http://localhost:8088/saml"));
        configuration.setIdentityProviderMetadataResource(new ClassPathResource("idp-metadata.xml"));
        configuration.init();
        return configuration;
    }
This is {@link SAML2HttpUrlMetadataGeneratorTests}.

@author Misagh Moayyed
pac4j-saml/src/test/java/org/pac4j/saml/metadata/SAML2HttpUrlMetadataGeneratorTests.java