use of org.apereo.cas.configuration.model.support.saml.idp.metadata.RestSamlMetadataProperties in project cas by apereo.
the class RestSamlRegisteredServiceMetadataResolver method resolve.
@Override
public Collection<MetadataResolver> resolve(final SamlRegisteredService service) {
try {
final RestSamlMetadataProperties rest = samlIdPProperties.getMetadata().getRest();
final HttpResponse response = HttpUtils.execute(rest.getUrl(), rest.getMethod(), rest.getBasicAuthUsername(), rest.getBasicAuthPassword(), CollectionUtils.wrap("entityId", service.getServiceId()), CollectionUtils.wrap("Content-Type", MediaType.APPLICATION_XML_VALUE));
if (response != null && response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
final SamlMetadataDocument doc = MAPPER.readValue(response.getEntity().getContent(), SamlMetadataDocument.class);
final MetadataResolver resolver = buildMetadataResolverFrom(service, doc);
return CollectionUtils.wrapList(resolver);
}
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
return null;
}
Aggregations