@Test public void testIdpMetadataParsing_fromFile() { Saml2Client client = new Saml2Client(); client.setIdpMetadataPath("resource:testshib-providers.xml"); StaticBasicParserPool parserPool = client.newStaticBasicParserPool(); AbstractMetadataProvider provider = client.idpMetadataProvider(parserPool); XMLObject md = client.getXmlObject(provider); String id = client.getIdpEntityId(md); assertEquals("https://idp.testshib.org/idp/shibboleth", id); }
@Test public void testIdpMetadataParsing_fromString() throws IOException { Saml2Client client = new Saml2Client(); InputStream metaDataInputStream = getClass().getClassLoader().getResourceAsStream("testshib-providers.xml"); String metadata = IOUtils.toString(metaDataInputStream, "UTF-8"); client.setIdpMetadata(metadata); StaticBasicParserPool parserPool = client.newStaticBasicParserPool(); AbstractMetadataProvider provider = client.idpMetadataProvider(parserPool); XMLObject md = client.getXmlObject(provider); String id = client.getIdpEntityId(md); assertEquals("https://idp.testshib.org/idp/shibboleth", id); }