コード例 #1
0
ファイル: Saml2ClientTest.java プロジェクト: epochzh/pac4j
 @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);
 }
コード例 #2
0
ファイル: Saml2ClientTest.java プロジェクト: epochzh/pac4j
 @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);
 }