use of org.opensaml.saml2.metadata.impl.IDPSSODescriptorImpl in project MaxKey by dromara.
the class MetadataDescriptorUtil method main.
/**
* @param args
* @throws Exception
* @throws ConfigurationException
* @throws FileNotFoundException
*/
public static void main(String[] args) throws Exception, ConfigurationException, FileNotFoundException {
//
File file = new File("d:\\SAMLSP-00D90000000hf9n.xml");
org.opensaml.DefaultBootstrap.bootstrap();
EntityDescriptor entityDescriptor = MetadataDescriptorUtil.getInstance().getEntityDescriptor(file);
// System.out.println("2 : "+entityDescriptor.getRoleDescriptors());
// System.out.println("3 : "+idpEntityDescriptor.);
// System.out.println("+"+ entityDescriptor.getOrganization());
List<RoleDescriptor> listRoleDescriptor = entityDescriptor.getRoleDescriptors();
for (RoleDescriptor roleDescriptor : listRoleDescriptor) {
// sPSSODescriptor1=idpEntityDescriptor.getSPSSODescriptor(SAMLConstants.SAML20P_NS);
if (roleDescriptor instanceof IDPSSODescriptorImpl) {
IDPSSODescriptor iDPSSODescriptor = (IDPSSODescriptorImpl) roleDescriptor;
System.out.println("3 : " + iDPSSODescriptor.getSingleSignOnServices().get(0).getLocation());
// System.out.println("- : "+iDPSSODescriptor.getNameIDFormats().get(0).getFormat());
// System.out.println("- : "+iDPSSODescriptor.getKeyDescriptors().get(0).getKeyInfo().getX509Datas().get(0));
} else {
SPSSODescriptor sPSSODescriptor = (SPSSODescriptorImpl) roleDescriptor;
System.out.println("- : " + sPSSODescriptor.getAssertionConsumerServices().get(0).getLocation());
// System.out.println("- : "+sPSSODescriptor.getAssertionConsumerServices().get(0).getBinding());
}
// System.out.println("===============================================");
}
// //two
InputStream in = new FileInputStream(file);
EntityDescriptor entityDescriptor1 = MetadataDescriptorUtil.getInstance().getEntityDescriptor(in);
SPSSODescriptor sPSSODescriptor = entityDescriptor1.getSPSSODescriptor(SAMLConstants.SAML20P_NS);
System.out.println("ok :" + sPSSODescriptor.getAssertionConsumerServices().get(0).getLocation());
// System.out.println("ok :"+sPSSODescriptor.getAssertionConsumerServices().get(0).getBinding());
// System.out.println("ok :"+sPSSODescriptor.getNameIDFormats().get(0).getFormat());
// System.out.println("ok :"+sPSSODescriptor.getKeyDescriptors().get(0).getKeyInfo().getX509Datas().get(0));
}
Aggregations