@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); }
@Override protected BaseClient<Saml2Credentials, Saml2Profile> newClient() { Saml2Client client = new Saml2Client(); client.setKeystorePath(this.keystorePath); client.setKeystorePassword(this.keystorePassword); client.setPrivateKeyPassword(this.privateKeyPassword); client.setIdpMetadata(this.idpMetadata); client.setIdpMetadataPath(this.idpMetadataPath); client.setIdpEntityId(this.idpEntityId); client.setSpEntityId(this.spEntityId); client.setMaximumAuthenticationLifetime(this.maximumAuthenticationLifetime); client.setCallbackUrl(this.callbackUrl); client.setDestinationBindingType(this.destinationBindingType); client.setComparisonType(this.comparisonType); return client; }