Example #1
0
 @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);
 }
Example #2
0
 @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);
 }
Example #3
0
 @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;
 }