use of org.opensaml.saml2.metadata.provider.DOMMetadataProvider in project cloud-pipeline by epam.
the class CustomSamlClient method createMetadataProvider.
private static MetadataProvider createMetadataProvider(Reader metadata) throws SAMLException {
try {
DOMParser parser = createDOMParser();
parser.parse(new InputSource(metadata));
DOMMetadataProvider provider = new DOMMetadataProvider(parser.getDocument().getDocumentElement());
provider.initialize();
return provider;
} catch (IOException | SAXException | MetadataProviderException ex) {
throw new SAMLException("Cannot load identity provider metadata", ex);
}
}
use of org.opensaml.saml2.metadata.provider.DOMMetadataProvider in project MaxKey by dromara.
the class MetadataDescriptorUtil method getEntityDescriptor.
// from dom
public EntityDescriptor getEntityDescriptor(Element elementMetadata) throws Exception {
try {
DOMMetadataProvider dOMMetadataProvider = new DOMMetadataProvider(elementMetadata);
// Enable
dOMMetadataProvider.setRequireValidMetadata(true);
// validation
dOMMetadataProvider.setParserPool(new BasicParserPool());
dOMMetadataProvider.initialize();
EntityDescriptor entityDescriptor = (EntityDescriptorImpl) dOMMetadataProvider.getMetadata();
return entityDescriptor;
} catch (MetadataProviderException e) {
logger.error("元数据解析出错", e);
throw new Exception("元数据解析出错", e);
}
}
Aggregations