use of org.apereo.cas.support.saml.InMemoryResourceMetadataResolver in project cas by apereo.
the class BaseSamlRegisteredServiceMetadataResolver method buildMetadataResolverFrom.
/**
* Build metadata resolver from document.
*
* @param service the service
* @param metadataDocument the metadata document
* @return the metadata resolver
*/
protected AbstractMetadataResolver buildMetadataResolverFrom(final SamlRegisteredService service, final SamlMetadataDocument metadataDocument) {
try {
final String desc = StringUtils.defaultString(service.getDescription(), service.getName());
final InputStreamResource metadataResource = ResourceUtils.buildInputStreamResourceFrom(metadataDocument.getValue(), desc);
final AbstractMetadataResolver metadataResolver = new InMemoryResourceMetadataResolver(ResourceHelper.of(metadataResource));
final List<MetadataFilter> metadataFilterList = new ArrayList<>();
if (StringUtils.isNotBlank(metadataDocument.getSignature())) {
final InputStreamResource signatureResource = ResourceUtils.buildInputStreamResourceFrom(metadataDocument.getSignature(), desc);
buildSignatureValidationFilterIfNeeded(service, metadataFilterList, signatureResource);
}
configureAndInitializeSingleMetadataResolver(metadataResolver, service, metadataFilterList);
return metadataResolver;
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return null;
}
Aggregations